[GTK] [CMake] Build the WebKit2 GObject API tests
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / gtk / tests / CMakeLists.txt
1 set(WEBKIT2_FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders/webkit2gtk)
2 set(TEST_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit2GObjectAPITests)
3 set(TEST_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit2GObjectAPITests)
4 set(TEST_RESOURCES_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources)
5 file(MAKE_DIRECTORY ${TEST_RESOURCES_DIR})
6
7 add_definitions(
8     -DWEBKIT_TEST_PLUGIN_DIR="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
9     -DWEBKIT_EXEC_PATH="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
10     -DWEBKIT_SRC_DIR="${CMAKE_SRC_DIR}"
11     -DWEBKIT_TEST_WEB_EXTENSIONS_DIR="${TEST_LIBRARY_DIR}"
12     -DWEBKIT_INJECTED_BUNDLE_PATH="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
13 )
14
15 include_directories(
16     ${CMAKE_BINARY_DIR}
17     ${CMAKE_SOURCE_DIR}/Source
18     ${CMAKE_SOURCE_DIR}/Source/WTF
19     ${DERIVED_SOURCES_DIR}
20     ${DERIVED_SOURCES_DIR}/ForwardingHeaders
21     ${DERIVED_SOURCES_DIR}/webkit2gtk
22     ${DERIVED_SOURCES_DIR}/WebKit2/include
23     ${WEBKIT2_FORWARDING_HEADERS_DIR}
24     ${WEBKIT2_FORWARDING_HEADERS_DIR}/webkit2extension
25     ${ATSPI_INCLUDE_DIRS}
26     ${GLIB_INCLUDE_DIRS}
27     ${GTK3_INCLUDE_DIRS}
28     ${LIBSOUP_INCLUDE_DIRS}
29 )
30
31 add_library(WebKit2APITestCore STATIC
32     LoadTrackingTest.cpp
33     WebKitTestBus.cpp
34     WebKitTestServer.cpp
35     WebProcessTestRunner.cpp
36     TestMain.cpp
37     WebViewTest.cpp
38 )
39
40 add_custom_target(test-gresource-bundle
41     DEPENDS resources/webkit2gtk-tests.gresource.xml
42             resources/link-title.js
43     COMMAND glib-compile-resources --target=${TEST_RESOURCES_DIR}/webkit2gtk-tests-resources.gresource --sourcedir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml
44 )
45
46 macro(ADD_WK2_TEST_WEB_EXTENSION extension_name)
47     add_library(${extension_name} MODULE ${ARGN})
48     set_property(
49         TARGET ${extension_name}
50         APPEND
51         PROPERTY COMPILE_DEFINITIONS WEBKIT2_COMPILATION
52     )
53     set_target_properties(${extension_name} PROPERTIES
54         LIBRARY_OUTPUT_DIRECTORY ${TEST_LIBRARY_DIR}
55     )
56 endmacro()
57
58 macro(ADD_WK2_TEST test_name)
59     add_executable(${test_name} ${ARGN})
60     add_dependencies(${test_name}
61         test-gresource-bundle
62         WebExtensionTest
63     )
64     target_link_libraries(${test_name}
65         JavaScriptCore
66         WebKit2
67         WebKit2APITestCore
68         ${ATSPI_LIBRARIES}
69         ${GLIB_LIBRARIES}
70         ${GTK3_LIBRARIES}
71         ${LIBSOUP_LIBRARIES}
72     )
73     set_target_properties(${test_name} PROPERTIES
74         RUNTIME_OUTPUT_DIRECTORY ${TEST_BINARY_DIR}
75     )
76 endmacro()
77
78 ADD_WK2_TEST_WEB_EXTENSION(WebExtensionTest WebExtensionTest.cpp)
79 ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest DOMNodeTest.cpp FrameTest.cpp WebProcessTest.cpp)
80
81 ADD_WK2_TEST(InspectorTestServer InspectorTestServer.cpp)
82 ADD_WK2_TEST(TestBackForwardList TestBackForwardList.cpp)
83 ADD_WK2_TEST(TestContextMenu TestContextMenu.cpp)
84 ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)
85 ADD_WK2_TEST(TestDOMNode TestDOMNode.cpp)
86 ADD_WK2_TEST(TestDownloads TestDownloads.cpp)
87 ADD_WK2_TEST(TestFrame TestFrame.cpp)
88 ADD_WK2_TEST(TestInspector TestInspector.cpp)
89 ADD_WK2_TEST(TestInspectorServer TestInspectorServer.cpp)
90 ADD_WK2_TEST(TestLoaderClient TestLoaderClient.cpp)
91 ADD_WK2_TEST(TestPrinting TestPrinting.cpp)
92 ADD_WK2_TEST(TestSSL TestSSL.cpp)
93 ADD_WK2_TEST(TestWebExtensions TestWebExtensions.cpp)
94 ADD_WK2_TEST(TestWebKitPolicyClient TestWebKitPolicyClient.cpp)
95 ADD_WK2_TEST(TestWebKitSettings TestWebKitSettings.cpp)
96 ADD_WK2_TEST(TestWebKitVersion TestWebKitVersion.cpp)
97 ADD_WK2_TEST(TestWebKitWebViewGroup TestWebKitWebViewGroup.cpp)
98 ADD_WK2_TEST(TestWebKitWebContext TestWebKitWebContext.cpp)
99 ADD_WK2_TEST(TestWebKitWebView TestWebKitWebView.cpp)
100
101 if (ATSPI_FOUND)
102     ADD_WK2_TEST(AccessibilityTestServer AccessibilityTestServer.cpp)
103     ADD_WK2_TEST(TestWebKitAccessibility TestWebKitAccessibility.cpp)
104 endif ()