[CMake] TestWebKitAPI bundle should link with WTF
[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     ${CMAKE_SOURCE_DIR}/Source
6     ${DERIVED_SOURCES_WEBKIT2_DIR}/include
7     ${JAVASCRIPTCORE_DIR}
8     ${JAVASCRIPTCORE_DIR}/API
9     ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
10     ${THIRDPARTY_DIR}/gtest/include
11     ${WEBCORE_DIR}/editing
12     ${WEBCORE_DIR}/platform
13     ${WEBCORE_DIR}/platform/graphics
14     ${WEBCORE_DIR}/platform/text
15     ${WEBCORE_DIR}/platform/network
16     ${WEBKIT2_DIR}/Shared
17     ${WEBKIT2_DIR}/Shared/API/c
18     ${WEBKIT2_DIR}/UIProcess
19     ${WTF_DIR}
20 )
21
22 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
23
24 ADD_LIBRARY(TestWebKitAPIInjectedBundle SHARED
25     ${bundle_harness_SOURCES}
26     ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
27     ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
28     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
29     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
30     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
31     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
32     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
33     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
34     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
35     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
36     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
37     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
38     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
39     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
40     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
41     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
42     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
43     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
44     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
45     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
46     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
47     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKConnection_Bundle.cpp
48     ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
49 )
50
51 TARGET_LINK_LIBRARIES(TestWebKitAPIInjectedBundle ${WTF_LIBRARY_NAME})
52 ADD_DEPENDENCIES(TestWebKitAPIInjectedBundle ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
53
54 GET_PROPERTY(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
55
56 ADD_DEFINITIONS(-DGTEST_LINKED_AS_SHARED_LIBRARY=1
57     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
58     -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
59 )
60
61 SET(test_wtf_LIBRARIES
62     ${WTF_LIBRARY_NAME}
63     gtest
64 )
65
66 ADD_EXECUTABLE(test_wtf
67     ${test_main_SOURCES}
68     ${TESTWEBKITAPI_DIR}/TestsController.cpp
69     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
70     ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
71     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
72     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
73     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
74     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
75     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
76     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
77     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
78     ${TESTWEBKITAPI_DIR}/Tests/WTF/VectorBasic.cpp
79     ${TESTWEBKITAPI_DIR}/Tests/WTF/VectorReverse.cpp
80 )
81
82 TARGET_LINK_LIBRARIES(test_wtf ${test_wtf_LIBRARIES})
83 ADD_DEPENDENCIES(test_wtf ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
84 ADD_TEST(test_wtf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_wtf)
85 SET_TESTS_PROPERTIES(test_wtf PROPERTIES TIMEOUT 60)
86
87 SET(test_webcore_LIBRARIES
88     ${WTF_LIBRARY_NAME}
89     ${WebCore_LIBRARY_NAME}
90     gtest
91 )
92
93 ADD_EXECUTABLE(test_webcore
94     ${test_main_SOURCES}
95     ${TESTWEBKITAPI_DIR}/TestsController.cpp
96     ${TESTWEBKITAPI_DIR}/Tests/WebCore/KURL.cpp
97 )
98
99 TARGET_LINK_LIBRARIES(test_webcore ${test_webcore_LIBRARIES})
100 ADD_DEPENDENCIES(test_webcore ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
101 ADD_TEST(test_webcore ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webcore)
102 SET_TESTS_PROPERTIES(test_webcore PROPERTIES TIMEOUT 60)
103
104 ADD_LIBRARY(TestWebKitAPIBase
105     ${test_main_SOURCES}
106     ${webkit2_api_harness_SOURCES}
107     ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
108     ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
109     ${TESTWEBKITAPI_DIR}/TestsController.cpp
110 )
111
112 ADD_DEPENDENCIES(TestWebKitAPIBase ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
113
114 SET(test_webkit2_api_LIBRARIES
115     TestWebKitAPIBase
116     ${WTF_LIBRARY_NAME}
117     ${JavaScriptCore_LIBRARY_NAME}
118     ${WebKit2_LIBRARY_NAME}
119     gtest
120 )
121
122 FOREACH(testName ${test_webkit2_api_BINARIES})
123     ADD_EXECUTABLE(test_webkit2_api_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
124     ADD_TEST(test_webkit2_api_${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webkit2_api_${testName})
125     SET_TESTS_PROPERTIES(test_webkit2_api_${testName} PROPERTIES TIMEOUT 60)
126     TARGET_LINK_LIBRARIES(test_webkit2_api_${testName} ${test_webkit2_api_LIBRARIES})
127 ENDFOREACH()
128
129 # We don't run tests that are expected to fail. We could use the WILL_FAIL
130 # property, but it reports failure when the test crashes or timeouts and would
131 # make the bot red.
132
133 FOREACH(testName ${test_webkit2_api_fail_BINARIES})
134     ADD_EXECUTABLE(test_webkit2_api_fail_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
135     TARGET_LINK_LIBRARIES(test_webkit2_api_fail_${testName} ${test_webkit2_api_LIBRARIES})
136 ENDFOREACH()