Unreviewed, rolling out r196791.
[WebKit-https.git] / Tools / TestWebKitAPI / CMakeLists.txt
index 5afadba..4ca072c 100644 (file)
-SET(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
-
-INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}
-    ${TESTWEBKITAPI_DIR}
-    ${CMAKE_SOURCE_DIR}/Source
-    ${DERIVED_SOURCES_WEBKIT2_DIR}/include
-    ${JAVASCRIPTCORE_DIR}
-    ${JAVASCRIPTCORE_DIR}/API
-    ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
-    ${THIRDPARTY_DIR}/gtest/include
-    ${WEBCORE_DIR}/editing
-    ${WEBCORE_DIR}/platform
-    ${WEBCORE_DIR}/platform/graphics
-    ${WEBCORE_DIR}/platform/text
-    ${WEBCORE_DIR}/platform/network
-    ${WEBKIT2_DIR}/Shared
-    ${WEBKIT2_DIR}/Shared/API/c
-    ${WEBKIT2_DIR}/UIProcess
-    ${WTF_DIR}
+set(TESTWEBKITAPI_DIR "${TOOLS_DIR}/TestWebKitAPI")
+set(test_wtf_LIBRARIES
+    WTF${DEBUG_SUFFIX}
+    gtest
 )
 
-WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
-
-ADD_LIBRARY(TestWebKitAPIInjectedBundle SHARED
-    ${bundle_harness_SOURCES}
-    ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
-    ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
-    ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WKConnection_Bundle.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
+set(test_webcore_LIBRARIES
+    WTF${DEBUG_SUFFIX}
+    WebCore${DEBUG_SUFFIX}
+    gtest
 )
 
-TARGET_LINK_LIBRARIES(TestWebKitAPIInjectedBundle ${WTF_LIBRARY_NAME})
-ADD_DEPENDENCIES(TestWebKitAPIInjectedBundle ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
-
-GET_PROPERTY(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
-
-ADD_DEFINITIONS(-DGTEST_LINKED_AS_SHARED_LIBRARY=1
-    -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
-    -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
+set(TestWebKitAPI_LIBRARIES
+    WTF${DEBUG_SUFFIX}
 )
 
-SET(test_wtf_LIBRARIES
-    ${WTF_LIBRARY_NAME}
+if (ENABLE_WEBKIT2)
+    set(test_webkit2_api_LIBRARIES
+        JavaScriptCore
+        TestWebKitAPIBase
+        WTF
+        WebKit2
+        gtest
+    )
+    list(APPEND TestWebKitAPI_LIBRARIES
+        WebKit2
+    )
+else ()
+    list(APPEND TestWebKitAPI_LIBRARIES
+        WebKit${DEBUG_SUFFIX}
+    )
+endif ()
+
+
+set(TestJavaScriptCore_LIBRARIES
+    JavaScriptCore
     gtest
 )
 
-ADD_EXECUTABLE(test_wtf
-    ${test_main_SOURCES}
+set(TestWTF_SOURCES
+    ${TESTWEBKITAPI_DIR}/Counters.cpp
     ${TESTWEBKITAPI_DIR}/TestsController.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/AtomicString.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/CString.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/Condition.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/CheckedArithmeticOperations.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/DateMath.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/Deque.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Functional.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/HashSet.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/ListHashSet.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/Lock.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/MD5.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/MediaTime.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/NakedPtr.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/ParkingLot.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/Ref.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/RefPtr.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/SHA1.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/SaturatedArithmeticOperations.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringBuilder.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/StringHasher.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringImpl.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/StringOperators.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/StringView.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/TemporaryChange.cpp
     ${TESTWEBKITAPI_DIR}/Tests/WTF/Vector.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WTF/VectorBasic.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WTF/VectorReverse.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/WTFString.cpp
+    ${TESTWEBKITAPI_DIR}/Tests/WTF/WorkQueue.cpp
 )
 
-TARGET_LINK_LIBRARIES(test_wtf ${test_wtf_LIBRARIES})
-ADD_DEPENDENCIES(test_wtf ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
-ADD_TEST(test_wtf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_wtf)
-SET_TESTS_PROPERTIES(test_wtf PROPERTIES TIMEOUT 60)
+WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS()
 
-SET(test_webcore_LIBRARIES
-    ${WTF_LIBRARY_NAME}
-    ${WebCore_LIBRARY_NAME}
-    gtest
+include_directories(
+    ${TESTWEBKITAPI_DIR}
+    ${CMAKE_BINARY_DIR}
+    ${CMAKE_SOURCE_DIR}/Source
+    ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
+    ${DERIVED_SOURCES_WEBCORE_DIR}
+    ${JAVASCRIPTCORE_DIR}
+    ${JAVASCRIPTCORE_DIR}/API
+    ${JAVASCRIPTCORE_DIR}/ForwardingHeaders
+    ${THIRDPARTY_DIR}/gtest/include
+    ${WEBCORE_DIR}/css
+    ${WEBCORE_DIR}/dom
+    ${WEBCORE_DIR}/editing
+    ${WEBCORE_DIR}/loader/cache
+    ${WEBCORE_DIR}/platform
+    ${WEBCORE_DIR}/platform/animation
+    ${WEBCORE_DIR}/platform/graphics
+    ${WEBCORE_DIR}/platform/text
+    ${WEBCORE_DIR}/platform/network
+    ${WEBCORE_DIR}/platform/network/soup
+    ${WEBCORE_DIR}/rendering/style
+    ${WEBKIT2_DIR}/Platform/IPC
+    ${WEBKIT2_DIR}/Shared
+    ${WEBKIT2_DIR}/Shared/API
+    ${WEBKIT2_DIR}/Shared/API/c
+    ${WEBKIT2_DIR}/Shared/Plugins
+    ${WEBKIT2_DIR}/UIProcess
+    ${WEBKIT2_DIR}/UIProcess/API
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle
+    ${WEBKIT2_DIR}/WebProcess/InjectedBundle/API/c
+    ${WTF_DIR}
 )
 
-ADD_EXECUTABLE(test_webcore
-    ${test_main_SOURCES}
-    ${TESTWEBKITAPI_DIR}/TestsController.cpp
-    ${TESTWEBKITAPI_DIR}/Tests/WebCore/KURL.cpp
+if (ENABLE_WEBKIT2)
+    add_library(TestWebKitAPIInjectedBundle SHARED
+        ${bundle_harness_SOURCES}
+        ${TESTWEBKITAPI_DIR}/InjectedBundleController.cpp
+        ${TESTWEBKITAPI_DIR}/InjectedBundleMain.cpp
+        ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/CanHandleRequest_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DidAssociateFormControls_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ParentFrame_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/TextFieldDidBeginAndEndEditing_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/UserMessage_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillLoad_Bundle.cpp
+        ${TESTWEBKITAPI_DIR}/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp
+    )
+
+    target_link_libraries(TestWebKitAPIInjectedBundle ${TestWebKitAPI_LIBRARIES})
+    add_dependencies(TestWebKitAPIInjectedBundle WTF ${ForwardingHeadersForTestWebKitAPI_NAME})
+
+    get_property(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
+endif ()
+
+if (WIN32)
+    add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=0)
+else ()
+    add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
+endif ()
+
+add_definitions(-DGTEST_HAS_RTTI=0
+    -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
+    -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
 )
 
-TARGET_LINK_LIBRARIES(test_webcore ${test_webcore_LIBRARIES})
-ADD_DEPENDENCIES(test_webcore ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
-ADD_TEST(test_webcore ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webcore)
-SET_TESTS_PROPERTIES(test_webcore PROPERTIES TIMEOUT 60)
+# FIXME: This works around compatibility problems in the old version of the third-pary
+# googletest source code checkout. It should be removed once we upgrade to a newer version.
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+    add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
+endif ()
 
-ADD_LIBRARY(TestWebKitAPIBase
+add_executable(TestWTF
     ${test_main_SOURCES}
-    ${webkit2_api_harness_SOURCES}
-    ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
-    ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
-    ${TESTWEBKITAPI_DIR}/TestsController.cpp
+    ${TestWTF_SOURCES}
 )
 
-ADD_DEPENDENCIES(TestWebKitAPIBase ${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
+if (WIN32)
+    add_dependencies(TestWTF TestWTFLib)
+endif ()
 
-SET(test_webkit2_api_LIBRARIES
-    TestWebKitAPIBase
-    ${WTF_LIBRARY_NAME}
-    ${JavaScriptCore_LIBRARY_NAME}
-    ${WebKit2_LIBRARY_NAME}
-    gtest
+target_link_libraries(TestWTF ${test_wtf_LIBRARIES})
+add_dependencies(TestWTF WTF ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
+add_test(TestWTF ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}/TestWTF)
+set_tests_properties(TestWTF PROPERTIES TIMEOUT 60)
+set_target_properties(TestWTF PROPERTIES
+    RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY_WTF}
 )
 
-FOREACH(testName ${test_webkit2_api_BINARIES})
-    ADD_EXECUTABLE(test_webkit2_api_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
-    ADD_TEST(test_webkit2_api_${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_webkit2_api_${testName})
-    SET_TESTS_PROPERTIES(test_webkit2_api_${testName} PROPERTIES TIMEOUT 60)
-    TARGET_LINK_LIBRARIES(test_webkit2_api_${testName} ${test_webkit2_api_LIBRARIES})
-ENDFOREACH()
-
-# We don't run tests that are expected to fail. We could use the WILL_FAIL
-# property, but it reports failure when the test crashes or timeouts and would
-# make the bot red.
-
-FOREACH(testName ${test_webkit2_api_fail_BINARIES})
-    ADD_EXECUTABLE(test_webkit2_api_fail_${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
-    TARGET_LINK_LIBRARIES(test_webkit2_api_fail_${testName} ${test_webkit2_api_LIBRARIES})
-ENDFOREACH()
+# FIXME: EFL is the only port that separates the WebCore binaries. Each port ought to do closer to the same thing.
+foreach (testName ${test_webcore_BINARIES})
+    add_executable(${testName} ${test_main_SOURCES} ${TESTWEBKITAPI_DIR}/TestsController.cpp ${TESTWEBKITAPI_DIR}/Tests/WebCore/${testName}.cpp)
+    add_test(${testName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore/${testName})
+    set_tests_properties(${testName} PROPERTIES TIMEOUT 60)
+    target_link_libraries(${testName} ${test_webcore_LIBRARIES})
+    set_target_properties(${testName} PROPERTIES
+        RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore
+    )
+endforeach ()
+
+if (ENABLE_WEBKIT2)
+    add_library(TestWebKitAPIBase
+        ${test_main_SOURCES}
+        ${webkit2_api_harness_SOURCES}
+        ${TESTWEBKITAPI_DIR}/JavaScriptTest.cpp
+        ${TESTWEBKITAPI_DIR}/PlatformUtilities.cpp
+        ${TESTWEBKITAPI_DIR}/TestsController.cpp
+    )
+
+    add_dependencies(TestWebKitAPIBase WebKit2 ${ForwardingHeadersForTestWebKitAPI_NAME} ${ForwardingNetworkHeadersForTestWebKitAPI_NAME})
+
+    foreach (testName ${test_webkit2_api_BINARIES})
+        get_filename_component(testBaseName ${testName} NAME)
+        add_executable(${testBaseName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
+        add_test(${testBaseName} ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/${testBaseName})
+        set_tests_properties(${testBaseName} PROPERTIES TIMEOUT 60)
+        target_link_libraries(${testBaseName} ${test_webkit2_api_LIBRARIES})
+        set_target_properties(${testBaseName} PROPERTIES
+            RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2
+        )
+    endforeach ()
+
+    # We don't run tests that are expected to fail. We could use the WILL_FAIL
+    # property, but it reports failure when the test crashes or timeouts and would
+    # make the bot red.
+    foreach (testName ${test_webkit2_api_fail_BINARIES})
+        add_executable(${testName} ${TESTWEBKITAPI_DIR}/Tests/WebKit2/${testName}.cpp)
+        target_link_libraries(${testName} ${test_webkit2_api_LIBRARIES})
+        set_target_properties(${testName} PROPERTIES
+            RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebKit2/failure
+        )
+    endforeach ()
+endif ()