[WTF] Add Markable<T, Traits>
[WebKit-https.git] / Tools / TestWebKitAPI / CMakeLists.txt
1 set(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
2 set(test_wtf_LIBRARIES
3     WTF${DEBUG_SUFFIX}
4     gtest
5 )
6
7 set(test_webcore_LIBRARIES
8     WTF${DEBUG_SUFFIX}
9     WebCore${DEBUG_SUFFIX}
10     gtest
11 )
12
13 set(TestWebKitAPI_LIBRARIES
14     WTF${DEBUG_SUFFIX}
15 )
16
17 set(TestWebKitAPI_DEPENDENCIES
18     JavaScriptCoreForwardingHeaders
19     JavaScriptCorePrivateForwardingHeaders
20     WTFForwardingHeaders
21 )
22
23 if (ENABLE_WEBCORE)
24     list(APPEND TestWebKitAPI_DEPENDENCIES PALForwardingHeaders)
25 endif ()
26
27 if (ENABLE_WEBKIT)
28     set(test_webkit_api_LIBRARIES
29         JavaScriptCore
30         TestWebKitAPIBase
31         WTF
32         WebKit
33         gtest
34     )
35
36     set(test_webkit_api_SOURCES
37         ${TESTWEBKITAPI_DIR}/Tests/WebKit/AboutBlankLoad.cpp
38         ${TESTWEBKITAPI_DIR}/Tests/WebKit/CanHandleRequest.cpp
39         ${TESTWEBKITAPI_DIR}/Tests/WebKit/CookieManager.cpp
40         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DocumentStartUserScriptAlertCrash.cpp
41         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DOMWindowExtensionBasic.cpp
42         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DOMWindowExtensionNoCache.cpp
43         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DownloadDecideDestinationCrash.cpp
44         ${TESTWEBKITAPI_DIR}/Tests/WebKit/EnumerateMediaDevices.cpp
45         ${TESTWEBKITAPI_DIR}/Tests/WebKit/EvaluateJavaScript.cpp
46         ${TESTWEBKITAPI_DIR}/Tests/WebKit/FailedLoad.cpp
47         ${TESTWEBKITAPI_DIR}/Tests/WebKit/Find.cpp
48         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ForceRepaint.cpp
49         ${TESTWEBKITAPI_DIR}/Tests/WebKit/FrameMIMETypeHTML.cpp
50         ${TESTWEBKITAPI_DIR}/Tests/WebKit/FrameMIMETypePNG.cpp
51         ${TESTWEBKITAPI_DIR}/Tests/WebKit/Geolocation.cpp
52         ${TESTWEBKITAPI_DIR}/Tests/WebKit/GetInjectedBundleInitializationUserDataCallback.cpp
53         ${TESTWEBKITAPI_DIR}/Tests/WebKit/HitTestResultNodeHandle.cpp
54         ${TESTWEBKITAPI_DIR}/Tests/WebKit/InjectedBundleBasic.cpp
55         ${TESTWEBKITAPI_DIR}/Tests/WebKit/InjectedBundleFrameHitTest.cpp
56         ${TESTWEBKITAPI_DIR}/Tests/WebKit/InjectedBundleInitializationUserDataCallbackWins.cpp
57         ${TESTWEBKITAPI_DIR}/Tests/WebKit/LoadAlternateHTMLStringWithNonDirectoryURL.cpp
58         ${TESTWEBKITAPI_DIR}/Tests/WebKit/LoadCanceledNoServerRedirectCallback.cpp
59         ${TESTWEBKITAPI_DIR}/Tests/WebKit/LoadPageOnCrash.cpp
60         ${TESTWEBKITAPI_DIR}/Tests/WebKit/MouseMoveAfterCrash.cpp
61         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayout.cpp
62         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutFails.cpp
63         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutForImages.cpp
64         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutFrames.cpp
65         ${TESTWEBKITAPI_DIR}/Tests/WebKit/PageLoadBasic.cpp
66         ${TESTWEBKITAPI_DIR}/Tests/WebKit/PageLoadDidChangeLocationWithinPageForFrame.cpp
67         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ParentFrame.cpp
68         ${TESTWEBKITAPI_DIR}/Tests/WebKit/PendingAPIRequestURL.cpp
69         ${TESTWEBKITAPI_DIR}/Tests/WebKit/PreventEmptyUserAgent.cpp
70         ${TESTWEBKITAPI_DIR}/Tests/WebKit/PrivateBrowsingPushStateNoHistoryCallback.cpp
71         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ProvisionalURLAfterWillSendRequestCallback.cpp
72         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ReloadPageAfterCrash.cpp
73         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ResizeWindowAfterCrash.cpp
74         ${TESTWEBKITAPI_DIR}/Tests/WebKit/RestoreSessionStateContainingFormData.cpp
75         ${TESTWEBKITAPI_DIR}/Tests/WebKit/TextFieldDidBeginAndEndEditing.cpp
76         ${TESTWEBKITAPI_DIR}/Tests/WebKit/UserMedia.cpp
77         ${TESTWEBKITAPI_DIR}/Tests/WebKit/UserMessage.cpp
78         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WillSendSubmitEvent.cpp
79         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKPageCopySessionStateWithFiltering.cpp
80         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKPageGetScaleFactorNotZero.cpp
81         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKPreferences.cpp
82         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKRetainPtr.cpp
83         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKString.cpp
84         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKStringJSString.cpp
85         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WKURL.cpp
86     )
87
88     list(APPEND TestWebKitAPI_LIBRARIES
89         WebKit
90     )
91 else ()
92     list(APPEND TestWebKitAPI_LIBRARIES
93         WebKitLegacy${DEBUG_SUFFIX}
94     )
95 endif ()
96
97
98 set(TestWTF_SOURCES
99     ${TESTWEBKITAPI_DIR}/Counters.cpp
100     ${TESTWEBKITAPI_DIR}/TestsController.cpp
101     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
102     ${TESTWEBKITAPI_DIR}/Tests/WTF/BloomFilter.cpp
103     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
104     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
105     ${TESTWEBKITAPI_DIR}/Tests/WTF/ConcurrentPtrHashSet.cpp
106     ${TESTWEBKITAPI_DIR}/Tests/WTF/Condition.cpp
107     ${TESTWEBKITAPI_DIR}/Tests/WTF/CrossThreadTask.cpp
108     ${TESTWEBKITAPI_DIR}/Tests/WTF/DateMath.cpp
109     ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp
110     ${TESTWEBKITAPI_DIR}/Tests/WTF/EnumTraits.cpp
111     ${TESTWEBKITAPI_DIR}/Tests/WTF/Expected.cpp
112     ${TESTWEBKITAPI_DIR}/Tests/WTF/Function.cpp
113     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashCountedSet.cpp
114     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
115     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp
116     ${TESTWEBKITAPI_DIR}/Tests/WTF/Hasher.cpp
117     ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
118     ${TESTWEBKITAPI_DIR}/Tests/WTF/JSONValue.cpp
119     ${TESTWEBKITAPI_DIR}/Tests/WTF/LEBDecoder.cpp
120     ${TESTWEBKITAPI_DIR}/Tests/WTF/LifecycleLogger.cpp
121     ${TESTWEBKITAPI_DIR}/Tests/WTF/LineEnding.cpp
122     ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
123     ${TESTWEBKITAPI_DIR}/Tests/WTF/Lock.cpp
124     ${TESTWEBKITAPI_DIR}/Tests/WTF/Logger.cpp
125     ${TESTWEBKITAPI_DIR}/Tests/WTF/MD5.cpp
126     ${TESTWEBKITAPI_DIR}/Tests/WTF/Markable.cpp
127     ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
128     ${TESTWEBKITAPI_DIR}/Tests/WTF/MediaTime.cpp
129     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
130     ${TESTWEBKITAPI_DIR}/Tests/WTF/MoveOnlyLifecycleLogger.cpp
131     ${TESTWEBKITAPI_DIR}/Tests/WTF/NakedPtr.cpp
132     ${TESTWEBKITAPI_DIR}/Tests/WTF/NeverDestroyed.cpp
133     ${TESTWEBKITAPI_DIR}/Tests/WTF/Optional.cpp
134     ${TESTWEBKITAPI_DIR}/Tests/WTF/OptionSet.cpp
135     ${TESTWEBKITAPI_DIR}/Tests/WTF/ParkingLot.cpp
136     ${TESTWEBKITAPI_DIR}/Tests/WTF/Poisoned.cpp
137     ${TESTWEBKITAPI_DIR}/Tests/WTF/PoisonedRef.cpp
138     ${TESTWEBKITAPI_DIR}/Tests/WTF/PoisonedRefPtr.cpp
139     ${TESTWEBKITAPI_DIR}/Tests/WTF/PoisonedUniquePtr.cpp
140     ${TESTWEBKITAPI_DIR}/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp
141     ${TESTWEBKITAPI_DIR}/Tests/WTF/PoisonedUniquePtrForTriviallyDestructibleArrays.cpp
142     ${TESTWEBKITAPI_DIR}/Tests/WTF/PriorityQueue.cpp
143     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
144     ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
145     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefCounter.cpp
146     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefLogger.cpp
147     ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
148     ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
149     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
150     ${TESTWEBKITAPI_DIR}/Tests/WTF/Scope.cpp
151     ${TESTWEBKITAPI_DIR}/Tests/WTF/ScopedLambda.cpp
152     ${TESTWEBKITAPI_DIR}/Tests/WTF/SetForScope.cpp
153     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
154     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringConcatenate.cpp
155     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
156     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
157     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
158     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
159     ${TESTWEBKITAPI_DIR}/Tests/WTF/SynchronizedFixedQueue.cpp
160     ${TESTWEBKITAPI_DIR}/Tests/WTF/TextBreakIterator.cpp
161     ${TESTWEBKITAPI_DIR}/Tests/WTF/ThreadGroup.cpp
162     ${TESTWEBKITAPI_DIR}/Tests/WTF/ThreadMessages.cpp
163     ${TESTWEBKITAPI_DIR}/Tests/WTF/Threading.cpp
164     ${TESTWEBKITAPI_DIR}/Tests/WTF/Time.cpp
165     ${TESTWEBKITAPI_DIR}/Tests/WTF/UniqueArray.cpp
166     ${TESTWEBKITAPI_DIR}/Tests/WTF/UniqueRef.cpp
167     ${TESTWEBKITAPI_DIR}/Tests/WTF/Variant.cpp
168     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
169     ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
170     ${TESTWEBKITAPI_DIR}/Tests/WTF/WeakPtr.cpp
171     ${TESTWEBKITAPI_DIR}/Tests/WTF/WorkQueue.cpp
172     ${TESTWEBKITAPI_DIR}/Tests/WTF/WorkerPool.cpp
173 )
174
175 # FIXME: Tests/WTF/RunLoop.cpp is missing because it doesn't work for Windows.
176 # FIXME: Platform-specific sources in Tests/WTF are not included in TestWTF_SOURCES.
177
178 WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
179
180 include_directories(
181     ${TESTWEBKITAPI_DIR}
182     ${CMAKE_BINARY_DIR}
183     ${CMAKE_SOURCE_DIR}/Source
184     ${JAVASCRIPTCORE_DIR}
185     ${THIRDPARTY_DIR}/gtest/include
186     ${WEBKIT_DIR}/Platform/IPC
187     ${WEBKIT_DIR}/Shared
188     ${WEBKIT_DIR}/Shared/API
189     ${WEBKIT_DIR}/Shared/API/c
190     ${WEBKIT_DIR}/Shared/Plugins
191     ${WEBKIT_DIR}/UIProcess
192     ${WEBKIT_DIR}/UIProcess/API
193     ${WEBKIT_DIR}/UIProcess/API/C
194     ${WEBKIT_DIR}/WebProcess/InjectedBundle
195     ${WEBKIT_DIR}/WebProcess/InjectedBundle/API/c
196 )
197
198 if (ENABLE_WEBKIT)
199     add_library(TestWebKitAPIInjectedBundle SHARED
200         ${bundle_harness_SOURCES}
201         ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
202         ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
203         ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
204         ${TESTWEBKITAPI_DIR}/Tests/WebKit/CanHandleRequest_Bundle.cpp
205         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DidAssociateFormControls_Bundle.cpp
206         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DOMWindowExtensionBasic_Bundle.cpp
207         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DOMWindowExtensionNoCache_Bundle.cpp
208         ${TESTWEBKITAPI_DIR}/Tests/WebKit/DocumentStartUserScriptAlertCrash_Bundle.cpp
209         ${TESTWEBKITAPI_DIR}/Tests/WebKit/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
210         ${TESTWEBKITAPI_DIR}/Tests/WebKit/HitTestResultNodeHandle_Bundle.cpp
211         ${TESTWEBKITAPI_DIR}/Tests/WebKit/InjectedBundleBasic_Bundle.cpp
212         ${TESTWEBKITAPI_DIR}/Tests/WebKit/InjectedBundleFrameHitTest_Bundle.cpp
213         ${TESTWEBKITAPI_DIR}/Tests/WebKit/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
214         ${TESTWEBKITAPI_DIR}/Tests/WebKit/LoadCanceledNoServerRedirectCallback_Bundle.cpp
215         ${TESTWEBKITAPI_DIR}/Tests/WebKit/MouseMoveAfterCrash_Bundle.cpp
216         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
217         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
218         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
219         ${TESTWEBKITAPI_DIR}/Tests/WebKit/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
220         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ParentFrame_Bundle.cpp
221         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ProvisionalURLAfterWillSendRequestCallback_Bundle.cpp
222         ${TESTWEBKITAPI_DIR}/Tests/WebKit/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
223         ${TESTWEBKITAPI_DIR}/Tests/WebKit/TextFieldDidBeginAndEndEditing_Bundle.cpp
224         ${TESTWEBKITAPI_DIR}/Tests/WebKit/UserMessage_Bundle.cpp
225         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WillLoad_Bundle.cpp
226         ${TESTWEBKITAPI_DIR}/Tests/WebKit/WillSendSubmitEvent_Bundle.cpp
227     )
228
229     target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
230     add_dependencies(TestWebKitAPIInjectedBundle WTF ${TestWebKitAPI_DEPENDENCIES})
231
232     if (COMPILER_IS_GCC_OR_CLANG)
233         WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKitAPIInjectedBundle -Wno-dangling-else
234                                                                 -Wno-sign-compare
235                                                                 -Wno-undef
236                                                                 -Wno-unused-parameter)
237     endif ()
238 endif ()
239
240 get_property(gtest_DEFINITIONS GLOBAL PROPERTY gtest_DEFINITIONS)
241
242 add_definitions(
243     ${gtest_DEFINITIONS}
244     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit\"
245 )
246
247 add_executable(TestWTF
248     ${test_main_SOURCES}
249     ${TestWTF_SOURCES}
250 )
251
252 if (WIN32)
253     add_dependencies(TestWTF TestWTFLib)
254 else ()
255     add_dependencies(TestWTF WTF ${TestWebKitAPI_DEPENDENCIES})
256 endif ()
257
258 target_link_libraries(TestWTF ${test_wtf_LIBRARIES})
259 add_test(TestWTF ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}/TestWTF)
260 set_tests_properties(TestWTF PROPERTIES TIMEOUT 60)
261 set_target_properties(TestWTF PROPERTIES
262     RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}
263 )
264
265 if (COMPILER_IS_GCC_OR_CLANG)
266     WEBKIT_ADD_TARGET_CXX_FLAGS(TestWTF -Wno-dangling-else
267                                         -Wno-sign-compare
268                                         -Wno-undef
269                                         -Wno-unused-parameter)
270 endif ()
271
272 if (ENABLE_WEBKIT)
273     add_library(TestWebKitAPIBase
274         ${test_main_SOURCES}
275         ${webkit_api_harness_SOURCES}
276         ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
277         ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
278         ${TESTWEBKITAPI_DIR}/TestsController.cpp
279     )
280
281     target_link_libraries(TestWebKitAPIBase JavaScriptCore WTF WebKit gtest)
282
283     add_dependencies(TestWebKitAPIBase WebKit ${TestWebKitAPI_DEPENDENCIES})
284
285     if (COMPILER_IS_GCC_OR_CLANG)
286         WEBKIT_ADD_TARGET_CXX_FLAGS(TestWebKitAPIBase -Wno-sign-compare
287                                                       -Wno-undef
288                                                       -Wno-unused-parameter)
289     endif ()
290 endif ()