Skip to content
Permalink
Browse files

Update to latest wptrunner.

  • Loading branch information
jgraham committed Oct 6, 2015
1 parent bae87d1 commit da3bc54d05e6865bed36fe7102b0b9f5f77120f4
@@ -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


@@ -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}
@@ -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}
@@ -36,7 +36,8 @@ def setup(self, runner):

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 @@ def wait(self):
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):
@@ -346,14 +346,17 @@ def _find_element(self, strategy, selector, all):


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
self.timeouts = None
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 @@ def start(self):
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 @@ def end(self):
self.timeouts = None
self.window = None
self.find = None
self.extension = None
self.transport.close_connection()

def __enter__(self):
@@ -579,9 +585,37 @@ def send_keys(self, keys):
@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)
@@ -199,6 +199,7 @@ def __init__(self, suite_name, test_queue, test_source_cls, browser_cls, browser

self.browser = None
self.browser_pid = None
self.browser_started = False

# Flags used to shut down this thread if we get a sigint
self.parent_stop_flag = stop_flag
@@ -279,6 +280,10 @@ def run(self):
if commands[command](*data) is Stop:
break
else:
if (self.debug_info and self.debug_info.interactive and
self.browser_started and not browser.is_alive()):
self.logger.debug("Debugger exited")
break
if not self.test_runner_proc.is_alive():
if not self.command_queue.empty():
# We got a new message so process that
@@ -355,6 +360,7 @@ def init_failed():
succeeded = False
else:
succeeded = True
self.browser_started = True

# This has to happen after the lock is released
if not succeeded:
@@ -457,6 +463,7 @@ def stop_runner(self):
return
try:
self.browser.stop()
self.browser_started = False
if self.test_runner_proc.is_alive():
self.send_message("stop")
self.ensure_runner_stopped()
@@ -274,6 +274,8 @@ def checkout(self, rev, branch=None, force=False):
: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()

0 comments on commit da3bc54

Please sign in to comment.
You can’t perform that action at this time.