[WPE] Add initial support for WebDriver
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Nov 2017 12:48:22 +0000 (12:48 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Nov 2017 12:48:22 +0000 (12:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179727

Reviewed by Michael Catanzaro.

.:

Enable WebDriver by default in WPE.

* Source/cmake/OptionsWPE.cmake:

Source/WebDriver:

Add WPE implementation for platform-specific methods. Move the version handling to a common file
WebDriverServiceGLib.cpp.

* Capabilities.h:
* PlatformGTK.cmake:
* PlatformWPE.cmake:
* glib/WebDriverServiceGLib.cpp: Added.
(WebDriver::parseVersion):
(WebDriver::WebDriverService::platformCompareBrowserVersions):
* gtk/WebDriverServiceGtk.cpp:
* wpe/WebDriverServiceWPE.cpp: Copied from Source/WebDriver/gtk/WebDriverServiceGtk.cpp.
(WebDriver::WebDriverService::platformCapabilities):
(WebDriver::WebDriverService::platformValidateCapability const):
(WebDriver::WebDriverService::platformMatchCapability const):
(WebDriver::WebDriverService::platformParseCapabilities const):

Tools:

Make it possible to run WebDriver tests with WPE.

* Scripts/run-webdriver-tests: Add --wpe alias for --platform=wpe.
* Scripts/webkitpy/port/wpe.py:
(WPEPort.__init__): Initialize _display_server from options.
(WPEPort._driver_class): Use WaylandDriver when wayland is passed as display server option.
* Scripts/webkitpy/webdriver_tests/webdriver_driver.py:
(WebDriver.browser_env): Add virtual method to get the environment that should be used.
* Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py: Copied from Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver.py.
(WebDriverWPE):
(WebDriverWPE.__init__):
(WebDriverWPE.binary_path):
(WebDriverWPE.browser_name):
(WebDriverWPE.capabilities):
(WebDriverWPE.browser_env):
* Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py:
(WebDriverW3CExecutor.__init__): Update the environment with the one provided by the driver.
* wpe/jhbuild.modules: Upgrade dyz to newer version that supports automation.

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

16 files changed:
ChangeLog
Source/WebDriver/Capabilities.h
Source/WebDriver/ChangeLog
Source/WebDriver/PlatformGTK.cmake
Source/WebDriver/PlatformWPE.cmake [new file with mode: 0644]
Source/WebDriver/glib/WebDriverServiceGLib.cpp [new file with mode: 0644]
Source/WebDriver/gtk/WebDriverServiceGtk.cpp
Source/WebDriver/wpe/WebDriverServiceWPE.cpp [new file with mode: 0644]
Source/cmake/OptionsWPE.cmake
Tools/ChangeLog
Tools/Scripts/run-webdriver-tests
Tools/Scripts/webkitpy/port/wpe.py
Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver.py
Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py [new file with mode: 0644]
Tools/Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py
Tools/wpe/jhbuild.modules

index 2159f30..e88f4e4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2017-11-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [WPE] Add initial support for WebDriver
+        https://bugs.webkit.org/show_bug.cgi?id=179727
+
+        Reviewed by Michael Catanzaro.
+
+        Enable WebDriver by default in WPE.
+
+        * Source/cmake/OptionsWPE.cmake:
+
 2017-11-15  Keith Miller  <keith_miller@apple.com>
 
         Unreviewed, sort async iteration feature.
index 23335ec..91a507d 100644 (file)
@@ -58,9 +58,11 @@ struct Capabilities {
     std::optional<Timeouts> timeouts;
     std::optional<PageLoadStrategy> pageLoadStrategy;
     std::optional<UnhandledPromptBehavior> unhandledPromptBehavior;
-#if PLATFORM(GTK)
+#if PLATFORM(GTK) || PLATFORM(WPE)
     std::optional<String> browserBinary;
     std::optional<Vector<String>> browserArguments;
+#endif
+#if PLATFORM(GTK)
     std::optional<bool> useOverlayScrollbars;
 #endif
 };
index fa0107c..6ab34ee 100644 (file)
@@ -1,3 +1,26 @@
+2017-11-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [WPE] Add initial support for WebDriver
+        https://bugs.webkit.org/show_bug.cgi?id=179727
+
+        Reviewed by Michael Catanzaro.
+
+        Add WPE implementation for platform-specific methods. Move the version handling to a common file
+        WebDriverServiceGLib.cpp.
+
+        * Capabilities.h:
+        * PlatformGTK.cmake:
+        * PlatformWPE.cmake:
+        * glib/WebDriverServiceGLib.cpp: Added.
+        (WebDriver::parseVersion):
+        (WebDriver::WebDriverService::platformCompareBrowserVersions):
+        * gtk/WebDriverServiceGtk.cpp:
+        * wpe/WebDriverServiceWPE.cpp: Copied from Source/WebDriver/gtk/WebDriverServiceGtk.cpp.
+        (WebDriver::WebDriverService::platformCapabilities):
+        (WebDriver::WebDriverService::platformValidateCapability const):
+        (WebDriver::WebDriverService::platformMatchCapability const):
+        (WebDriver::WebDriverService::platformParseCapabilities const):
+
 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r224863.
index 0deb59b..8bc9a44 100644 (file)
@@ -9,6 +9,7 @@ list(APPEND WebDriver_SYSTEM_INCLUDE_DIRECTORIES
 
 list(APPEND WebDriver_SOURCES
     glib/SessionHostGlib.cpp
+    glib/WebDriverServiceGLib.cpp
 
     gtk/WebDriverServiceGtk.cpp
 
diff --git a/Source/WebDriver/PlatformWPE.cmake b/Source/WebDriver/PlatformWPE.cmake
new file mode 100644 (file)
index 0000000..bd3cd81
--- /dev/null
@@ -0,0 +1,19 @@
+set(WebDriver_Process_OUTPUT_NAME WPEWebDriver)
+
+list(APPEND WebDriver_SYSTEM_INCLUDE_DIRECTORIES
+    "${GLIB_INCLUDE_DIRS}"
+    "${LIBSOUP_INCLUDE_DIRS}"
+)
+
+list(APPEND WebDriver_SOURCES
+    glib/SessionHostGlib.cpp
+    glib/WebDriverServiceGLib.cpp
+
+    soup/HTTPServerSoup.cpp
+
+    wpe/WebDriverServiceWPE.cpp
+)
+
+list(APPEND WebDriver_LIBRARIES
+    ${LIBSOUP_LIBRARIES}
+)
diff --git a/Source/WebDriver/glib/WebDriverServiceGLib.cpp b/Source/WebDriver/glib/WebDriverServiceGLib.cpp
new file mode 100644 (file)
index 0000000..971caf1
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 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 APPLE INC. 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 APPLE INC. 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.
+ */
+
+#include "config.h"
+#include "WebDriverService.h"
+
+namespace WebDriver {
+
+static bool parseVersion(const String& version, uint64_t& major, uint64_t& minor, uint64_t& micro)
+{
+    major = minor = micro = 0;
+
+    Vector<String> tokens;
+    version.split(".", false, tokens);
+    bool ok;
+    switch (tokens.size()) {
+    case 3:
+        micro = tokens[2].toInt64(&ok);
+        if (!ok)
+            return false;
+        FALLTHROUGH;
+    case 2:
+        minor = tokens[1].toInt64(&ok);
+        if (!ok)
+            return false;
+        FALLTHROUGH;
+    case 1:
+        major = tokens[0].toInt64(&ok);
+        if (!ok)
+            return false;
+        break;
+    default:
+        return false;
+    }
+
+    return true;
+}
+
+bool WebDriverService::platformCompareBrowserVersions(const String& requiredVersion, const String& proposedVersion)
+{
+    // We require clients to use format major.micro.minor as version string.
+    uint64_t requiredMajor, requiredMinor, requiredMicro;
+    if (!parseVersion(requiredVersion, requiredMajor, requiredMinor, requiredMicro))
+        return false;
+
+    uint64_t proposedMajor, proposedMinor, proposedMicro;
+    if (!parseVersion(proposedVersion, proposedMajor, proposedMinor, proposedMicro))
+        return false;
+
+    return proposedMajor > requiredMajor
+        || (proposedMajor == requiredMajor && proposedMinor > requiredMinor)
+        || (proposedMajor == requiredMajor && proposedMinor == requiredMinor && proposedMicro >= requiredMicro);
+}
+
+} // namespace WebDriver
index b753784..1d48275 100644 (file)
@@ -85,52 +85,6 @@ std::optional<String> WebDriverService::platformMatchCapability(const String&, c
     return std::nullopt;
 }
 
-static bool parseVersion(const String& version, uint64_t& major, uint64_t& minor, uint64_t& micro)
-{
-    major = minor = micro = 0;
-
-    Vector<String> tokens;
-    version.split(".", false, tokens);
-    bool ok;
-    switch (tokens.size()) {
-    case 3:
-        micro = tokens[2].toInt64(&ok);
-        if (!ok)
-            return false;
-        FALLTHROUGH;
-    case 2:
-        minor = tokens[1].toInt64(&ok);
-        if (!ok)
-            return false;
-        FALLTHROUGH;
-    case 1:
-        major = tokens[0].toInt64(&ok);
-        if (!ok)
-            return false;
-        break;
-    default:
-        return false;
-    }
-
-    return true;
-}
-
-bool WebDriverService::platformCompareBrowserVersions(const String& requiredVersion, const String& proposedVersion)
-{
-    // We require clients to use format major.micro.minor as version string.
-    uint64_t requiredMajor, requiredMinor, requiredMicro;
-    if (!parseVersion(requiredVersion, requiredMajor, requiredMinor, requiredMicro))
-        return false;
-
-    uint64_t proposedMajor, proposedMinor, proposedMicro;
-    if (!parseVersion(proposedVersion, proposedMajor, proposedMinor, proposedMicro))
-        return false;
-
-    return proposedMajor > requiredMajor
-        || (proposedMajor == requiredMajor && proposedMinor > requiredMinor)
-        || (proposedMajor == requiredMajor && proposedMinor == requiredMinor && proposedMicro >= requiredMicro);
-}
-
 void WebDriverService::platformParseCapabilities(const InspectorObject& matchedCapabilities, Capabilities& capabilities) const
 {
     RefPtr<InspectorObject> browserOptions;
diff --git a/Source/WebDriver/wpe/WebDriverServiceWPE.cpp b/Source/WebDriver/wpe/WebDriverServiceWPE.cpp
new file mode 100644 (file)
index 0000000..3f18057
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2017 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 APPLE INC. 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 APPLE INC. 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.
+ */
+
+#include "config.h"
+#include "WebDriverService.h"
+
+#include "Capabilities.h"
+#include "CommandResult.h"
+#include <inspector/InspectorValues.h>
+
+using namespace Inspector;
+
+namespace WebDriver {
+
+Capabilities WebDriverService::platformCapabilities()
+{
+    Capabilities capabilities;
+    capabilities.platformName = String("linux");
+    capabilities.acceptInsecureCerts = false;
+    return capabilities;
+}
+
+bool WebDriverService::platformValidateCapability(const String& name, const RefPtr<InspectorValue>& value) const
+{
+    if (name != "wpe:browserOptions")
+        return true;
+
+    RefPtr<InspectorObject> browserOptions;
+    if (!value->asObject(browserOptions))
+        return false;
+
+    if (browserOptions->isNull())
+        return true;
+
+    // If browser options are provided, binary is required.
+    String binary;
+    if (!browserOptions->getString(ASCIILiteral("binary"), binary))
+        return false;
+
+    RefPtr<InspectorValue> browserArgumentsValue;
+    RefPtr<InspectorArray> browserArguments;
+    if (browserOptions->getValue(ASCIILiteral("args"), browserArgumentsValue) && !browserArgumentsValue->asArray(browserArguments))
+        return false;
+
+    unsigned browserArgumentsLength = browserArguments->length();
+    for (unsigned i = 0; i < browserArgumentsLength; ++i) {
+        RefPtr<InspectorValue> value = browserArguments->get(i);
+        String argument;
+        if (!value->asString(argument))
+            return false;
+    }
+
+    return true;
+}
+
+std::optional<String> WebDriverService::platformMatchCapability(const String&, const RefPtr<InspectorValue>&) const
+{
+    return std::nullopt;
+}
+
+void WebDriverService::platformParseCapabilities(const InspectorObject& matchedCapabilities, Capabilities& capabilities) const
+{
+    RefPtr<InspectorObject> browserOptions;
+    if (!matchedCapabilities.getObject(ASCIILiteral("wpe:browserOptions"), browserOptions)) {
+        capabilities.browserBinary = String("dyz");
+        capabilities.browserArguments = Vector<String> { ASCIILiteral("--automation") };
+        return;
+    }
+
+    String browserBinary;
+    browserOptions->getString(ASCIILiteral("binary"), browserBinary);
+    ASSERT(!browserBinary.isNull());
+    capabilities.browserBinary = browserBinary;
+
+    capabilities.browserArguments = Vector<String>();
+    RefPtr<InspectorArray> browserArguments;
+    if (browserOptions->getArray(ASCIILiteral("args"), browserArguments)) {
+        unsigned browserArgumentsLength = browserArguments->length();
+        capabilities.browserArguments->reserveInitialCapacity(browserArgumentsLength);
+        for (unsigned i = 0; i < browserArgumentsLength; ++i) {
+            RefPtr<InspectorValue> value = browserArguments->get(i);
+            String argument;
+            value->asString(argument);
+            ASSERT(!argument.isNull());
+            capabilities.browserArguments->uncheckedAppend(WTFMove(argument));
+        }
+    }
+}
+
+} // namespace WebDriver
index 8884f78..3199ba7 100644 (file)
@@ -15,6 +15,7 @@ include(GStreamerDefinitions)
 # changing the value of the option.
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ACCELERATED_2D_CANVAS PUBLIC OFF)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PUBLIC OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBDRIVER PUBLIC ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XSLT PUBLIC ON)
 
 # Private options shared with other WebKit ports. Add options here only if
index 745f101..f7d3ac6 100644 (file)
@@ -1,3 +1,29 @@
+2017-11-15  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [WPE] Add initial support for WebDriver
+        https://bugs.webkit.org/show_bug.cgi?id=179727
+
+        Reviewed by Michael Catanzaro.
+
+        Make it possible to run WebDriver tests with WPE.
+
+        * Scripts/run-webdriver-tests: Add --wpe alias for --platform=wpe.
+        * Scripts/webkitpy/port/wpe.py:
+        (WPEPort.__init__): Initialize _display_server from options.
+        (WPEPort._driver_class): Use WaylandDriver when wayland is passed as display server option.
+        * Scripts/webkitpy/webdriver_tests/webdriver_driver.py:
+        (WebDriver.browser_env): Add virtual method to get the environment that should be used.
+        * Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py: Copied from Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver.py.
+        (WebDriverWPE):
+        (WebDriverWPE.__init__):
+        (WebDriverWPE.binary_path):
+        (WebDriverWPE.browser_name):
+        (WebDriverWPE.capabilities):
+        (WebDriverWPE.browser_env):
+        * Scripts/webkitpy/webdriver_tests/webdriver_w3c_executor.py:
+        (WebDriverW3CExecutor.__init__): Update the environment with the one provided by the driver.
+        * wpe/jhbuild.modules: Upgrade dyz to newer version that supports automation.
+
 2017-11-15  Alex Christensen  <achristensen@webkit.org>
 
         WebViews scheduled in custom run loop modes should be able to do more than 50ms of work at a time
index 94e2c14..f7534ac 100755 (executable)
@@ -39,6 +39,8 @@ option_parser.add_option('--platform', action='store',
                          help='Platform to use (e.g., "gtk")')
 option_parser.add_option('--gtk', action='store_const', dest='platform', const='gtk',
                          help='Alias for --platform=gtk')
+option_parser.add_option('--wpe', action='store_const', dest='platform', const='wpe',
+                         help='Alias for --platform=wpe')
 option_parser.add_option('--release', action='store_const', const='Release', dest="configuration",
                          help='Set the configuration to Release')
 option_parser.add_option('--debug', action='store_const', const='Debug', dest="configuration",
index c0f1f17..231b5f2 100644 (file)
@@ -30,6 +30,7 @@ from webkitpy.common.memoized import memoized
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
 from webkitpy.port.base import Port
 from webkitpy.port.linux_get_crash_log import GDBCrashLogGenerator
+from webkitpy.port.waylanddriver import WaylandDriver
 
 
 class WPEPort(Port):
@@ -38,6 +39,7 @@ class WPEPort(Port):
     def __init__(self, *args, **kwargs):
         super(WPEPort, self).__init__(*args, **kwargs)
 
+        self._display_server = self.get_option("display_server")
         if self._should_use_jhbuild():
             self._jhbuild_wrapper = [self.path_from_webkit_base('Tools', 'jhbuild', 'jhbuild-wrapper'), '--wpe', 'run']
             self.set_option_default('wrapper', ' '.join(self._jhbuild_wrapper))
@@ -61,6 +63,12 @@ class WPEPort(Port):
     def _port_flag_for_scripts(self):
         return "--wpe"
 
+    @memoized
+    def _driver_class(self):
+        if self._display_server == "wayland":
+            return WaylandDriver
+        return super(WPEPort, self)._driver_class()
+
     def setup_environ_for_server(self, server_name=None):
         environment = super(WPEPort, self).setup_environ_for_server(server_name)
         environment['G_DEBUG'] = 'fatal-criticals'
index 9ee2b44..63473f5 100644 (file)
@@ -34,6 +34,9 @@ class WebDriver(object):
     def capabilities(self):
         raise NotImplementedError
 
+    def browser_env(self):
+        return {}
+
 
 _drivers = {}
 
diff --git a/Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py b/Tools/Scripts/webkitpy/webdriver_tests/webdriver_driver_wpe.py
new file mode 100644 (file)
index 0000000..970c941
--- /dev/null
@@ -0,0 +1,56 @@
+# Copyright (C) 2017 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 APPLE INC. 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 APPLE INC. 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.
+
+import os
+from webkitpy.webdriver_tests.webdriver_driver import WebDriver, register_driver
+
+
+class WebDriverWPE(WebDriver):
+
+    def __init__(self, port):
+        super(WebDriverWPE, self).__init__(port)
+
+    def binary_path(self):
+        return self._port._build_path('bin', 'WPEWebDriver')
+
+    def browser_name(self):
+        return 'dyz'
+
+    def capabilities(self):
+        return {'wpe:browserOptions': {
+            'binary': self.browser_name(),
+            'args': ['--automation']}}
+
+    def browser_env(self):
+        env = {}
+        env['WEBKIT_EXEC_PATH'] = self._port._build_path('bin')
+        try:
+            ld_library_path = os.environ['LD_LIBRARY_PATH']
+        except KeyError:
+            ld_library_path = None
+        env['LD_LIBRARY_PATH'] = self._port._build_path('lib')
+        if ld_library_path:
+            env['LD_LIBRARY_PATH'] += ':' + ld_library_path
+        return env
+
+
+register_driver('wpe', WebDriverWPE)
index d6cbdf3..93517bd 100644 (file)
@@ -124,6 +124,7 @@ class WebDriverW3CExecutor(WdspecExecutor):
 
     def __init__(self, driver, server, display_driver):
         WebKitDriverServer.test_env = display_driver._setup_environ_for_test()
+        WebKitDriverServer.test_env.update(driver.browser_env())
         server_config = {'host': server.host(), 'ports': {'http': [str(server.port())]}}
         WdspecExecutor.__init__(self, driver.browser_name(), server_config, driver.binary_path(), None, capabilities=driver.capabilities())
 
index 7e7e0d4..1af8ff5 100644 (file)
   </autotools>
 
   <autotools id="dyz" supports-non-srcdir-builds="no">
-    <branch repo="github.com" module="Igalia/dyz" tag="fbf8df56fbcc18fb2c1aa266c4a9f5a31d605549"/>
+    <branch repo="github.com" module="Igalia/dyz" tag="203a1ebd1481e44aa8105e862c02f317e6653627"/>
   </autotools>
 
   <meson id="graphene">