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