Skip to content

Commit

Permalink
[WPE] Add a MiniBrowser and use it to run WebDriver tests
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=186345

Reviewed by Žan Doberšek.

.:

Add an option to enable building the MiniBrowser.

* Source/cmake/FindWaylandProtocols.cmake: Added.
* Source/cmake/OptionsWPE.cmake:

Source/WebDriver:

Use MiniBrowser instead of dyz as the default WebDriver browser for WPE.

* wpe/WebDriverServiceWPE.cpp:
(WebDriver::WebDriverService::platformParseCapabilities const):

Tools:

Most of the code is based on dyz and gtk MiniBrowser. This patch adds a new internal library WPEToolingBackends,
including the headless view backend and a new window backend to be used by the MiniBrowser. MiniBrowser can also
run in headless mode, by using the headless backend instead of the window one, which will allow us to run the
WebDriver tests in the bots.

* CMakeLists.txt:
* MiniBrowser/wpe/CMakeLists.txt: Added.
* MiniBrowser/wpe/main.cpp: Added.
(automationStartedCallback):
(createViewBackend):
(main):
* Scripts/run-minibrowser: Remove WPE specific code.
* Scripts/run-webdriver-tests: Add headless display-server option.
* Scripts/webkitdirs.pm:
(launcherName): Remove WPE specific code.
* Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py:
(WebDriverWPE.browser_name): Return MiniBrowser.
(WebDriverWPE.browser_path): Return the path to the MiniBrowser in build dir.
(WebDriverWPE.browser_args): Add --headless when running in headless mode.
(WebDriverWPE.capabilities): Use the full browser path.
* Scripts/webkitpy/webdriver_tests/webdriver_test_runner_selenium.py:
(WebDriverTestRunnerSelenium.collect_tests): Fix early return value.
* TestWebKitAPI/PlatformWPE.cmake: Use WPEToolingBackends instead of HeadlessViewBackend.
* TestWebKitAPI/PlatformWebView.h: Ditto.
* TestWebKitAPI/glib/PlatformWPE.cmake: Ditto
* TestWebKitAPI/glib/WebKitGLib/TestMain.h:
(Test::createWebViewBackend): Ditto.
* TestWebKitAPI/wpe/PlatformWebViewWPE.cpp:
(TestWebKitAPI::PlatformWebView::initialize): Ditto.
* WebKitTestRunner/PlatformWPE.cmake: Ditto.
* WebKitTestRunner/PlatformWebView.h: Ditto.
* WebKitTestRunner/wpe/PlatformWebViewWPE.cpp:
(WTR::PlatformWebView::PlatformWebView): Ditto.
* wpe/HeadlessViewBackend/CMakeLists.txt: Removed.
* wpe/backends/CMakeLists.txt: Added.
* wpe/backends/HeadlessViewBackend.cpp: Renamed from Tools/wpe/HeadlessViewBackend/HeadlessViewBackend.cpp.
(WPEToolingBackends::getEGLDisplay):
(WPEToolingBackends::HeadlessViewBackend::HeadlessViewBackend):
(WPEToolingBackends::HeadlessViewBackend::~HeadlessViewBackend):
(WPEToolingBackends::HeadlessViewBackend::createSnapshot):
(WPEToolingBackends::HeadlessViewBackend::performUpdate):
(WPEToolingBackends::HeadlessViewBackend::displayBuffer):
* wpe/backends/HeadlessViewBackend.h: Renamed from Tools/wpe/HeadlessViewBackend/HeadlessViewBackend.h.
* wpe/backends/ViewBackend.cpp: Added.
(WPEToolingBackends::ViewBackend::ViewBackend):
(WPEToolingBackends::ViewBackend::~ViewBackend):
(WPEToolingBackends::ViewBackend::initialize):
(WPEToolingBackends::ViewBackend::setInputClient):
(WPEToolingBackends::ViewBackend::backend const):
(WPEToolingBackends::ViewBackend::dispatchInputPointerEvent):
(WPEToolingBackends::ViewBackend::dispatchInputAxisEvent):
(WPEToolingBackends::ViewBackend::dispatchInputKeyboardEvent):
* wpe/backends/ViewBackend.h: Added.
* wpe/backends/WindowViewBackend.cpp: Added.
(WPEToolingBackends::WindowViewBackend::WindowViewBackend):
(WPEToolingBackends::WindowViewBackend::~WindowViewBackend):
(WPEToolingBackends::WindowViewBackend::displayBuffer):
(WPEToolingBackends::WindowViewBackend::handleKeyEvent):
* wpe/backends/WindowViewBackend.h: Added.
* wpe/jhbuild.modules: Remove dyz and add wayland-protocols.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@232670 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
[email protected] committed Jun 11, 2018
1 parent c35db67 commit 2c873db
Show file tree
Hide file tree
Showing 31 changed files with 1,479 additions and 196 deletions.
12 changes: 12 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2018-06-10 Carlos Garcia Campos <[email protected]>

[WPE] Add a MiniBrowser and use it to run WebDriver tests
https://bugs.webkit.org/show_bug.cgi?id=186345

Reviewed by Žan Doberšek.

Add an option to enable building the MiniBrowser.

* Source/cmake/FindWaylandProtocols.cmake: Added.
* Source/cmake/OptionsWPE.cmake:

2018-06-06 Dan Bernstein <[email protected]>

[Xcode] Opt out of the New Build System
Expand Down
12 changes: 12 additions & 0 deletions Source/WebDriver/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
2018-06-10 Carlos Garcia Campos <[email protected]>

[WPE] Add a MiniBrowser and use it to run WebDriver tests
https://bugs.webkit.org/show_bug.cgi?id=186345

Reviewed by Žan Doberšek.

Use MiniBrowser instead of dyz as the default WebDriver browser for WPE.

* wpe/WebDriverServiceWPE.cpp:
(WebDriver::WebDriverService::platformParseCapabilities const):

2018-06-04 Carlos Garcia Campos <[email protected]>

[WPE] WebDriver: stop making mandatory to provide a browser path if wpe:browserOptions is present in capabilities
Expand Down
2 changes: 1 addition & 1 deletion Source/WebDriver/wpe/WebDriverServiceWPE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool WebDriverService::platformMatchCapability(const String&, const RefPtr<JSON:

void WebDriverService::platformParseCapabilities(const JSON::Object& matchedCapabilities, Capabilities& capabilities) const
{
capabilities.browserBinary = String("dyz");
capabilities.browserBinary = String("MiniBrowser");
capabilities.browserArguments = Vector<String> { ASCIILiteral("--automation") };

RefPtr<JSON::Object> browserOptions;
Expand Down
38 changes: 38 additions & 0 deletions Source/cmake/FindWaylandProtocols.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# - Try to find WaylandProtocols
# Once done, this will define
#
# WAYLAND_PROTOCOLS_FOUND - system has WaylandProtocols.
# WAYLAND_PROTOCOLS_DATADIR - the WaylandProtocols data directory
# WAYLAND_SCANNER - the path to the wayland-scanner command.
#
# Copyright (C) 2018 Igalia S.L.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. 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.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS 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 HOLDER OR ITS
# 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.

find_package(PkgConfig)
pkg_check_modules(WAYLAND_PROTOCOLS wayland-protocols)

if (WAYLAND_PROTOCOLS_FOUND)
pkg_get_variable(WAYLAND_PROTOCOLS_DATADIR wayland-protocols pkgdatadir)
find_program(WAYLAND_SCANNER NAMES wayland-scanner)
mark_as_advanced(WAYLAND_PROTOCOLS_DATADIR WAYLAND_SCANNER)
endif ()
1 change: 1 addition & 0 deletions Source/cmake/OptionsWPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ endif ()
SET_AND_EXPOSE_TO_BUILD(ENABLE_DEVELOPER_MODE ${DEVELOPER_MODE})
if (DEVELOPER_MODE)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_API_TESTS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_MINIBROWSER PUBLIC ON)
endif ()

include(GStreamerDependencies)
Expand Down
9 changes: 8 additions & 1 deletion Tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,21 @@ elseif ("${PORT}" STREQUAL "Mac")
add_subdirectory(MiniBrowser/mac)
elseif ("${PORT}" STREQUAL "JSCOnly")
elseif ("${PORT}" STREQUAL "WPE")
if (DEVELOPER_MODE OR ENABLE_MINIBROWSER)
add_subdirectory(wpe/backends)
endif ()

if (DEVELOPER_MODE)
add_subdirectory(ImageDiff)
add_subdirectory(WebKitTestRunner)
add_subdirectory(wpe/HeadlessViewBackend)
if (ENABLE_API_TESTS)
add_subdirectory(TestWebKitAPI/glib)
endif ()
endif ()

if (ENABLE_MINIBROWSER)
add_subdirectory(MiniBrowser/wpe)
endif ()
elseif ("${PORT}" STREQUAL "Win")
add_subdirectory(DumpRenderTree)
add_subdirectory(ImageDiff)
Expand Down
68 changes: 68 additions & 0 deletions Tools/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,71 @@
2018-06-10 Carlos Garcia Campos <[email protected]>

[WPE] Add a MiniBrowser and use it to run WebDriver tests
https://bugs.webkit.org/show_bug.cgi?id=186345

Reviewed by Žan Doberšek.

Most of the code is based on dyz and gtk MiniBrowser. This patch adds a new internal library WPEToolingBackends,
including the headless view backend and a new window backend to be used by the MiniBrowser. MiniBrowser can also
run in headless mode, by using the headless backend instead of the window one, which will allow us to run the
WebDriver tests in the bots.

* CMakeLists.txt:
* MiniBrowser/wpe/CMakeLists.txt: Added.
* MiniBrowser/wpe/main.cpp: Added.
(automationStartedCallback):
(createViewBackend):
(main):
* Scripts/run-minibrowser: Remove WPE specific code.
* Scripts/run-webdriver-tests: Add headless display-server option.
* Scripts/webkitdirs.pm:
(launcherName): Remove WPE specific code.
* Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py:
(WebDriverWPE.browser_name): Return MiniBrowser.
(WebDriverWPE.browser_path): Return the path to the MiniBrowser in build dir.
(WebDriverWPE.browser_args): Add --headless when running in headless mode.
(WebDriverWPE.capabilities): Use the full browser path.
* Scripts/webkitpy/webdriver_tests/webdriver_test_runner_selenium.py:
(WebDriverTestRunnerSelenium.collect_tests): Fix early return value.
* TestWebKitAPI/PlatformWPE.cmake: Use WPEToolingBackends instead of HeadlessViewBackend.
* TestWebKitAPI/PlatformWebView.h: Ditto.
* TestWebKitAPI/glib/PlatformWPE.cmake: Ditto
* TestWebKitAPI/glib/WebKitGLib/TestMain.h:
(Test::createWebViewBackend): Ditto.
* TestWebKitAPI/wpe/PlatformWebViewWPE.cpp:
(TestWebKitAPI::PlatformWebView::initialize): Ditto.
* WebKitTestRunner/PlatformWPE.cmake: Ditto.
* WebKitTestRunner/PlatformWebView.h: Ditto.
* WebKitTestRunner/wpe/PlatformWebViewWPE.cpp:
(WTR::PlatformWebView::PlatformWebView): Ditto.
* wpe/HeadlessViewBackend/CMakeLists.txt: Removed.
* wpe/backends/CMakeLists.txt: Added.
* wpe/backends/HeadlessViewBackend.cpp: Renamed from Tools/wpe/HeadlessViewBackend/HeadlessViewBackend.cpp.
(WPEToolingBackends::getEGLDisplay):
(WPEToolingBackends::HeadlessViewBackend::HeadlessViewBackend):
(WPEToolingBackends::HeadlessViewBackend::~HeadlessViewBackend):
(WPEToolingBackends::HeadlessViewBackend::createSnapshot):
(WPEToolingBackends::HeadlessViewBackend::performUpdate):
(WPEToolingBackends::HeadlessViewBackend::displayBuffer):
* wpe/backends/HeadlessViewBackend.h: Renamed from Tools/wpe/HeadlessViewBackend/HeadlessViewBackend.h.
* wpe/backends/ViewBackend.cpp: Added.
(WPEToolingBackends::ViewBackend::ViewBackend):
(WPEToolingBackends::ViewBackend::~ViewBackend):
(WPEToolingBackends::ViewBackend::initialize):
(WPEToolingBackends::ViewBackend::setInputClient):
(WPEToolingBackends::ViewBackend::backend const):
(WPEToolingBackends::ViewBackend::dispatchInputPointerEvent):
(WPEToolingBackends::ViewBackend::dispatchInputAxisEvent):
(WPEToolingBackends::ViewBackend::dispatchInputKeyboardEvent):
* wpe/backends/ViewBackend.h: Added.
* wpe/backends/WindowViewBackend.cpp: Added.
(WPEToolingBackends::WindowViewBackend::WindowViewBackend):
(WPEToolingBackends::WindowViewBackend::~WindowViewBackend):
(WPEToolingBackends::WindowViewBackend::displayBuffer):
(WPEToolingBackends::WindowViewBackend::handleKeyEvent):
* wpe/backends/WindowViewBackend.h: Added.
* wpe/jhbuild.modules: Remove dyz and add wayland-protocols.

2018-06-10 Fujii Hironori <[email protected]>

[Win][MiniBrowser] MiniBrowser class should be renamed to WebKitLegacyBrowserWindow
Expand Down
36 changes: 36 additions & 0 deletions Tools/MiniBrowser/wpe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
set(MINIBROWSER_DIR "${TOOLS_DIR}/MiniBrowser/wpe")

set(MiniBrowser_SOURCES
${MINIBROWSER_DIR}/main.cpp
)

set(MiniBrowser_INCLUDE_DIRECTORIES
${TOOLS_DIR}/wpe/backends/
${DERIVED_SOURCES_WPE_API_DIR}
${FORWARDING_HEADERS_WPE_DIR}
${CMAKE_BINARY_DIR}/DerivedSources/WPEToolingBackends
)

set(MiniBrowser_SYSTEM_INCLUDE_DIRECTORIES
${WPE_INCLUDE_DIRS}
${WPEBACKEND_FDO_INCLUDE_DIRS}
)

set(MiniBrowser_LIBRARIES
${JavaScriptCore_LIBRARY_NAME}
WPEToolingBackends
WebKit
${WPE_LIBRARIES}
${WPEBACKEND_FDO_LIBRARIES}
)

if (DEVELOPER_MODE)
add_definitions(-DWEBKIT_INJECTED_BUNDLE_PATH="${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
endif ()

include_directories(${MiniBrowser_INCLUDE_DIRECTORIES})
include_directories(SYSTEM ${MiniBrowser_SYSTEM_INCLUDE_DIRECTORIES})
add_executable(MiniBrowser ${MiniBrowser_SOURCES})
target_link_libraries(MiniBrowser ${MiniBrowser_LIBRARIES})

install(TARGETS MiniBrowser DESTINATION "${LIBEXEC_INSTALL_DIR}")
Loading

0 comments on commit 2c873db

Please sign in to comment.