[GTK] Use custom JavaScript instead of DBus to implement WebProcess tests
[WebKit-https.git] / Tools / TestWebKitAPI / Tests / WebKit2Gtk / CMakeLists.txt
1 set(TEST_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit2GtkAPITests)
2 set(TEST_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI/WebKit2Gtk)
3 set(TEST_RESOURCES_DIR ${TEST_BINARY_DIR}/resources)
4 file(MAKE_DIRECTORY ${TEST_RESOURCES_DIR})
5
6 add_definitions(
7     -DWEBKIT_TEST_PLUGIN_DIR="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins"
8     -DWEBKIT_EXEC_PATH="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
9     -DWEBKIT_SRC_DIR="${CMAKE_SOURCE_DIR}"
10     -DWEBKIT_TEST_WEB_EXTENSIONS_DIR="${TEST_LIBRARY_DIR}"
11     -DWEBKIT_INJECTED_BUNDLE_PATH="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
12 )
13
14 include_directories(
15     ${CMAKE_BINARY_DIR}
16     ${CMAKE_SOURCE_DIR}/Source
17     ${CMAKE_SOURCE_DIR}/Source/WTF
18     ${DERIVED_SOURCES_DIR}
19     ${DERIVED_SOURCES_WEBKIT2GTK_DIR}
20     ${FORWARDING_HEADERS_DIR}
21     ${FORWARDING_HEADERS_WEBKIT2GTK_DIR}
22     ${FORWARDING_HEADERS_WEBKIT2GTK_EXTENSION_DIR}
23     ${TOOLS_DIR}/TestWebKitAPI/gtk/WebKit2Gtk
24     ${ATSPI_INCLUDE_DIRS}
25     ${GLIB_INCLUDE_DIRS}
26     ${GTK3_INCLUDE_DIRS}
27     ${GTK_UNIX_PRINT_INCLUDE_DIRS}
28     ${LIBSOUP_INCLUDE_DIRS}
29 )
30
31 add_library(WebKit2APITestCore STATIC
32     ${TOOLS_DIR}/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp
33     ${TOOLS_DIR}/TestWebKitAPI/gtk/WebKit2Gtk/WebKitTestBus.cpp
34     ${TOOLS_DIR}/TestWebKitAPI/gtk/WebKit2Gtk/WebKitTestServer.cpp
35     ${TOOLS_DIR}/TestWebKitAPI/gtk/WebKit2Gtk/TestMain.cpp
36     ${TOOLS_DIR}/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp
37 )
38 target_link_libraries(WebKit2APITestCore WebKit2)
39
40 add_custom_command(
41     OUTPUT ${TEST_RESOURCES_DIR}/webkit2gtk-tests-resources.gresource
42     DEPENDS resources/webkit2gtk-tests.gresource.xml
43             resources/link-title.js
44     COMMAND glib-compile-resources
45             --target=${TEST_RESOURCES_DIR}/webkit2gtk-tests-resources.gresource
46             --sourcedir=${CMAKE_SOURCE_DIR}
47             ${CMAKE_CURRENT_LIST_DIR}/resources/webkit2gtk-tests.gresource.xml
48 )
49
50 add_custom_target(test-gresource-bundle
51     DEPENDS ${TEST_RESOURCES_DIR}/webkit2gtk-tests-resources.gresource
52 )
53
54 macro(ADD_WK2_TEST_WEB_EXTENSION extension_name)
55     add_library(${extension_name} MODULE ${ARGN})
56     add_dependencies(${extension_name} WebKit2)
57     set_property(
58         TARGET ${extension_name}
59         APPEND
60         PROPERTY COMPILE_DEFINITIONS WEBKIT2_COMPILATION
61     )
62     set_target_properties(${extension_name} PROPERTIES
63         LIBRARY_OUTPUT_DIRECTORY ${TEST_LIBRARY_DIR}
64     )
65 endmacro()
66
67 macro(ADD_WK2_TEST test_name)
68     add_executable(${test_name} ${ARGN})
69     add_dependencies(${test_name}
70         test-gresource-bundle
71         WebExtensionTest
72     )
73     target_link_libraries(${test_name}
74         JavaScriptCore
75         WebKit2
76         WebKit2APITestCore
77         ${ATSPI_LIBRARIES}
78         ${GLIB_LIBRARIES}
79         ${GTK3_LIBRARIES}
80         ${GTK_UNIX_PRINT_LIBRARIES}
81         ${LIBSOUP_LIBRARIES}
82     )
83     set_target_properties(${test_name} PROPERTIES
84         RUNTIME_OUTPUT_DIRECTORY ${TEST_BINARY_DIR}
85     )
86 endmacro()
87
88 ADD_WK2_TEST_WEB_EXTENSION(WebExtensionTest WebExtensionTest.cpp)
89 ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest DOMNodeTest.cpp DOMNodeFilterTest.cpp DOMXPathNSResolverTest.cpp FrameTest.cpp WebProcessTest.cpp)
90
91 ADD_WK2_TEST(InspectorTestServer InspectorTestServer.cpp)
92 ADD_WK2_TEST(TestAuthentication TestAuthentication.cpp)
93 ADD_WK2_TEST(TestBackForwardList TestBackForwardList.cpp)
94 ADD_WK2_TEST(TestContextMenu TestContextMenu.cpp)
95 ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)
96 ADD_WK2_TEST(TestDOMNode TestDOMNode.cpp)
97 ADD_WK2_TEST(TestDOMNodeFilter TestDOMNodeFilter.cpp)
98 ADD_WK2_TEST(TestDOMXPathNSResolver TestDOMXPathNSResolver.cpp)
99 ADD_WK2_TEST(TestDownloads TestDownloads.cpp)
100 ADD_WK2_TEST(TestWebKitFaviconDatabase TestWebKitFaviconDatabase.cpp)
101 ADD_WK2_TEST(TestWebKitFindController TestWebKitFindController.cpp)
102 ADD_WK2_TEST(TestFrame TestFrame.cpp)
103 ADD_WK2_TEST(TestInspector TestInspector.cpp)
104 ADD_WK2_TEST(TestInspectorServer TestInspectorServer.cpp)
105 ADD_WK2_TEST(TestLoaderClient TestLoaderClient.cpp)
106 ADD_WK2_TEST(TestMultiprocess TestMultiprocess.cpp)
107 ADD_WK2_TEST(TestPrinting TestPrinting.cpp)
108 ADD_WK2_TEST(TestResources TestResources.cpp)
109 ADD_WK2_TEST(TestSSL TestSSL.cpp)
110 ADD_WK2_TEST(TestUIClient TestUIClient.cpp)
111 ADD_WK2_TEST(TestWebExtensions TestWebExtensions.cpp)
112 ADD_WK2_TEST(TestWebKitPolicyClient TestWebKitPolicyClient.cpp)
113 ADD_WK2_TEST(TestWebKitSettings TestWebKitSettings.cpp)
114 ADD_WK2_TEST(TestWebKitVersion TestWebKitVersion.cpp)
115 ADD_WK2_TEST(TestWebViewEditor TestWebViewEditor.cpp)
116 ADD_WK2_TEST(TestWebKitWebContext TestWebKitWebContext.cpp)
117 ADD_WK2_TEST(TestWebKitWebView TestWebKitWebView.cpp)
118 ADD_WK2_TEST(TestWebKitUserContentManager TestWebKitUserContentManager.cpp)
119
120 if (ATSPI_FOUND)
121     ADD_WK2_TEST(AccessibilityTestServer AccessibilityTestServer.cpp)
122     ADD_WK2_TEST(TestWebKitAccessibility TestWebKitAccessibility.cpp)
123 endif ()