Diff
Modified: trunk/Tools/ChangeLog (196978 => 196979)
--- trunk/Tools/ChangeLog 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/ChangeLog 2016-02-23 17:38:38 UTC (rev 196979)
@@ -1,3 +1,40 @@
+2016-02-23 Carlos Alberto Lopez Perez <clo...@igalia.com>
+
+ [GTK] Allow to run the WebKitGTK+ MiniBrowser with the run-benchmark script.
+ https://bugs.webkit.org/show_bug.cgi?id=153993
+
+ Reviewed by Carlos Garcia Campos.
+
+ * MiniBrowser/gtk/main.c:
+ (createBrowserWindow): Support --geometry argument for MiniBrowser.
+ We use this on the gtk_minibrowser_driver script to start the MiniBrowser maximized.
+ * Scripts/webkitpy/benchmark_runner/browser_driver/__init__.py: Fix loading of subclasses:
+ The base class has to be loaded first, otherwise any subclase referencing it will give import error.
+ In OSX the ordering of os.listdir() causes the base class (browser_driver.py) to be first on the list, but not on Linux.
+ By specifiying the name of the base class file, we ensure it is always loaded first on any system despite the ordering of listdir.
+ * Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py:
+ (BrowserDriverFactory.create):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/gtk_browser_driver.py: Added.
+ (GTKBrowserDriver):
+ (GTKBrowserDriver.prepare_env):
+ (GTKBrowserDriver.restore_env):
+ (GTKBrowserDriver.close_browsers):
+ (GTKBrowserDriver._launch_process):
+ (GTKBrowserDriver._terminate_processes):
+ (GTKBrowserDriver._screen_size):
+ * Scripts/webkitpy/benchmark_runner/browser_driver/gtk_minibrowser_driver.py: Added.
+ (GTKMiniBrowserDriver):
+ (GTKMiniBrowserDriver.prepare_env):
+ (GTKMiniBrowserDriver.launch_url):
+ (GTKMiniBrowserDriver.close_browsers):
+ * Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py: Fix loading of subclasses. See description above.
+ * Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py:
+ (SimpleHTTPServerDriver):
+ (SimpleHTTPServerDriver.kill_server): Check if the server is still running before trying to terminate it.
+ Usually the server ends gracefully (no need to terminate it), so this was causing ugly errors on the log.
+ * Scripts/webkitpy/benchmark_runner/utils.py: Fix loading of subclasses. See description above.
+ (load_subclasses):
+
2016-02-23 Alejandro G. Castro <a...@igalia.com>
[GTK] Missing configuration patch for openh264 compilation
Modified: trunk/Tools/MiniBrowser/gtk/main.c (196978 => 196979)
--- trunk/Tools/MiniBrowser/gtk/main.c 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/MiniBrowser/gtk/main.c 2016-02-23 17:38:38 UTC (rev 196979)
@@ -40,6 +40,7 @@
static GdkRGBA *backgroundColor;
static gboolean editorMode;
static const char *sessionFile;
+static char *geometry;
typedef enum {
MINI_BROWSER_ERROR_INVALID_ABOUT_PATH
@@ -67,6 +68,8 @@
GtkWidget *mainWindow = browser_window_new(WEBKIT_WEB_VIEW(webView), NULL);
if (backgroundColor)
browser_window_set_background_color(BROWSER_WINDOW(mainWindow), backgroundColor);
+ if (geometry)
+ gtk_window_parse_geometry(BROWSER_WINDOW(mainWindow), geometry);
if (webkitSettings)
webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webView), webkitSettings);
@@ -102,6 +105,7 @@
{ "bg-color", 0, 0, G_OPTION_ARG_CALLBACK, parseBackgroundColor, "Background color", NULL },
{ "editor-mode", 'e', 0, G_OPTION_ARG_NONE, &editorMode, "Run in editor mode", NULL },
{ "session-file", 's', 0, G_OPTION_ARG_FILENAME, &sessionFile, "Session file", "FILE" },
+ { "geometry", 'g', 0, G_OPTION_ARG_STRING, &geometry, "Set the size and position of the window (WIDTHxHEIGHT+X+Y)", "GEOMETRY" },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &uriArguments, 0, "[URL…]" },
{ 0, 0, 0, 0, 0, 0, 0 }
};
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/__init__.py (196978 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/__init__.py 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/__init__.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -25,4 +25,5 @@
load_subclasses(
dirname=os.path.dirname(os.path.abspath(__file__)),
base_class_name='BrowserDriver',
+ base_class_file='browser_driver.py',
loader=browser_driver_loader)
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py (196978 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/browser_driver_factory.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -30,4 +30,6 @@
@classmethod
def create(cls, platform, browser_name):
+ if browser_name not in cls.browser_drivers[platform]:
+ raise ValueError("Browser \"%s\" is not available on platform \"%s\"" % (browser_name, platform))
return cls.browser_drivers[platform][browser_name]()
Added: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/gtk_browser_driver.py (0 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/gtk_browser_driver.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/gtk_browser_driver.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -0,0 +1,66 @@
+# Copyright (C) 2016 Igalia S.L. All rights reserved.
+#
+# 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.
+#
+# 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.
+
+import logging
+import subprocess
+from browser_driver import BrowserDriver
+
+_log = logging.getLogger(__name__)
+
+
+class GTKBrowserDriver(BrowserDriver):
+ process_name = None
+ platform = 'gtk'
+
+ def prepare_env(self, device_id):
+ self.close_browsers()
+
+ def restore_env(self):
+ pass
+
+ def close_browsers(self):
+ self._terminate_processes(self.process_name)
+
+ @classmethod
+ def _launch_process(cls, args, env=None):
+ process = subprocess.Popen(args)
+ return process
+
+ @classmethod
+ def _terminate_processes(cls, process_name):
+ _log.info('Closing all processes with name %s' % process_name)
+ subprocess.call(['/usr/bin/killall', process_name])
+
+ @classmethod
+ def _screen_size(cls):
+ # load_subclasses() from __init__.py will load this file to
+ # check the platform defined. Do here a lazy import instead of
+ # trying to import the Gtk module on the global scope of this
+ # file to avoid ImportError errors on other platforms.
+ # Python imports are cached and only run once, so this should be ok.
+ from gi.repository import Gtk
+ screen = Gtk.Window().get_screen()
+ return screen.get_monitor_geometry(screen.get_primary_monitor())
Added: trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/gtk_minibrowser_driver.py (0 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/gtk_minibrowser_driver.py (rev 0)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/browser_driver/gtk_minibrowser_driver.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -0,0 +1,52 @@
+# Copyright (C) 2016 Igalia S.L. All rights reserved.
+#
+# 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.
+#
+# 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.
+
+import logging
+import sys
+from gtk_browser_driver import GTKBrowserDriver
+
+_log = logging.getLogger(__name__)
+
+
+class GTKMiniBrowserDriver(GTKBrowserDriver):
+ process_name = 'MiniBrowser'
+ browser_name = 'minibrowser'
+
+ def prepare_env(self, device_id):
+ self._minibrowser_process = None
+ super(GTKMiniBrowserDriver, self).prepare_env(device_id)
+
+ def launch_url(self, url, browser_build_path):
+ args = ['Tools/Scripts/run-minibrowser', '--gtk']
+ args.append("--geometry=%sx%s" % (self._screen_size().width, self._screen_size().height))
+ args.append(url)
+ _log.info('Launching Minibrowser with url: %s' % url)
+ self._minibrowser_process = GTKBrowserDriver._launch_process(args)
+
+ def close_browsers(self):
+ super(GTKMiniBrowserDriver, self).close_browsers()
+ if self._minibrowser_process and self._minibrowser_process.returncode:
+ sys.exit('MiniBrowser crashed with exitcode %d' % self._minibrowser_process.returncode)
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py (196978 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/__init__.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -26,4 +26,5 @@
load_subclasses(
dirname=os.path.dirname(os.path.abspath(__file__)),
base_class_name='HTTPServerDriver',
+ base_class_file='http_server_driver.py',
loader=http_server_driver_loader)
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py (196978 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/http_server_driver/simple_http_server_driver.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -19,7 +19,7 @@
"""This class depends on unix environment, need to be modified to achieve crossplatform compability
"""
- platforms = ['osx']
+ platforms = ['osx', 'gtk']
def __init__(self):
self._server_process = None
@@ -85,7 +85,8 @@
def kill_server(self):
try:
- self._server_process.terminate()
+ if self._server_process.poll() is None:
+ self._server_process.terminate()
except OSError as error:
_log.info('Error terminating server process: %s' % (error))
Modified: trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py (196978 => 196979)
--- trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py 2016-02-23 16:49:54 UTC (rev 196978)
+++ trunk/Tools/Scripts/webkitpy/benchmark_runner/utils.py 2016-02-23 17:38:38 UTC (rev 196979)
@@ -18,11 +18,10 @@
return inspect.isclass(child) and parent_name in [cls.__name__ for cls in inspect.getmro(child)]
-def load_subclasses(dirname, base_class_name, loader):
- for filename in os.listdir(dirname):
- if not filename.endswith('.py') or filename in ['__init__.py']:
- continue
- module_name = filename[:-3]
+def load_subclasses(dirname, base_class_name, base_class_file, loader):
+ filelist = [base_class_file] + [f for f in os.listdir(dirname) if f.endswith('.py') and f not in ['__init__.py', base_class_file]]
+ for filename in filelist:
+ module_name = os.path.splitext(filename)[0]
module = imp.load_source(module_name, os.path.join(dirname, filename))
for item_name in dir(module):
item = getattr(module, item_name)