Skip to content

Commit

Permalink
Make wptrunner chrome always use the WebDriver executor
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnedders committed Sep 25, 2018
1 parent 1e7408f commit 191b0ba
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 87 deletions.
4 changes: 2 additions & 2 deletions tools/ci/ci_wptrunner_infrastructure.sh
Expand Up @@ -18,14 +18,14 @@ test_infrastructure() {
}

main() {
PRODUCTS=( "firefox" "chrome" "chrome_webdriver" )
PRODUCTS=( "firefox" "chrome" )
for PRODUCT in "${PRODUCTS[@]}"; do
if [ "$PRODUCT" != "firefox" ]; then
# Firefox is expected to work using pref settings for DNS
# Don't adjust the hostnames in that case to ensure this keeps working
hosts_fixup
fi
if [[ "$PRODUCT" == "chrome"* ]]; then
if [[ "$PRODUCT" == "chrome" ]]; then
install_chrome unstable
test_infrastructure "--binary=$(which google-chrome-unstable)"
else
Expand Down
7 changes: 0 additions & 7 deletions tools/wpt/browser.py
Expand Up @@ -499,13 +499,6 @@ def install_webdriver(self, dest=None, channel=None):
def version(self, binary):
return None

class ChromeWebDriver(Chrome):
"""Chrome-specific interface for chrome without using selenium.
Includes webdriver installation.
"""
product = "chrome_webdriver"

class Opera(Browser):
"""Opera-specific interface.
Expand Down
6 changes: 0 additions & 6 deletions tools/wpt/run.py
Expand Up @@ -292,11 +292,6 @@ def setup_kwargs(self, kwargs):
raise WptrunError("Unable to locate or install chromedriver binary")


class ChromeWebDriver(Chrome):
name = "chrome_webdriver"
browser_cls = browser.ChromeWebDriver


class Opera(BrowserSetup):
name = "opera"
browser_cls = browser.Opera
Expand Down Expand Up @@ -435,7 +430,6 @@ def setup_kwargs(self, kwargs):
"firefox": Firefox,
"chrome": Chrome,
"chrome_android": ChromeAndroid,
"chrome_webdriver": ChromeWebDriver,
"edge": Edge,
"edge_webdriver": EdgeWebDriver,
"ie": InternetExplorer,
Expand Down
1 change: 0 additions & 1 deletion tools/wptrunner/wptrunner/browsers/__init__.py
Expand Up @@ -24,7 +24,6 @@

product_list = ["chrome",
"chrome_android",
"chrome_webdriver",
"edge",
"edge_webdriver",
"fennec",
Expand Down
37 changes: 23 additions & 14 deletions tools/wptrunner/wptrunner/browsers/chrome.py
@@ -1,16 +1,16 @@
from .base import Browser, ExecutorBrowser, require_arg
from ..webdriver_server import ChromeDriverServer
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
SeleniumRefTestExecutor) # noqa: F401
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
WebDriverRefTestExecutor) # noqa: F401
from ..executors.executorchrome import ChromeDriverWdspecExecutor # noqa: F401


__wptrunner__ = {"product": "chrome",
"check_args": "check_args",
"browser": "ChromeBrowser",
"executor": {"testharness": "SeleniumTestharnessExecutor",
"reftest": "SeleniumRefTestExecutor",
"executor": {"testharness": "WebDriverTestharnessExecutor",
"reftest": "WebDriverRefTestExecutor",
"wdspec": "ChromeDriverWdspecExecutor"},
"browser_kwargs": "browser_kwargs",
"executor_kwargs": "executor_kwargs",
Expand All @@ -30,34 +30,43 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):

def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
**kwargs):
from selenium.webdriver import DesiredCapabilities

executor_kwargs = base_executor_kwargs(test_type, server_config,
cache_manager, run_info_data,
**kwargs)
executor_kwargs["close_after_done"] = True
capabilities = dict(DesiredCapabilities.CHROME.items())
capabilities.setdefault("goog:chromeOptions", {})["prefs"] = {
"profile": {
"default_content_setting_values": {
"popups": 1
}

capabilities = {
"browserName": "chrome",
"platform": "ANY",
"version": "",
"goog:chromeOptions": {
"prefs": {
"profile": {
"default_content_setting_values": {
"popups": 1
}
}
},
"w3c": True
}
}

for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
if kwargs[kwarg] is not None:
capabilities["goog:chromeOptions"][capability] = kwargs[kwarg]

if kwargs["headless"]:
if "args" not in capabilities["goog:chromeOptions"]:
capabilities["goog:chromeOptions"]["args"] = []
if "--headless" not in capabilities["goog:chromeOptions"]["args"]:
capabilities["goog:chromeOptions"]["args"].append("--headless")

if test_type == "testharness":
capabilities["goog:chromeOptions"]["useAutomationExtension"] = False
capabilities["goog:chromeOptions"]["excludeSwitches"] = ["enable-automation"]
if test_type == "wdspec":
capabilities["goog:chromeOptions"]["w3c"] = True

executor_kwargs["capabilities"] = capabilities

return executor_kwargs


Expand Down
56 changes: 0 additions & 56 deletions tools/wptrunner/wptrunner/browsers/chrome_webdriver.py

This file was deleted.

2 changes: 1 addition & 1 deletion tools/wptrunner/wptrunner/tests/base.py
Expand Up @@ -17,7 +17,7 @@
current_tox_env_split = os.environ["CURRENT_TOX_ENV"].split("-")

tox_env_extra_browsers = {
"chrome": {"chrome_android", "chrome_webdriver"},
"chrome": {"chrome_android"},
"edge": {"edge_webdriver"},
"safari": {"safari_webdriver"},
"servo": {"servodriver"},
Expand Down

0 comments on commit 191b0ba

Please sign in to comment.