Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some support for WPT tests in an Android emulator through WebDriver #21213

Merged
merged 15 commits into from Jul 21, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

run_in_headless_android_emulator: add support for reverse port forwar…

…ding
  • Loading branch information
SimonSapin committed Jul 19, 2018
commit 94d1acbcfd7939f8ed62f62fb7e7cf7cd3ee4a35
@@ -139,6 +139,14 @@ def forward_webdriver(adb, args):
check_call(adb + ["forward", port, port])
sys.stderr.write("Forwarding WebDriver port %s to the emulator\n" % webdriver_port)

split = os.environ.get("EMULATOR_REVERSE_FORWARD_PORTS", "").split(",")
ports = [int(part) for part in split if part]
for port in ports:
port = "tcp:%s" % port
check_call(adb + ["reverse", port, port])
if ports:
sys.stderr.write("Reverse-forwarding ports %s\n" % ", ".join(map(str, ports)))


def extract_arg(name, args):
for _, arg in extract_args(name, args):
@@ -84,6 +84,7 @@ def __init__(self, logger, binary, debug_info=None, webdriver_host="127.0.0.1",
self.proc = None
self.debug_info = debug_info
self.hosts_path = write_hosts_file(server_config)
self.server_ports = server_config.ports if server_config else {}
self.command = None
self.user_stylesheets = user_stylesheets if user_stylesheets else []

@@ -94,6 +95,11 @@ def start(self, **kwargs):
env = os.environ.copy()
env["HOST_FILE"] = self.hosts_path
env["RUST_BACKTRACE"] = "1"
env["EMULATOR_REVERSE_FORWARD_PORTS"] = ",".join(
str(port)
for _protocol, ports in self.server_ports.items()
for port in ports
)

debug_args, command = browser_command(
self.binary,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.