Auto merge of #22411 - jdm:fix-webdriver, r=SimonSapin

Make desktop webdriver WPT harness work

This change allows me to run `./mach test-wpt --product servodriver --no-pause-after-test tests/wpt/mozilla/tests/mozilla/DOMParser.html` successfully again.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22409
- [x] There are tests for these changes

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22411)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-12-11 13:03:52 -05:00 committed by GitHub
commit 92962de76c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 9 deletions

View file

@ -40,6 +40,7 @@ def browser_kwargs(test_type, run_info_data, config, **kwargs):
"debug_info": kwargs["debug_info"],
"server_config": config,
"user_stylesheets": kwargs.get("user_stylesheets"),
"headless": kwargs.get("headless"),
}
@ -75,7 +76,7 @@ class ServoWebDriverBrowser(Browser):
init_timeout = 300 # Large timeout for cases where we're booting an Android emulator
def __init__(self, logger, binary, debug_info=None, webdriver_host="127.0.0.1",
server_config=None, binary_args=None, user_stylesheets=None):
server_config=None, binary_args=None, user_stylesheets=None, headless=None):
Browser.__init__(self, logger)
self.binary = binary
self.binary_args = binary_args or []
@ -87,6 +88,8 @@ class ServoWebDriverBrowser(Browser):
self.server_ports = server_config.ports if server_config else {}
self.command = None
self.user_stylesheets = user_stylesheets if user_stylesheets else []
self.headless = headless if headless else False
self.ca_certificate_path = server_config.ssl_config["ca_cert_path"]
def start(self, **kwargs):
self.webdriver_port = get_free_port(4444, exclude=self.used_ports)
@ -112,6 +115,12 @@ class ServoWebDriverBrowser(Browser):
self.debug_info
)
if self.headless:
command += ["--headless"]
if self.ca_certificate_path:
command += ["--certificate-path", self.ca_certificate_path]
for stylesheet in self.user_stylesheets:
command += ["--user-stylesheet", stylesheet]