From 15fdb4dcb04f57d5d783dbebcff0134c6f37e782 Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 30 Sep 2015 16:12:01 +0100 Subject: [PATCH] Bug 1197365 - Update to latest wptrunner, a=testonly --- .../harness/wptrunner/browsers/firefox.py | 10 ++++- .../harness/wptrunner/browsers/servo.py | 4 +- .../harness/wptrunner/browsers/servodriver.py | 3 +- .../executors/executorservodriver.py | 8 +++- .../harness/wptrunner/executors/webdriver.py | 40 +++++++++++++++++-- .../harness/wptrunner/update/tree.py | 2 + 6 files changed, 59 insertions(+), 8 deletions(-) diff --git a/testing/web-platform/harness/wptrunner/browsers/firefox.py b/testing/web-platform/harness/wptrunner/browsers/firefox.py index 6bbe282d3e8..d3698c22ecf 100644 --- a/testing/web-platform/harness/wptrunner/browsers/firefox.py +++ b/testing/web-platform/harness/wptrunner/browsers/firefox.py @@ -53,8 +53,14 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, executor_kwargs = base_executor_kwargs(test_type, server_config, cache_manager, **kwargs) executor_kwargs["close_after_done"] = True - if run_info_data["debug"] and kwargs["timeout_multiplier"] is None: - executor_kwargs["timeout_multiplier"] = 3 + if kwargs["timeout_multiplier"] is None: + if kwargs["gecko_e10s"] and test_type == "reftest": + if run_info_data["debug"]: + executor_kwargs["timeout_multiplier"] = 4 + else: + executor_kwargs["timeout_multiplier"] = 2 + elif run_info_data["debug"]: + executor_kwargs["timeout_multiplier"] = 3 return executor_kwargs diff --git a/testing/web-platform/harness/wptrunner/browsers/servo.py b/testing/web-platform/harness/wptrunner/browsers/servo.py index 64249af8a59..1ae9b7ea77b 100644 --- a/testing/web-platform/harness/wptrunner/browsers/servo.py +++ b/testing/web-platform/harness/wptrunner/browsers/servo.py @@ -37,8 +37,10 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, rv["pause_after_test"] = kwargs["pause_after_test"] return rv + def env_options(): - return {"host": "localhost", + return {"host": "127.0.0.1", + "external_host": "web-platform.test", "bind_hostname": "true", "testharnessreport": "testharnessreport-servo.js", "supports_debugger": True} diff --git a/testing/web-platform/harness/wptrunner/browsers/servodriver.py b/testing/web-platform/harness/wptrunner/browsers/servodriver.py index 656a8b51f40..7df28797efb 100644 --- a/testing/web-platform/harness/wptrunner/browsers/servodriver.py +++ b/testing/web-platform/harness/wptrunner/browsers/servodriver.py @@ -49,7 +49,8 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kw def env_options(): - return {"host": "web-platform.test", + return {"host": "127.0.0.1", + "external_host": "web-platform.test", "bind_hostname": "true", "testharnessreport": "testharnessreport-servodriver.js", "supports_debugger": True} diff --git a/testing/web-platform/harness/wptrunner/executors/executorservodriver.py b/testing/web-platform/harness/wptrunner/executors/executorservodriver.py index 6b94c033bd1..8a914a876eb 100644 --- a/testing/web-platform/harness/wptrunner/executors/executorservodriver.py +++ b/testing/web-platform/harness/wptrunner/executors/executorservodriver.py @@ -36,7 +36,8 @@ class ServoWebDriverProtocol(Protocol): session_started = False try: - self.session = webdriver.Session(self.host, self.port) + self.session = webdriver.Session(self.host, self.port, + extension=webdriver.ServoExtensions) self.session.start() except: self.logger.warning( @@ -82,6 +83,11 @@ class ServoWebDriverProtocol(Protocol): self.logger.error(traceback.format_exc(e)) break + def on_environment_change(self, old_environment, new_environment): + #Unset all the old prefs + self.session.extension.reset_prefs(*old_environment.get("prefs", {}).keys()) + self.session.extension.set_prefs(new_environment.get("prefs", {})) + class ServoWebDriverRun(object): def __init__(self, func, session, url, timeout, current_timeout=None): diff --git a/testing/web-platform/harness/wptrunner/executors/webdriver.py b/testing/web-platform/harness/wptrunner/executors/webdriver.py index b3c9ab3a7f5..247f53f1d7a 100644 --- a/testing/web-platform/harness/wptrunner/executors/webdriver.py +++ b/testing/web-platform/harness/wptrunner/executors/webdriver.py @@ -346,7 +346,8 @@ class Find(object): class Session(object): - def __init__(self, host, port, url_prefix="", desired_capabilities=None, port_timeout=60): + def __init__(self, host, port, url_prefix="", desired_capabilities=None, port_timeout=60, + extension=None): self.transport = Transport(host, port, url_prefix, port_timeout) self.desired_capabilities = desired_capabilities self.session_id = None @@ -354,6 +355,8 @@ class Session(object): self.window = None self.find = None self._element_cache = {} + self.extension = None + self.extension_cls = extension def start(self): desired_capabilities = self.desired_capabilities if self.desired_capabilities else {} @@ -365,6 +368,8 @@ class Session(object): self.timeouts = Timeouts(self) self.window = Window(self) self.find = Find(self) + if self.extension_cls: + self.extension = self.extension_cls(self) return rv["value"] @@ -376,6 +381,7 @@ class Session(object): self.timeouts = None self.window = None self.find = None + self.extension = None self.transport.close_connection() def __enter__(self): @@ -579,9 +585,37 @@ class Element(object): @property @command def text(self): - return self.session.send_command("GET", self.url("text"), key="value") + return self.session.send_command("GET", self.url("text")) @property @command def name(self): - return self.session.send_command("GET", self.url("name"), key="value") + return self.session.send_command("GET", self.url("name")) + + @command + def css(self, property_name): + return self.session.send_command("GET", self.url("css/%s" % property_name)) + + @property + @command + def rect(self): + return self.session.send_command("GET", self.url("rect")) + +class ServoExtensions(object): + def __init__(self, session): + self.session = session + + @command + def get_prefs(self, *prefs): + body = {"prefs": list(prefs)} + return self.session.send_command("POST", "servo/prefs/get", body) + + @command + def set_prefs(self, prefs): + body = {"prefs": prefs} + return self.session.send_command("POST", "servo/prefs/set", body) + + @command + def reset_prefs(self, *prefs): + body = {"prefs": list(prefs)} + return self.session.send_command("POST", "servo/prefs/reset", body) diff --git a/testing/web-platform/harness/wptrunner/update/tree.py b/testing/web-platform/harness/wptrunner/update/tree.py index 292a45a4fe2..05b35c24674 100644 --- a/testing/web-platform/harness/wptrunner/update/tree.py +++ b/testing/web-platform/harness/wptrunner/update/tree.py @@ -274,6 +274,8 @@ class GitTree(object): :param branch: Branch name to use :param force: Force-checkout """ + assert rev is not None + args = [] if branch: branches = [ref[len("refs/heads/"):] for sha1, ref in self.list_refs()