55d4716a9c09fb2dc4e7588d618f4d34e458779e
[WebKit-https.git] / Tools / TestWebKitAPI / CMakeLists.txt
1 set(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
2 set(TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/TestWebKitAPI")
3
4 include_directories(${CMAKE_BINARY_DIR}
5     ${TESTWEBKITAPI_DIR}
6     ${TESTWEBKITAPI_DIR}
7     ${CMAKE_SOURCE_DIR}/Source
8     ${DERIVED_SOURCES_WEBCORE_DIR}
9     ${JAVASCRIPTCORE_DIR}
10     ${JAVASCRIPTCORE_DIR}/API
11     ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
12     ${THIRDPARTY_DIR}/gtest/include
13     ${WEBCORE_DIR}/editing
14     ${WEBCORE_DIR}/platform
15     ${WEBCORE_DIR}/platform/graphics
16     ${WEBCORE_DIR}/platform/text
17     ${WEBCORE_DIR}/platform/network
18     ${WEBCORE_DIR}/platform/network/soup
19     ${WEBKIT2_DIR}/Platform/IPC
20     ${WEBKIT2_DIR}/Shared
21     ${WEBKIT2_DIR}/Shared/API/c
22     ${WEBKIT2_DIR}/Shared/Plugins
23     ${WEBKIT2_DIR}/UIProcess
24     ${WEBKIT2_DIR}/WebProcess/InjectedBundle
25     ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
26     ${WTF_DIR}
27 )
28
29 set(test_wtf_LIBRARIES
30     WTF
31     gtest
32 )
33
34 set(test_webcore_LIBRARIES
35     gtest
36     WTF
37     WebCore
38 )
39
40 set(test_webkit2_api_LIBRARIES
41     TestWebKitAPIBase
42     WTF
43     JavaScriptCore
44     WebKit2
45     gtest
46 )
47
48 set(TestWebKitAPI_LIBRARIES
49     WTF
50     WebKit2
51 )
52
53 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
54
55 add_library(TestWebKitAPIInjectedBundle SHARED
56     ${bundle_harness_SOURCES}
57     ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
58     ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
59     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
60     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
61     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp
62     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
63     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
64     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
65     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
66     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
67     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
68     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
70     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
71     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
72     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
73     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
74     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
75     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
76     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
77     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
78     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
79     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
80     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillLoad_Bundle.cpp
81     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
82 )
83
84 target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
85 add_dependencies(TestWebKitAPIInjectedBundle ${ForwardingHeadersForTestWebKitAPI_NAME})
86
87 get_property(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
88
89 add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DGTEST_HAS_RTTI=0
90     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
91     -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
92 )
93
94 add_executable(TestWTF
95     ${test_main_SOURCES}
96     ${TESTWEBKITAPI_DIR}/TestsController.cpp
97     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
98     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
99     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
100     ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
101     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
102     ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
103     ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
104     ${TESTWEBKITAPI_DIR}/Tests/WTF/MD5.cpp
105     ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
106     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
107     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
108     ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
109     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
110     ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
111     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
112     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
113     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
114     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
115     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
116     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
117     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
118     ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
119 )
120
121 target_link_libraries(TestWTF ${test_wtf_LIBRARIES})
122 add_dependencies(TestWTF ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
123 add_test(TestWTF ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF/TestWTF)
124 set_tests_properties(TestWTF PROPERTIES TIMEOUT 60)
125     set_target_properties(TestWTF PROPERTIES
126         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WTF
127     )
128
129 foreach (testName ${test_webcore_BINARIES})
130     add_executable(${testName} ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp ${TESTWEBKITAPI_DIR}/Tests/WebCore/${testName}.cpp)
131     add_test(${testName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/${testName})
132     set_tests_properties(${testName} PROPERTIES TIMEOUT 60)
133     target_link_libraries(${testName} ${test_webcore_LIBRARIES})
134     set_target_properties(${testName} PROPERTIES
135         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore
136     )
137 endforeach ()
138
139 add_library(TestWebKitAPIBase
140     ${test_main_SOURCES}
141     ${webkit2_api_harness_SOURCES}
142     ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
143     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
144     ${TESTWEBKITAPI_DIR}/TestsController.cpp
145 )
146
147 add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
148
149 foreach (testName ${test_webkit2_api_BINARIES})
150     get_filename_component(testBaseName ${testName} NAME)
151     add_executable(${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
152     add_test(${testBaseName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/${testBaseName})
153     set_tests_properties(${testBaseName} PROPERTIES TIMEOUT 60)
154     target_link_libraries(${testBaseName} ${test_webkit2_api_LIBRARIES})
155     set_target_properties(${testBaseName} PROPERTIES
156         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
157     )
158 endforeach ()
159
160 # We don't run tests that are expected to fail. We could use the WILL_FAIL
161 # property, but it reports failure when the test crashes or timeouts and would
162 # make the bot red.
163
164 foreach (testName ${test_webkit2_api_fail_BINARIES})
165     add_executable(${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
166     target_link_libraries(${testName} ${test_webkit2_api_LIBRARIES})
167     set_target_properties(${testBaseName} PROPERTIES
168         RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
169     )
170 endforeach ()