Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit ab508a6

Browse files
Hexclesjgraham
authored andcommitted
Move ChromeAndroid to ExecutorWebDriver (#18186)
Fixes #16056 Docs changes: * Remove instructions for special setups that are no longer needed. * Document more existing limitations of the implementation.
1 parent e1498d5 commit ab508a6

File tree

4 files changed

+31
-51
lines changed

4 files changed

+31
-51
lines changed

docs/running-tests/chrome_android.md

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,22 @@
22

33
To run WPT on Chrome on an Android device, some additional set up is required.
44

5-
First of all, as usual Android development, we need to have `adb` and be able to
6-
connect to the device.
5+
As with usual Android development, you need to have `adb` and be able to
6+
connect to the device. Run `adb devices` to verify.
77

8-
## Hosts
8+
Currently, Android support is a prototype with some known issues:
99

10-
Until we find a better way, we need to root the Android device and update the
11-
/etc/hosts file to include the entries printed by `./wpt make-hosts-file`.
10+
* We install ChromeDriver corresponding to the Chrome version on your *host*,
11+
so you will need a special flag to bypass ChromeDriver's version check if the
12+
test device runs a different version of Chrome from your host.
13+
* The package name is hard coded. If you are testing a custom build, you will
14+
need to search and replace `com.android.chrome` in `tools/`.
15+
* We do not support reftests at the moment.
1216

13-
## CA certificate
17+
Note: rooting the device or installing a root CA is no longer required.
1418

15-
In order to run HTTPS tests, we need to add
16-
[WPT's CA](https://github.com/web-platform-tests/wpt/blob/master/tools/certs/cacert.pem)
17-
to the phone. First, convert the certificate from PEM to CRT:
19+
Example:
1820

19-
```
20-
openssl x509 -outform der -in tools/certs/cacert.pem -out cacert.crt
21-
```
22-
23-
Then copy `cacert.crt` to your phone's external storage (preferably to
24-
Downloads/ as it'll be easier to find). Open Settings -> Security & location ->
25-
Encryption & credentials -> Install from storage. Find and install `cacert.crt`.
26-
(The setting entries might be slightly different based your Android version.)
27-
28-
Note that having this CA installed on your device outside of a test
29-
environment represents a security risk.
30-
31-
32-
Finally, we may run wpt with the `chrome_android` product
33-
34-
```
35-
./wpt run chrome_android [test_list]
21+
```bash
22+
./wpt run --webdriver-arg=--disable-build-check --test-type=testharness chrome_android TESTS
3623
```

tools/wpt/browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ def find_webdriver(self, channel=None):
595595
return find_executable("chromedriver")
596596

597597
def install_webdriver(self, dest=None, channel=None, browser_binary=None):
598-
chrome = Chrome()
598+
chrome = Chrome(self.logger)
599599
return chrome.install_webdriver(dest, channel)
600600

601601
def version(self, binary=None, webdriver_binary=None):
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
mozprocess==1.0.0
2-
selenium==3.141.0

tools/wptrunner/wptrunner/browsers/chrome_android.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
from .base import Browser, ExecutorBrowser, require_arg
44
from .base import get_timeout_multiplier # noqa: F401
5+
from .chrome import executor_kwargs as chrome_executor_kwargs
56
from ..webdriver_server import ChromeDriverServer
6-
from ..executors import executor_kwargs as base_executor_kwargs
7-
from ..executors.executorselenium import (SeleniumTestharnessExecutor, # noqa: F401
8-
SeleniumRefTestExecutor) # noqa: F401
7+
from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401
8+
WebDriverRefTestExecutor) # noqa: F401
99
from ..executors.executorchrome import ChromeDriverWdspecExecutor # noqa: F401
1010

1111

1212
__wptrunner__ = {"product": "chrome_android",
1313
"check_args": "check_args",
1414
"browser": "ChromeAndroidBrowser",
15-
"executor": {"testharness": "SeleniumTestharnessExecutor",
16-
"reftest": "SeleniumRefTestExecutor",
15+
"executor": {"testharness": "WebDriverTestharnessExecutor",
16+
"reftest": "WebDriverRefTestExecutor",
1717
"wdspec": "ChromeDriverWdspecExecutor"},
1818
"browser_kwargs": "browser_kwargs",
1919
"executor_kwargs": "executor_kwargs",
@@ -36,31 +36,25 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):
3636

3737
def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
3838
**kwargs):
39-
from selenium.webdriver import DesiredCapabilities
40-
41-
# Use extend() to modify the global list in place.
39+
# Use update() to modify the global list in place.
4240
_wptserve_ports.update(set(
4341
server_config['ports']['http'] + server_config['ports']['https'] +
4442
server_config['ports']['ws'] + server_config['ports']['wss']
4543
))
4644

47-
executor_kwargs = base_executor_kwargs(test_type, server_config, cache_manager, run_info_data,
48-
**kwargs)
49-
executor_kwargs["close_after_done"] = True
50-
capabilities = dict(DesiredCapabilities.CHROME.items())
51-
capabilities["goog:chromeOptions"] = {}
52-
# TODO(chrome): browser_channel should be properly supported.
45+
executor_kwargs = chrome_executor_kwargs(test_type, server_config,
46+
cache_manager, run_info_data,
47+
**kwargs)
48+
del executor_kwargs["capabilities"]["goog:chromeOptions"]["prefs"]
49+
del executor_kwargs["capabilities"]["goog:chromeOptions"]["useAutomationExtension"]
50+
51+
# TODO(Hexcles): browser_channel should be properly supported.
5352
package_name = "com.android.chrome" # stable channel
5453
# Required to start on mobile
55-
capabilities["goog:chromeOptions"]["androidPackage"] = package_name
56-
57-
for (kwarg, capability) in [("binary", "binary"), ("binary_args", "args")]:
58-
if kwargs[kwarg] is not None:
59-
capabilities["goog:chromeOptions"][capability] = kwargs[kwarg]
60-
if test_type == "testharness":
61-
capabilities["useAutomationExtension"] = False
62-
capabilities["excludeSwitches"] = ["enable-automation"]
63-
executor_kwargs["capabilities"] = capabilities
54+
executor_kwargs["capabilities"]["goog:chromeOptions"]["androidPackage"] = \
55+
package_name
56+
# Map wptrunner args to chromeOptions.
57+
6458
return executor_kwargs
6559

6660

0 commit comments

Comments
 (0)