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 user stylesheets

  • Loading branch information
SimonSapin committed Jul 19, 2018
commit d7495a22970c3a307879df559d9360fbf2d104e0
@@ -51,6 +51,8 @@ def main(avd_name, apk_path, *args):
wait_for_boot(adb)

check_call(adb + ["install", "-r", apk_path])
args = list(args)
write_user_stylesheets(adb, args)
write_args(adb, args)
check_call(adb + ["shell", "am start com.mozilla.servo/com.mozilla.servo.MainActivity"],
stdout=sys.stderr)
@@ -120,6 +122,15 @@ def write_args(adb, args):
check_call(adb + ["shell", "echo %s >> %s" % (shell_quote(arg), params_file)])


def write_user_stylesheets(adb, args):
data_dir = "/sdcard/Android/data/com.mozilla.servo/files"
check_call(adb + ["shell", "mkdir -p %s" % data_dir])
for i, (pos, path) in enumerate(extract_args("--user-stylesheet", args)):
remote_path = "%s/user%s.css" % (data_dir, i)
args[pos] = remote_path
check_call(adb + ["push", path, remote_path], stdout=sys.stderr)


def forward_webdriver(adb, args):
webdriver_port = extract_arg("--webdriver", args)
if webdriver_port is not None:
@@ -130,15 +141,20 @@ def forward_webdriver(adb, args):


def extract_arg(name, args):
for _, arg in extract_args(name, args):
return arg


def extract_args(name, args):
previous_arg_matches = False
for arg in args:
for i, arg in enumerate(args):
if previous_arg_matches:
return arg
yield i, arg
previous_arg_matches = arg == name


def wait_for_tcp_server(adb, port):
while call(adb + ["shell", "nc -z 127.0.0.1 %s" % port]) != 0:
while call(adb + ["shell", "nc -z 127.0.0.1 %s" % port], stdout=sys.stderr) != 0:
time.sleep(1)


ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.