Skip to content

Commit

Permalink
Revert "Make testharness tests run in a top-level browsing context" (#…
Browse files Browse the repository at this point in the history
…14496)

This reverts commit 74522a2.

Fixes #14495.

Reopens #13418.
  • Loading branch information
foolip committed Dec 13, 2018
1 parent bc5122d commit 9377b49
Show file tree
Hide file tree
Showing 27 changed files with 273 additions and 365 deletions.
9 changes: 1 addition & 8 deletions tools/wptrunner/wptrunner/browsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def inherit(super_module, child_globals, product_name):
child_wptrunner["product"] = product_name

for k in ("check_args", "browser", "browser_kwargs", "executor_kwargs",
"env_extras", "env_options", "timeout_multiplier"):
"env_extras", "env_options"):
attr = super_wptrunner[k]
child_globals[attr] = getattr(super_module, attr)

Expand Down Expand Up @@ -57,13 +57,6 @@ def get_free_port(start_port, exclude=None):
finally:
s.close()


def get_timeout_multiplier(test_type, run_info_data, **kwargs):
if kwargs["timeout_multiplier"] is not None:
return kwargs["timeout_multiplier"]
return 1


def browser_command(binary, args, debug_info):
if debug_info:
if debug_info.requiresEscapedArgs:
Expand Down
8 changes: 1 addition & 7 deletions tools/wptrunner/wptrunner/browsers/chrome.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
Expand All @@ -16,8 +15,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier",}
"env_options": "env_options"}


def check_args(**kwargs):
Expand All @@ -36,7 +34,6 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
cache_manager, run_info_data,
**kwargs)
executor_kwargs["close_after_done"] = True
executor_kwargs["supports_eager_pageload"] = False

capabilities = {
"goog:chromeOptions": {
Expand All @@ -51,9 +48,6 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
}
}

if test_type == "testharness":
capabilities["pageLoadStrategy"] = "none"

for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
if kwargs[kwarg] is not None:
capabilities["goog:chromeOptions"][capability] = kwargs[kwarg]
Expand Down
4 changes: 1 addition & 3 deletions tools/wptrunner/wptrunner/browsers/chrome_android.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import subprocess

from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
Expand All @@ -18,8 +17,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier"}
"env_options": "env_options"}

_wptserve_ports = set()

Expand Down
12 changes: 1 addition & 11 deletions tools/wptrunner/wptrunner/browsers/edge.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier"}

"env_options": "env_options"}

def get_timeout_multiplier(test_type, run_info_data, **kwargs):
if kwargs["timeout_multiplier"] is not None:
Expand All @@ -25,19 +23,16 @@ def get_timeout_multiplier(test_type, run_info_data, **kwargs):
return 10
return 1


def check_args(**kwargs):
require_arg(kwargs, "webdriver_binary")


def browser_kwargs(test_type, run_info_data, config, **kwargs):
return {"webdriver_binary": kwargs["webdriver_binary"],
"webdriver_args": kwargs.get("webdriver_args"),
"timeout_multiplier": get_timeout_multiplier(test_type,
run_info_data,
**kwargs)}


def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
executor_kwargs = base_executor_kwargs(test_type, server_config,
Expand All @@ -47,19 +42,14 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
run_info_data,
**kwargs)
executor_kwargs["capabilities"] = {}
if test_type == "testharness":
executor_kwargs["capabilities"]["pageLoadStrategy"] = "eager"
return executor_kwargs


def env_extras(**kwargs):
return []


def env_options():
return {"supports_debugger": False}


class EdgeBrowser(Browser):
used_ports = set()
init_timeout = 60
Expand Down
4 changes: 1 addition & 3 deletions tools/wptrunner/wptrunner/browsers/fennec.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
"env_extras": "env_extras",
"env_options": "env_options",
"run_info_extras": "run_info_extras",
"update_properties": "update_properties",
"timeout_multiplier": "get_timeout_multiplier"}

"update_properties": "update_properties"}


def check_args(**kwargs):
Expand Down
5 changes: 1 addition & 4 deletions tools/wptrunner/wptrunner/browsers/firefox.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
"env_extras": "env_extras",
"env_options": "env_options",
"run_info_extras": "run_info_extras",
"update_properties": "update_properties",
"timeout_multiplier": "get_timeout_multiplier"}
"update_properties": "update_properties"}


def get_timeout_multiplier(test_type, run_info_data, **kwargs):
Expand Down Expand Up @@ -99,8 +98,6 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs)
executor_kwargs["e10s"] = run_info_data["e10s"]
capabilities = {}
if test_type == "testharness":
capabilities["pageLoadStrategy"] = "eager"
if test_type == "reftest":
executor_kwargs["reftest_internal"] = kwargs["reftest_internal"]
executor_kwargs["reftest_screenshot"] = kwargs["reftest_screenshot"]
Expand Down
4 changes: 1 addition & 3 deletions tools/wptrunner/wptrunner/browsers/ie.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..webdriver_server import InternetExplorerDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
Expand All @@ -15,8 +14,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier"}
"env_options": "env_options"}


def check_args(**kwargs):
Expand Down
4 changes: 1 addition & 3 deletions tools/wptrunner/wptrunner/browsers/opera.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..webdriver_server import OperaDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
Expand All @@ -16,8 +15,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier"}
"env_options": "env_options"}


def check_args(**kwargs):
Expand Down
6 changes: 1 addition & 5 deletions tools/wptrunner/wptrunner/browsers/safari.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..webdriver_server import SafariDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
Expand All @@ -16,8 +15,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier"}
"env_options": "env_options"}


def check_args(**kwargs):
Expand All @@ -35,8 +33,6 @@ def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
cache_manager, run_info_data, **kwargs)
executor_kwargs["close_after_done"] = True
executor_kwargs["capabilities"] = {}
if test_type == "testharness":
executor_kwargs["capabilities"]["pageLoadStrategy"] = "eager"
if kwargs["binary"] is not None:
raise ValueError("Safari doesn't support setting executable location")

Expand Down
4 changes: 1 addition & 3 deletions tools/wptrunner/wptrunner/browsers/sauce.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import requests

from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
SeleniumRefTestExecutor) # noqa: F401
Expand All @@ -33,8 +32,7 @@
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier"}
"env_options": "env_options"}


def get_capabilities(**kwargs):
Expand Down
2 changes: 0 additions & 2 deletions tools/wptrunner/wptrunner/browsers/servo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

from .base import NullBrowser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorservo import ServoTestharnessExecutor, ServoRefTestExecutor, ServoWdspecExecutor # noqa: F401

Expand All @@ -20,7 +19,6 @@
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier",
"update_properties": "update_properties",
}

Expand Down
2 changes: 0 additions & 2 deletions tools/wptrunner/wptrunner/browsers/servodriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from tools.serve.serve import make_hosts_file

from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor, # noqa: F401
ServoWebDriverRefTestExecutor) # noqa: F401
Expand All @@ -26,7 +25,6 @@
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"timeout_multiplier": "get_timeout_multiplier",
"update_properties": "update_properties",
}

Expand Down
4 changes: 1 addition & 3 deletions tools/wptrunner/wptrunner/browsers/webkit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .base import Browser, ExecutorBrowser, require_arg
from .base import get_timeout_multiplier # noqa: F401
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTestExecutor) # noqa: F401
Expand All @@ -17,8 +16,7 @@
"executor_kwargs": "executor_kwargs",
"env_extras": "env_extras",
"env_options": "env_options",
"run_info_extras": "run_info_extras",
"timeout_multiplier": "get_timeout_multiplier"}
"run_info_extras": "run_info_extras"}


def check_args(**kwargs):
Expand Down
8 changes: 2 additions & 6 deletions tools/wptrunner/wptrunner/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ class TestEnvironmentError(Exception):


class TestEnvironment(object):
def __init__(self, test_paths, testharness_timeout_multipler, pause_after_test, debug_info, options, ssl_config, env_extras):
def __init__(self, test_paths, pause_after_test, debug_info, options, ssl_config, env_extras):
"""Context manager that owns the test environment i.e. the http and
websockets servers"""
self.test_paths = test_paths
self.server = None
self.config_ctx = None
self.config = None
self.testharness_timeout_multipler = testharness_timeout_multipler
self.pause_after_test = pause_after_test
self.test_server_port = options.pop("test_server_port", True)
self.debug_info = debug_info
Expand Down Expand Up @@ -170,10 +169,7 @@ def get_routes(self):
for path, format_args, content_type, route in [
("testharness_runner.html", {}, "text/html", "/testharness_runner.html"),
(self.options.get("testharnessreport", "testharnessreport.js"),
{"output": self.pause_after_test,
"timeout_multiplier": self.testharness_timeout_multipler,
"explicit_timeout": "true" if self.debug_info is not None else "false"},
"text/javascript;charset=utf8",
{"output": self.pause_after_test}, "text/javascript;charset=utf8",
"/resources/testharnessreport.js")]:
path = os.path.normpath(os.path.join(here, path))
# Note that .headers. files don't apply to static routes, so we need to
Expand Down
2 changes: 1 addition & 1 deletion tools/wptrunner/wptrunner/executors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def __call__(self, result):
return callback(url, payload)

def process_complete(self, url, payload):
rv = [strip_server(url)] + payload
rv = [url] + payload
return True, rv

def process_action(self, url, payload):
Expand Down

0 comments on commit 9377b49

Please sign in to comment.