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