[GTK] [CMake] Build the WebKit2 GObject API tests
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Dec 2013 21:49:43 +0000 (21:49 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Dec 2013 21:49:43 +0000 (21:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=125683

Reviewed by Daniel Bates.

.:

* Source/PlatformGTK.cmake: Load the WebKit2 tests file if necessary.
* Source/cmake/FindATSPI.cmake: Added.
* Source/cmake/OptionsGTK.cmake: Look for AT-SPI, but don't fail if it isn't found.

Source/WebKit2:

* UIProcess/API/gtk/tests/CMakeLists.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/PlatformGTK.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/gtk/tests/CMakeLists.txt [new file with mode: 0644]
Source/cmake/FindATSPI.cmake [new file with mode: 0644]
Source/cmake/OptionsGTK.cmake

index 11660af..8385875 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2013-12-23  Martin Robinson  <mrobinson@igalia.com>
 
 2013-12-23  Martin Robinson  <mrobinson@igalia.com>
 
+        [GTK] [CMake] Build the WebKit2 GObject API tests
+        https://bugs.webkit.org/show_bug.cgi?id=125683
+
+        Reviewed by Daniel Bates.
+
+        * Source/PlatformGTK.cmake: Load the WebKit2 tests file if necessary.
+        * Source/cmake/FindATSPI.cmake: Added.
+        * Source/cmake/OptionsGTK.cmake: Look for AT-SPI, but don't fail if it isn't found.
+
+2013-12-23  Martin Robinson  <mrobinson@igalia.com>
+
         [GTK] [CMake] Build the WebKit1 GObject API tests
         https://bugs.webkit.org/show_bug.cgi?id=125684
 
         [GTK] [CMake] Build the WebKit1 GObject API tests
         https://bugs.webkit.org/show_bug.cgi?id=125684
 
index bd39d1f..390daff 100644 (file)
@@ -1,3 +1,7 @@
 if (ENABLE_WEBKIT)
     add_subdirectory(${WEBKIT_DIR}/gtk/tests)
 endif ()
 if (ENABLE_WEBKIT)
     add_subdirectory(${WEBKIT_DIR}/gtk/tests)
 endif ()
+
+if (ENABLE_WEBKIT2)
+    add_subdirectory(${WEBKIT2_DIR}/UIProcess/API/gtk/tests)
+endif ()
index 0d670e5..b980b01 100644 (file)
@@ -1,3 +1,12 @@
+2013-12-23  Martin Robinson  <mrobinson@igalia.com>
+
+        [GTK] [CMake] Build the WebKit2 GObject API tests
+        https://bugs.webkit.org/show_bug.cgi?id=125683
+
+        Reviewed by Daniel Bates.
+
+        * UIProcess/API/gtk/tests/CMakeLists.txt: Added.
+
 2013-12-23  Tim Horton  <timothy_horton@apple.com>
 
         REGRESSION (r160672): Random remote layers are getting shadows
 2013-12-23  Tim Horton  <timothy_horton@apple.com>
 
         REGRESSION (r160672): Random remote layers are getting shadows
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/CMakeLists.txt b/Source/WebKit2/UIProcess/API/gtk/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7f8b26c
--- /dev/null
@@ -0,0 +1,104 @@
+set(WEBKIT2_FORWARDING_HEADERS_DIR ${DERIVED_SOURCES_DIR}/ForwardingHeaders/webkit2gtk)
+set(TEST_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/WebKit2GObjectAPITests)
+set(TEST_LIBRARY_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/WebKit2GObjectAPITests)
+set(TEST_RESOURCES_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources)
+file(MAKE_DIRECTORY ${TEST_RESOURCES_DIR})
+
+add_definitions(
+    -DWEBKIT_TEST_PLUGIN_DIR="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
+    -DWEBKIT_EXEC_PATH="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
+    -DWEBKIT_SRC_DIR="${CMAKE_SRC_DIR}"
+    -DWEBKIT_TEST_WEB_EXTENSIONS_DIR="${TEST_LIBRARY_DIR}"
+    -DWEBKIT_INJECTED_BUNDLE_PATH="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
+)
+
+include_directories(
+    ${CMAKE_BINARY_DIR}
+    ${CMAKE_SOURCE_DIR}/Source
+    ${CMAKE_SOURCE_DIR}/Source/WTF
+    ${DERIVED_SOURCES_DIR}
+    ${DERIVED_SOURCES_DIR}/ForwardingHeaders
+    ${DERIVED_SOURCES_DIR}/webkit2gtk
+    ${DERIVED_SOURCES_DIR}/WebKit2/include
+    ${WEBKIT2_FORWARDING_HEADERS_DIR}
+    ${WEBKIT2_FORWARDING_HEADERS_DIR}/webkit2extension
+    ${ATSPI_INCLUDE_DIRS}
+    ${GLIB_INCLUDE_DIRS}
+    ${GTK3_INCLUDE_DIRS}
+    ${LIBSOUP_INCLUDE_DIRS}
+)
+
+add_library(WebKit2APITestCore STATIC
+    LoadTrackingTest.cpp
+    WebKitTestBus.cpp
+    WebKitTestServer.cpp
+    WebProcessTestRunner.cpp
+    TestMain.cpp
+    WebViewTest.cpp
+)
+
+add_custom_target(test-gresource-bundle
+    DEPENDS resources/webkit2gtk-tests.gresource.xml
+            resources/link-title.js
+    COMMAND glib-compile-resources --target=${TEST_RESOURCES_DIR}/webkit2gtk-tests-resources.gresource --sourcedir=${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/Source/WebKit2/UIProcess/API/gtk/tests/resources/webkit2gtk-tests.gresource.xml
+)
+
+macro(ADD_WK2_TEST_WEB_EXTENSION extension_name)
+    add_library(${extension_name} MODULE ${ARGN})
+    set_property(
+        TARGET ${extension_name}
+        APPEND
+        PROPERTY COMPILE_DEFINITIONS WEBKIT2_COMPILATION
+    )
+    set_target_properties(${extension_name} PROPERTIES
+        LIBRARY_OUTPUT_DIRECTORY ${TEST_LIBRARY_DIR}
+    )
+endmacro()
+
+macro(ADD_WK2_TEST test_name)
+    add_executable(${test_name} ${ARGN})
+    add_dependencies(${test_name}
+        test-gresource-bundle
+        WebExtensionTest
+    )
+    target_link_libraries(${test_name}
+        JavaScriptCore
+        WebKit2
+        WebKit2APITestCore
+        ${ATSPI_LIBRARIES}
+        ${GLIB_LIBRARIES}
+        ${GTK3_LIBRARIES}
+        ${LIBSOUP_LIBRARIES}
+    )
+    set_target_properties(${test_name} PROPERTIES
+        RUNTIME_OUTPUT_DIRECTORY ${TEST_BINARY_DIR}
+    )
+endmacro()
+
+ADD_WK2_TEST_WEB_EXTENSION(WebExtensionTest WebExtensionTest.cpp)
+ADD_WK2_TEST_WEB_EXTENSION(WebProcessTest DOMNodeTest.cpp FrameTest.cpp WebProcessTest.cpp)
+
+ADD_WK2_TEST(InspectorTestServer InspectorTestServer.cpp)
+ADD_WK2_TEST(TestBackForwardList TestBackForwardList.cpp)
+ADD_WK2_TEST(TestContextMenu TestContextMenu.cpp)
+ADD_WK2_TEST(TestCookieManager TestCookieManager.cpp)
+ADD_WK2_TEST(TestDOMNode TestDOMNode.cpp)
+ADD_WK2_TEST(TestDownloads TestDownloads.cpp)
+ADD_WK2_TEST(TestFrame TestFrame.cpp)
+ADD_WK2_TEST(TestInspector TestInspector.cpp)
+ADD_WK2_TEST(TestInspectorServer TestInspectorServer.cpp)
+ADD_WK2_TEST(TestLoaderClient TestLoaderClient.cpp)
+ADD_WK2_TEST(TestPrinting TestPrinting.cpp)
+ADD_WK2_TEST(TestSSL TestSSL.cpp)
+ADD_WK2_TEST(TestWebExtensions TestWebExtensions.cpp)
+ADD_WK2_TEST(TestWebKitPolicyClient TestWebKitPolicyClient.cpp)
+ADD_WK2_TEST(TestWebKitSettings TestWebKitSettings.cpp)
+ADD_WK2_TEST(TestWebKitVersion TestWebKitVersion.cpp)
+ADD_WK2_TEST(TestWebKitWebViewGroup TestWebKitWebViewGroup.cpp)
+ADD_WK2_TEST(TestWebKitWebContext TestWebKitWebContext.cpp)
+ADD_WK2_TEST(TestWebKitWebView TestWebKitWebView.cpp)
+
+if (ATSPI_FOUND)
+    ADD_WK2_TEST(AccessibilityTestServer AccessibilityTestServer.cpp)
+    ADD_WK2_TEST(TestWebKitAccessibility TestWebKitAccessibility.cpp)
+endif ()
diff --git a/Source/cmake/FindATSPI.cmake b/Source/cmake/FindATSPI.cmake
new file mode 100644 (file)
index 0000000..5d0e6c4
--- /dev/null
@@ -0,0 +1,51 @@
+# Copyright (c) 2013 Igalia S.L.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice, this
+#   list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+#   this list of conditions and the following disclaimer in the documentation
+#   and/or other materials provided with the distribution.
+# * Neither the name of Intel Corporation nor the names of its contributors may
+#   be used to endorse or promote products derived from this software without
+#   specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# Try to find AT-SPI include and library directories.
+#
+# After successful discovery, this will set for inclusion where needed:
+# ATSPI_INCLUDE_DIRS - containg the AT-SPI headers
+# ATSPI_LIBRARIES - containg the AT-SPI library
+
+include(FindPkgConfig)
+
+pkg_check_modules(ATSPI atspi-2)
+
+set(VERSION_OK TRUE)
+if (ATSPI_VERSION)
+    if (ATSPI_FIND_VERSION_EXACT)
+        if (NOT("${ATSPI_FIND_VERSION}" VERSION_EQUAL "${ATSPI_VERSION}"))
+            set(VERSION_OK FALSE)
+        endif ()
+    else ()
+        if ("${ATSPI_VERSION}" VERSION_LESS "${ATSPI_FIND_VERSION}")
+            set(VERSION_OK FALSE)
+        endif ()
+    endif ()
+endif ()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ATSPI DEFAULT_MSG ATSPI_INCLUDE_DIRS ATSPI_LIBRARIES VERSION_OK)
index 2dbf9ab..1085b8a 100644 (file)
@@ -149,6 +149,7 @@ find_package(Xt REQUIRED)
 find_package(ATK REQUIRED)
 find_package(WebP REQUIRED)
 find_package(GStreamer 1.0.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
 find_package(ATK REQUIRED)
 find_package(WebP REQUIRED)
 find_package(GStreamer 1.0.3 REQUIRED COMPONENTS ${GSTREAMER_COMPONENTS})
+find_package(ATSPI 2.5.3)
 
 # We don't use find_package for GLX because it is part of -lGL, unlike EGL.
 find_package(OpenGL)
 
 # We don't use find_package for GLX because it is part of -lGL, unlike EGL.
 find_package(OpenGL)