зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 5f0452991bcd (bug 1345490)
This commit is contained in:
Родитель
75a34e8f10
Коммит
f19322a8ec
|
@ -19,7 +19,7 @@ with open(os.path.join(here, "requirements.txt")) as f:
|
|||
deps = f.read().splitlines()
|
||||
|
||||
# Browser-specific requirements
|
||||
requirements_files = glob.glob("requirements_*.txt")
|
||||
requirements_files = glob.glob(os.path.join(here, "requirements_*.txt"))
|
||||
|
||||
profile_dest = None
|
||||
dest_exists = False
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<html class="reftest-wait">
|
||||
<title>rel=match that should fail</title>
|
||||
<link rel=match href=red.html>
|
||||
<style>
|
||||
:root {background-color:red}
|
||||
</style>
|
||||
<body class="reftest-wait">
|
||||
<script>
|
||||
setTimeout(function() {
|
||||
document.documentElement.style.backgroundColor = "green";
|
||||
document.documentElement.className = "";
|
||||
body.className = "";
|
||||
}, 2000);
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -127,9 +127,6 @@ class Browser(object):
|
|||
|
||||
|
||||
class NullBrowser(Browser):
|
||||
def __init__(self, logger, **kwargs):
|
||||
super(NullBrowser, self).__init__(logger)
|
||||
|
||||
def start(self):
|
||||
"""No-op browser to use in scenarios where the TestRunnerManager shouldn't
|
||||
actually own the browser process (e.g. Servo where we start one browser
|
||||
|
|
|
@ -35,18 +35,10 @@ 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
|
||||
capabilities = dict(DesiredCapabilities.CHROME.items())
|
||||
capabilities.setdefault("chromeOptions", {})["prefs"] = {
|
||||
"profile": {
|
||||
"default_content_setting_values": {
|
||||
"popups": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
|
||||
if kwargs[kwarg] is not None:
|
||||
capabilities["chromeOptions"][capability] = kwargs[kwarg]
|
||||
executor_kwargs["capabilities"] = capabilities
|
||||
executor_kwargs["capabilities"] = dict(DesiredCapabilities.CHROME.items())
|
||||
if kwargs["binary"] is not None:
|
||||
executor_kwargs["capabilities"]["chromeOptions"] = {"binary": kwargs["binary"]}
|
||||
|
||||
return executor_kwargs
|
||||
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ def browser_kwargs(**kwargs):
|
|||
"certutil_binary": kwargs["certutil_binary"],
|
||||
"ca_certificate_path": kwargs["ssl_env"].ca_cert_path(),
|
||||
"e10s": kwargs["gecko_e10s"],
|
||||
"stackfix_dir": kwargs["stackfix_dir"],
|
||||
"binary_args": kwargs["binary_args"]}
|
||||
"stackfix_dir": kwargs["stackfix_dir"]}
|
||||
|
||||
|
||||
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
||||
|
@ -77,13 +76,6 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
|||
executor_kwargs["timeout_multiplier"] = 3
|
||||
if test_type == "wdspec":
|
||||
executor_kwargs["webdriver_binary"] = kwargs.get("webdriver_binary")
|
||||
fxOptions = {}
|
||||
if kwargs["binary"]:
|
||||
fxOptions["binary"] = kwargs["binary"]
|
||||
if kwargs["binary_args"]:
|
||||
fxOptions["args"] = kwargs["binary_args"]
|
||||
capabilities = {"moz:firefoxOptions": fxOptions}
|
||||
executor_kwargs["capabilities"] = capabilities
|
||||
return executor_kwargs
|
||||
|
||||
|
||||
|
@ -109,8 +101,7 @@ class FirefoxBrowser(Browser):
|
|||
|
||||
def __init__(self, logger, binary, prefs_root, debug_info=None,
|
||||
symbols_path=None, stackwalk_binary=None, certutil_binary=None,
|
||||
ca_certificate_path=None, e10s=False, stackfix_dir=None,
|
||||
binary_args=None):
|
||||
ca_certificate_path=None, e10s=False, stackfix_dir=None):
|
||||
Browser.__init__(self, logger)
|
||||
self.binary = binary
|
||||
self.prefs_root = prefs_root
|
||||
|
@ -123,7 +114,6 @@ class FirefoxBrowser(Browser):
|
|||
self.ca_certificate_path = ca_certificate_path
|
||||
self.certutil_binary = certutil_binary
|
||||
self.e10s = e10s
|
||||
self.binary_args = binary_args
|
||||
if self.symbols_path and stackfix_dir:
|
||||
self.stack_fixer = get_stack_fixer_function(stackfix_dir,
|
||||
self.symbols_path)
|
||||
|
@ -160,9 +150,7 @@ class FirefoxBrowser(Browser):
|
|||
if self.ca_certificate_path is not None:
|
||||
self.setup_ssl()
|
||||
|
||||
debug_args, cmd = browser_command(self.binary,
|
||||
self.binary_args if self.binary_args else [] +
|
||||
[cmd_arg("marionette"), "about:blank"],
|
||||
debug_args, cmd = browser_command(self.binary, [cmd_arg("marionette"), "about:blank"],
|
||||
self.debug_info)
|
||||
|
||||
self.runner = FirefoxRunner(profile=self.profile,
|
||||
|
|
|
@ -10,20 +10,17 @@ from ..executors.executorservo import ServoTestharnessExecutor, ServoRefTestExec
|
|||
|
||||
here = os.path.join(os.path.split(__file__)[0])
|
||||
|
||||
__wptrunner__ = {
|
||||
"product": "servo",
|
||||
__wptrunner__ = {"product": "servo",
|
||||
"check_args": "check_args",
|
||||
"browser": "ServoBrowser",
|
||||
"executor": {
|
||||
"testharness": "ServoTestharnessExecutor",
|
||||
"executor": {"testharness": "ServoTestharnessExecutor",
|
||||
"reftest": "ServoRefTestExecutor",
|
||||
"wdspec": "ServoWdspecExecutor",
|
||||
},
|
||||
"wdspec": "ServoWdspecExecutor"},
|
||||
"browser_kwargs": "browser_kwargs",
|
||||
"executor_kwargs": "executor_kwargs",
|
||||
"env_options": "env_options",
|
||||
"update_properties": "update_properties",
|
||||
}
|
||||
"run_info_extras": "run_info_extras",
|
||||
"update_properties": "update_properties"}
|
||||
|
||||
|
||||
def check_args(**kwargs):
|
||||
|
@ -31,12 +28,11 @@ def check_args(**kwargs):
|
|||
|
||||
|
||||
def browser_kwargs(**kwargs):
|
||||
return {
|
||||
"binary": kwargs["binary"],
|
||||
return {"binary": kwargs["binary"],
|
||||
"debug_info": kwargs["debug_info"],
|
||||
"binary_args": kwargs["binary_args"],
|
||||
"user_stylesheets": kwargs.get("user_stylesheets"),
|
||||
}
|
||||
"render_backend": kwargs.get("servo_backend")}
|
||||
|
||||
|
||||
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
|
||||
|
@ -55,23 +51,31 @@ def env_options():
|
|||
"supports_debugger": True}
|
||||
|
||||
|
||||
def run_info_extras(**kwargs):
|
||||
return {"backend": kwargs["servo_backend"]}
|
||||
|
||||
|
||||
def update_properties():
|
||||
return ["debug", "os", "version", "processor", "bits"], None
|
||||
return ["debug", "os", "version", "processor", "bits", "backend"], None
|
||||
|
||||
|
||||
def render_arg(render_backend):
|
||||
return {"cpu": "--cpu", "webrender": "-w"}[render_backend]
|
||||
|
||||
|
||||
class ServoBrowser(NullBrowser):
|
||||
def __init__(self, logger, binary, debug_info=None, binary_args=None,
|
||||
user_stylesheets=None):
|
||||
user_stylesheets=None, render_backend="webrender"):
|
||||
NullBrowser.__init__(self, logger)
|
||||
self.binary = binary
|
||||
self.debug_info = debug_info
|
||||
self.binary_args = binary_args or []
|
||||
self.user_stylesheets = user_stylesheets or []
|
||||
self.render_backend = render_backend
|
||||
|
||||
def executor_browser(self):
|
||||
return ExecutorBrowser, {
|
||||
"binary": self.binary,
|
||||
return ExecutorBrowser, {"binary": self.binary,
|
||||
"debug_info": self.debug_info,
|
||||
"binary_args": self.binary_args,
|
||||
"user_stylesheets": self.user_stylesheets,
|
||||
}
|
||||
"render_backend": self.render_backend}
|
||||
|
|
|
@ -9,25 +9,23 @@ import tempfile
|
|||
from mozprocess import ProcessHandler
|
||||
|
||||
from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser
|
||||
from .servo import render_arg
|
||||
from ..executors import executor_kwargs as base_executor_kwargs
|
||||
from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor,
|
||||
ServoWebDriverRefTestExecutor)
|
||||
|
||||
here = os.path.join(os.path.split(__file__)[0])
|
||||
|
||||
__wptrunner__ = {
|
||||
"product": "servodriver",
|
||||
__wptrunner__ = {"product": "servodriver",
|
||||
"check_args": "check_args",
|
||||
"browser": "ServoWebDriverBrowser",
|
||||
"executor": {
|
||||
"testharness": "ServoWebDriverTestharnessExecutor",
|
||||
"reftest": "ServoWebDriverRefTestExecutor",
|
||||
},
|
||||
"executor": {"testharness": "ServoWebDriverTestharnessExecutor",
|
||||
"reftest": "ServoWebDriverRefTestExecutor"},
|
||||
"browser_kwargs": "browser_kwargs",
|
||||
"executor_kwargs": "executor_kwargs",
|
||||
"env_options": "env_options",
|
||||
"update_properties": "update_properties",
|
||||
}
|
||||
"run_info_extras": "run_info_extras",
|
||||
"update_properties": "update_properties"}
|
||||
|
||||
hosts_text = """127.0.0.1 web-platform.test
|
||||
127.0.0.1 www.web-platform.test
|
||||
|
@ -43,11 +41,10 @@ def check_args(**kwargs):
|
|||
|
||||
|
||||
def browser_kwargs(**kwargs):
|
||||
return {
|
||||
"binary": kwargs["binary"],
|
||||
return {"binary": kwargs["binary"],
|
||||
"debug_info": kwargs["debug_info"],
|
||||
"user_stylesheets": kwargs.get("user_stylesheets"),
|
||||
}
|
||||
"render_backend": kwargs.get("servo_backend")}
|
||||
|
||||
|
||||
def executor_kwargs(test_type, server_config, cache_manager, run_info_data, **kwargs):
|
||||
|
@ -64,8 +61,12 @@ def env_options():
|
|||
"supports_debugger": True}
|
||||
|
||||
|
||||
def run_info_extras(**kwargs):
|
||||
return {"backend": kwargs["servo_backend"]}
|
||||
|
||||
|
||||
def update_properties():
|
||||
return ["debug", "os", "version", "processor", "bits"], None
|
||||
return ["debug", "os", "version", "processor", "bits", "backend"], None
|
||||
|
||||
|
||||
def make_hosts_file():
|
||||
|
@ -79,7 +80,7 @@ class ServoWebDriverBrowser(Browser):
|
|||
used_ports = set()
|
||||
|
||||
def __init__(self, logger, binary, debug_info=None, webdriver_host="127.0.0.1",
|
||||
user_stylesheets=None):
|
||||
user_stylesheets=None, render_backend="webrender"):
|
||||
Browser.__init__(self, logger)
|
||||
self.binary = binary
|
||||
self.webdriver_host = webdriver_host
|
||||
|
@ -89,6 +90,7 @@ class ServoWebDriverBrowser(Browser):
|
|||
self.hosts_path = make_hosts_file()
|
||||
self.command = None
|
||||
self.user_stylesheets = user_stylesheets if user_stylesheets else []
|
||||
self.render_backend = render_backend
|
||||
|
||||
def start(self):
|
||||
self.webdriver_port = get_free_port(4444, exclude=self.used_ports)
|
||||
|
@ -98,15 +100,11 @@ class ServoWebDriverBrowser(Browser):
|
|||
env["HOST_FILE"] = self.hosts_path
|
||||
env["RUST_BACKTRACE"] = "1"
|
||||
|
||||
debug_args, command = browser_command(
|
||||
self.binary,
|
||||
[
|
||||
"--hard-fail",
|
||||
debug_args, command = browser_command(self.binary,
|
||||
[render_arg(self.render_backend), "--hard-fail",
|
||||
"--webdriver", str(self.webdriver_port),
|
||||
"about:blank",
|
||||
],
|
||||
self.debug_info
|
||||
)
|
||||
"about:blank"],
|
||||
self.debug_info)
|
||||
|
||||
for stylesheet in self.user_stylesheets:
|
||||
command += ["--user-stylesheet", stylesheet]
|
||||
|
|
|
@ -38,8 +38,6 @@ def do_delayed_imports(logger, test_paths):
|
|||
|
||||
try:
|
||||
from tools.serve import serve
|
||||
except ImportError:
|
||||
from wpt_tools.serve import serve
|
||||
except ImportError:
|
||||
failed.append("serve")
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ from ..wpttest import WdspecResult, WdspecSubtestResult
|
|||
errors = None
|
||||
marionette = None
|
||||
pytestrunner = None
|
||||
webdriver = None
|
||||
|
||||
here = os.path.join(os.path.split(__file__)[0])
|
||||
|
||||
|
@ -269,22 +270,24 @@ class RemoteMarionetteProtocol(Protocol):
|
|||
def __init__(self, executor, browser):
|
||||
do_delayed_imports()
|
||||
Protocol.__init__(self, executor, browser)
|
||||
self.session = None
|
||||
self.webdriver_binary = executor.webdriver_binary
|
||||
self.capabilities = self.executor.capabilities
|
||||
self.session_config = None
|
||||
self.marionette_port = browser.marionette_port
|
||||
self.server = None
|
||||
|
||||
def setup(self, runner):
|
||||
"""Connect to browser via the Marionette HTTP server."""
|
||||
try:
|
||||
self.server = GeckoDriverServer(
|
||||
self.logger, binary=self.webdriver_binary)
|
||||
self.logger, self.marionette_port, binary=self.webdriver_binary)
|
||||
self.server.start(block=False)
|
||||
self.logger.info(
|
||||
"WebDriver HTTP server listening at %s" % self.server.url)
|
||||
self.session_config = {"host": self.server.host,
|
||||
"port": self.server.port,
|
||||
"capabilities": self.capabilities}
|
||||
|
||||
self.logger.info(
|
||||
"Establishing new WebDriver session with %s" % self.server.url)
|
||||
self.session = webdriver.Session(
|
||||
self.server.host, self.server.port, self.server.base_path)
|
||||
except Exception:
|
||||
self.logger.error(traceback.format_exc())
|
||||
self.executor.runner.send_message("init_failed")
|
||||
|
@ -292,6 +295,11 @@ class RemoteMarionetteProtocol(Protocol):
|
|||
self.executor.runner.send_message("init_succeeded")
|
||||
|
||||
def teardown(self):
|
||||
try:
|
||||
if self.session.session_id is not None:
|
||||
self.session.end()
|
||||
except Exception:
|
||||
pass
|
||||
if self.server is not None and self.server.is_alive:
|
||||
self.server.stop()
|
||||
|
||||
|
@ -552,14 +560,12 @@ class WdspecRun(object):
|
|||
|
||||
class MarionetteWdspecExecutor(WdspecExecutor):
|
||||
def __init__(self, browser, server_config, webdriver_binary,
|
||||
timeout_multiplier=1, close_after_done=True, debug_info=None,
|
||||
capabilities=None):
|
||||
timeout_multiplier=1, close_after_done=True, debug_info=None):
|
||||
self.do_delayed_imports()
|
||||
WdspecExecutor.__init__(self, browser, server_config,
|
||||
timeout_multiplier=timeout_multiplier,
|
||||
debug_info=debug_info)
|
||||
self.webdriver_binary = webdriver_binary
|
||||
self.capabilities = capabilities
|
||||
self.protocol = RemoteMarionetteProtocol(self, browser)
|
||||
|
||||
def is_alive(self):
|
||||
|
@ -572,7 +578,7 @@ class MarionetteWdspecExecutor(WdspecExecutor):
|
|||
timeout = test.timeout * self.timeout_multiplier + extra_timeout
|
||||
|
||||
success, data = WdspecRun(self.do_wdspec,
|
||||
self.protocol.session_config,
|
||||
self.protocol.session,
|
||||
test.abs_path,
|
||||
timeout).run()
|
||||
|
||||
|
@ -581,14 +587,13 @@ class MarionetteWdspecExecutor(WdspecExecutor):
|
|||
|
||||
return (test.result_cls(*data), [])
|
||||
|
||||
def do_wdspec(self, session_config, path, timeout):
|
||||
def do_wdspec(self, session, path, timeout):
|
||||
harness_result = ("OK", None)
|
||||
subtest_results = pytestrunner.run(path,
|
||||
self.server_config,
|
||||
session_config,
|
||||
timeout=timeout)
|
||||
subtest_results = pytestrunner.run(
|
||||
path, session, self.server_url, timeout=timeout)
|
||||
return (harness_result, subtest_results)
|
||||
|
||||
def do_delayed_imports(self):
|
||||
global pytestrunner
|
||||
global pytestrunner, webdriver
|
||||
from . import pytestrunner
|
||||
import webdriver
|
||||
|
|
|
@ -181,9 +181,8 @@ class SeleniumTestharnessExecutor(TestharnessExecutor):
|
|||
def is_alive(self):
|
||||
return self.protocol.is_alive()
|
||||
|
||||
def on_environment_change(self, new_environment):
|
||||
if new_environment["protocol"] != self.last_environment["protocol"]:
|
||||
self.protocol.load_runner(new_environment["protocol"])
|
||||
def on_protocol_change(self, new_protocol):
|
||||
self.protocol.load_runner(new_protocol)
|
||||
|
||||
def do_test(self, test):
|
||||
url = self.test_url(test)
|
||||
|
|
|
@ -30,10 +30,15 @@ from ..webdriver_server import ServoDriverServer
|
|||
from .executormarionette import WdspecRun
|
||||
|
||||
pytestrunner = None
|
||||
render_arg = None
|
||||
webdriver = None
|
||||
|
||||
extra_timeout = 5 # seconds
|
||||
|
||||
def do_delayed_imports():
|
||||
global render_arg
|
||||
from ..browsers.servo import render_arg
|
||||
|
||||
hosts_text = """127.0.0.1 web-platform.test
|
||||
127.0.0.1 www.web-platform.test
|
||||
127.0.0.1 www1.web-platform.test
|
||||
|
@ -75,10 +80,8 @@ class ServoTestharnessExecutor(ProcessTestExecutor):
|
|||
self.result_data = None
|
||||
self.result_flag = threading.Event()
|
||||
|
||||
args = [
|
||||
"--hard-fail", "-u", "Servo/wptrunner",
|
||||
"-Z", "replace-surrogates", "-z", self.test_url(test),
|
||||
]
|
||||
args = [render_arg(self.browser.render_backend), "--hard-fail", "-u", "Servo/wptrunner",
|
||||
"-Z", "replace-surrogates", "-z", self.test_url(test)]
|
||||
for stylesheet in self.browser.user_stylesheets:
|
||||
args += ["--user-stylesheet", stylesheet]
|
||||
for pref, value in test.environment.get('prefs', {}).iteritems():
|
||||
|
@ -210,12 +213,9 @@ class ServoRefTestExecutor(ProcessTestExecutor):
|
|||
with TempFilename(self.tempdir) as output_path:
|
||||
debug_args, command = browser_command(
|
||||
self.binary,
|
||||
[
|
||||
"--hard-fail", "--exit",
|
||||
"-u", "Servo/wptrunner",
|
||||
"-Z", "disable-text-aa,load-webfonts-synchronously,replace-surrogates",
|
||||
"--output=%s" % output_path, full_url
|
||||
] + self.browser.binary_args,
|
||||
[render_arg(self.browser.render_backend), "--hard-fail", "--exit",
|
||||
"-u", "Servo/wptrunner", "-Z", "disable-text-aa,load-webfonts-synchronously,replace-surrogates",
|
||||
"--output=%s" % output_path, full_url] + self.browser.binary_args,
|
||||
self.debug_info)
|
||||
|
||||
for stylesheet in self.browser.user_stylesheets:
|
||||
|
@ -295,7 +295,7 @@ class ServoWdspecProtocol(Protocol):
|
|||
|
||||
def setup(self, runner):
|
||||
try:
|
||||
self.server = ServoDriverServer(self.logger, binary=self.browser.binary, binary_args=self.browser.binary_args)
|
||||
self.server = ServoDriverServer(self.logger, binary=self.browser.binary, binary_args=self.browser.binary_args, render_backend=self.browser.render_backend)
|
||||
self.server.start(block=False)
|
||||
self.logger.info(
|
||||
"WebDriver HTTP server listening at %s" % self.server.url)
|
||||
|
|
|
@ -25,7 +25,7 @@ extra_timeout = 5
|
|||
|
||||
def do_delayed_imports():
|
||||
global webdriver
|
||||
import webdriver
|
||||
from tools import webdriver
|
||||
|
||||
|
||||
class ServoWebDriverProtocol(Protocol):
|
||||
|
|
|
@ -13,8 +13,6 @@ Usage::
|
|||
"""
|
||||
|
||||
import errno
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
|
@ -29,13 +27,14 @@ def do_delayed_imports():
|
|||
import pytest
|
||||
|
||||
|
||||
def run(path, server_config, session_config, timeout=0):
|
||||
def run(path, session, url_getter, timeout=0):
|
||||
"""Run Python test at ``path`` in pytest. The provided ``session``
|
||||
is exposed as a fixture available in the scope of the test functions.
|
||||
|
||||
:param path: Path to the test file.
|
||||
:param session_config: dictionary of host, port,capabilities parameters
|
||||
to pass through to the webdriver session
|
||||
:param session: WebDriver session to expose.
|
||||
:param url_getter: Function to get server url from test environment, given
|
||||
a protocol.
|
||||
:param timeout: Duration before interrupting potentially hanging
|
||||
tests. If 0, there is no timeout.
|
||||
|
||||
|
@ -47,13 +46,10 @@ def run(path, server_config, session_config, timeout=0):
|
|||
do_delayed_imports()
|
||||
|
||||
recorder = SubtestResultRecorder()
|
||||
|
||||
os.environ["WD_HOST"] = session_config["host"]
|
||||
os.environ["WD_PORT"] = str(session_config["port"])
|
||||
os.environ["WD_CAPABILITIES"] = json.dumps(session_config["capabilities"])
|
||||
os.environ["WD_SERVER_CONFIG"] = json.dumps(server_config)
|
||||
|
||||
plugins = [recorder]
|
||||
plugins = [recorder,
|
||||
fixtures,
|
||||
fixtures.Session(session),
|
||||
fixtures.Server(url_getter)]
|
||||
|
||||
# TODO(ato): Deal with timeouts
|
||||
|
||||
|
@ -96,9 +92,7 @@ class SubtestResultRecorder(object):
|
|||
self.record(report.nodeid, "ERROR", message, report.longrepr)
|
||||
|
||||
def record_skip(self, report):
|
||||
self.record(report.nodeid, "ERROR",
|
||||
"In-test skip decorators are disallowed, "
|
||||
"please use WPT metadata to ignore tests.")
|
||||
self.record(report.nodeid, "PASS")
|
||||
|
||||
def record(self, test, status, message=None, stack=None):
|
||||
if stack is not None:
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
callback = arguments[arguments.length - 1];
|
||||
|
||||
function check_done() {
|
||||
if (!document.documentElement.classList.contains('reftest-wait')) {
|
||||
if (!document.body.classList.contains('reftest-wait')) {
|
||||
callback();
|
||||
} else {
|
||||
setTimeout(check_done, 50);
|
||||
|
|
|
@ -24,19 +24,16 @@ class MockTest(object):
|
|||
|
||||
def make_mock_manifest(*items):
|
||||
rv = []
|
||||
for test_type, dir_path, num_tests in items:
|
||||
for dir_path, num_tests in items:
|
||||
for i in range(num_tests):
|
||||
rv.append((test_type,
|
||||
dir_path + "/%i.test" % i,
|
||||
set([MockTest(i)])))
|
||||
rv.append((dir_path + "/%i.test" % i, set([MockTest(i)])))
|
||||
return rv
|
||||
|
||||
|
||||
class TestEqualTimeChunker(unittest.TestCase):
|
||||
|
||||
def test_include_all(self):
|
||||
tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10),
|
||||
("test", "c", 10))
|
||||
tests = make_mock_manifest(("a", 10), ("a/b", 10), ("c", 10))
|
||||
|
||||
chunk_1 = list(EqualTimeChunker(3, 1)(tests))
|
||||
chunk_2 = list(EqualTimeChunker(3, 2)(tests))
|
||||
|
@ -47,8 +44,7 @@ class TestEqualTimeChunker(unittest.TestCase):
|
|||
self.assertEquals(tests[20:], chunk_3)
|
||||
|
||||
def test_include_all_1(self):
|
||||
tests = make_mock_manifest(("test", "a", 5), ("test", "a/b", 5),
|
||||
("test", "c", 10), ("test", "d", 10))
|
||||
tests = make_mock_manifest(("a", 5), ("a/b", 5), ("c", 10), ("d", 10))
|
||||
|
||||
chunk_1 = list(EqualTimeChunker(3, 1)(tests))
|
||||
chunk_2 = list(EqualTimeChunker(3, 2)(tests))
|
||||
|
@ -59,8 +55,7 @@ class TestEqualTimeChunker(unittest.TestCase):
|
|||
self.assertEquals(tests[20:], chunk_3)
|
||||
|
||||
def test_long(self):
|
||||
tests = make_mock_manifest(("test", "a", 100), ("test", "a/b", 1),
|
||||
("test", "c", 1))
|
||||
tests = make_mock_manifest(("a", 100), ("a/b", 1), ("c", 1))
|
||||
|
||||
chunk_1 = list(EqualTimeChunker(3, 1)(tests))
|
||||
chunk_2 = list(EqualTimeChunker(3, 2)(tests))
|
||||
|
@ -71,8 +66,7 @@ class TestEqualTimeChunker(unittest.TestCase):
|
|||
self.assertEquals(tests[101:102], chunk_3)
|
||||
|
||||
def test_long_1(self):
|
||||
tests = make_mock_manifest(("test", "a", 1), ("test", "a/b", 100),
|
||||
("test", "c", 1))
|
||||
tests = make_mock_manifest(("a", 1), ("a/b", 100), ("c", 1))
|
||||
|
||||
chunk_1 = list(EqualTimeChunker(3, 1)(tests))
|
||||
chunk_2 = list(EqualTimeChunker(3, 2)(tests))
|
||||
|
@ -84,8 +78,7 @@ class TestEqualTimeChunker(unittest.TestCase):
|
|||
|
||||
def test_too_few_dirs(self):
|
||||
with self.assertRaises(ValueError):
|
||||
tests = make_mock_manifest(("test", "a", 1), ("test", "a/b", 100),
|
||||
("test", "c", 1))
|
||||
tests = make_mock_manifest(("a", 1), ("a/b", 100), ("c", 1))
|
||||
list(EqualTimeChunker(4, 1)(tests))
|
||||
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ skip: true
|
|||
"""
|
||||
|
||||
def test_filter_unicode():
|
||||
tests = make_mock_manifest(("test", "a", 10), ("test", "a/b", 10),
|
||||
("test", "c", 10))
|
||||
tests = make_mock_manifest(("a", 10), ("a/b", 10), ("c", 10))
|
||||
|
||||
with tempfile.NamedTemporaryFile("wb", suffix=".ini") as f:
|
||||
f.write(include_ini.encode('utf-8'))
|
||||
|
|
|
@ -15,10 +15,7 @@ from state import State
|
|||
|
||||
def setup_paths(sync_path):
|
||||
sys.path.insert(0, os.path.abspath(sync_path))
|
||||
try:
|
||||
from tools import localpaths
|
||||
except ImportError:
|
||||
from wpt_tools import localpaths
|
||||
|
||||
class LoadConfig(Step):
|
||||
"""Step for loading configuration from the ini file and kwargs."""
|
||||
|
|
|
@ -28,10 +28,6 @@ class WebDriverServer(object):
|
|||
|
||||
def __init__(self, logger, binary, host="127.0.0.1", port=None,
|
||||
base_path="", env=None):
|
||||
if binary is None:
|
||||
raise ValueError("WebDriver server binary must be given "
|
||||
"to --webdriver-binary argument")
|
||||
|
||||
self.logger = logger
|
||||
self.binary = binary
|
||||
self.host = host
|
||||
|
@ -153,7 +149,7 @@ class EdgeDriverServer(WebDriverServer):
|
|||
|
||||
|
||||
class GeckoDriverServer(WebDriverServer):
|
||||
def __init__(self, logger, marionette_port=2828, binary="geckodriver",
|
||||
def __init__(self, logger, marionette_port=2828, binary="wires",
|
||||
host="127.0.0.1", port=None):
|
||||
env = os.environ.copy()
|
||||
env["RUST_BACKTRACE"] = "1"
|
||||
|
@ -162,17 +158,19 @@ class GeckoDriverServer(WebDriverServer):
|
|||
|
||||
def make_command(self):
|
||||
return [self.binary,
|
||||
"--connect-existing",
|
||||
"--marionette-port", str(self.marionette_port),
|
||||
"--host", self.host,
|
||||
"--port", str(self.port)]
|
||||
|
||||
|
||||
class ServoDriverServer(WebDriverServer):
|
||||
def __init__(self, logger, binary="servo", binary_args=None, host="127.0.0.1", port=None):
|
||||
def __init__(self, logger, binary="servo", binary_args=None, host="127.0.0.1", port=None, render_backend=None):
|
||||
env = os.environ.copy()
|
||||
env["RUST_BACKTRACE"] = "1"
|
||||
WebDriverServer.__init__(self, logger, binary, host=host, port=port, env=env)
|
||||
self.binary_args = binary_args
|
||||
self.render_backend = render_backend
|
||||
|
||||
def make_command(self):
|
||||
command = [self.binary,
|
||||
|
@ -181,6 +179,10 @@ class ServoDriverServer(WebDriverServer):
|
|||
"--headless"]
|
||||
if self.binary_args:
|
||||
command += self.binary_args
|
||||
if self.render_backend == "cpu":
|
||||
command += ["--cpu"]
|
||||
elif self.render_backend == "webrender":
|
||||
command += ["--webrender"]
|
||||
return command
|
||||
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ scheme host and port.""")
|
|||
type=abs_path, help="Binary to run tests against")
|
||||
config_group.add_argument('--binary-arg',
|
||||
default=[], action="append", dest="binary_args",
|
||||
help="Extra argument for the binary")
|
||||
help="Extra argument for the binary (servo)")
|
||||
config_group.add_argument("--webdriver-binary", action="store", metavar="BINARY",
|
||||
type=abs_path, help="WebDriver server binary to use")
|
||||
|
||||
|
@ -180,6 +180,9 @@ scheme host and port.""")
|
|||
servo_group.add_argument("--user-stylesheet",
|
||||
default=[], action="append", dest="user_stylesheets",
|
||||
help="Inject a user CSS stylesheet into every test.")
|
||||
servo_group.add_argument("--servo-backend",
|
||||
default="webrender", choices=["cpu", "webrender"],
|
||||
help="Rendering backend to use with Servo.")
|
||||
|
||||
|
||||
parser.add_argument("test_list", nargs="*",
|
||||
|
|
|
@ -15,7 +15,6 @@ import wptcommandline
|
|||
import wptlogging
|
||||
import wpttest
|
||||
from testrunner import ManagerGroup
|
||||
from browsers.base import NullBrowser
|
||||
|
||||
here = os.path.split(__file__)[0]
|
||||
|
||||
|
@ -116,7 +115,7 @@ def run_tests(config, test_paths, product, **kwargs):
|
|||
env.do_delayed_imports(logger, test_paths)
|
||||
|
||||
(check_args,
|
||||
target_browser_cls, get_browser_kwargs,
|
||||
browser_cls, get_browser_kwargs,
|
||||
executor_classes, get_executor_kwargs,
|
||||
env_options, run_info_extras) = products.load_product(config, product)
|
||||
|
||||
|
@ -178,16 +177,6 @@ def run_tests(config, test_paths, product, **kwargs):
|
|||
for test_type in kwargs["test_types"]:
|
||||
logger.info("Running %s tests" % test_type)
|
||||
|
||||
# WebDriver tests may create and destroy multiple browser
|
||||
# processes as part of their expected behavior. These
|
||||
# processes are managed by a WebDriver server binary. This
|
||||
# obviates the need for wptrunner to provide a browser, so
|
||||
# the NullBrowser is used in place of the "target" browser
|
||||
if test_type == "wdspec":
|
||||
browser_cls = NullBrowser
|
||||
else:
|
||||
browser_cls = target_browser_cls
|
||||
|
||||
for test in test_loader.disabled_tests[test_type]:
|
||||
logger.test_start(test.id)
|
||||
logger.test_end(test.id, status="SKIP")
|
||||
|
|
Загрузка…
Ссылка в новой задаче