Skip to content

Commit

Permalink
Merge pull request #137 from SimonSapin/servo-user-stylesheets
Browse files Browse the repository at this point in the history
Add support for passing user stylesheets to Servo.
  • Loading branch information
jgraham committed Aug 5, 2015
2 parents 404f561 + 96c67da commit 71c7894
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
9 changes: 6 additions & 3 deletions wptrunner/browsers/servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def check_args(**kwargs):

def browser_kwargs(**kwargs):
return {"binary": kwargs["binary"],
"debug_info": kwargs["debug_info"]}
"debug_info": kwargs["debug_info"],
"user_stylesheets": kwargs.get("user_stylesheets")}


def executor_kwargs(test_type, server_config, cache_manager, run_info_data,
Expand All @@ -44,11 +45,13 @@ def env_options():


class ServoBrowser(NullBrowser):
def __init__(self, logger, binary, debug_info=None):
def __init__(self, logger, binary, debug_info=None, user_stylesheets=None):
NullBrowser.__init__(self, logger)
self.binary = binary
self.debug_info = debug_info
self.user_stylesheets = user_stylesheets or []

def executor_browser(self):
return ExecutorBrowser, {"binary": self.binary,
"debug_info": self.debug_info}
"debug_info": self.debug_info,
"user_stylesheets": self.user_stylesheets}
9 changes: 6 additions & 3 deletions wptrunner/executors/executorservo.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ def do_test(self, test):
self.result_data = None
self.result_flag = threading.Event()

debug_args, command = browser_command(self.binary,
["--cpu", "--hard-fail", "-u", "Servo/wptrunner", "-z", self.test_url(test)],
self.debug_info)
args = ["--cpu", "--hard-fail", "-u", "Servo/wptrunner", "-z", self.test_url(test)]
for stylesheet in self.browser.user_stylesheets:
args += ["--user-stylesheet", stylesheet]
debug_args, command = browser_command(self.binary, args, self.debug_info)

self.command = command

Expand Down Expand Up @@ -191,6 +192,8 @@ def screenshot(self, test):
self.command = [self.binary, "--cpu", "--hard-fail", "--exit",
"-u", "Servo/wptrunner", "-Z", "disable-text-aa",
"--output=%s" % output_path, full_url]
for stylesheet in self.browser.user_stylesheets:
self.command += ["--user-stylesheet", stylesheet]

env = os.environ.copy()
env["HOST_FILE"] = self.hosts_path
Expand Down
5 changes: 5 additions & 0 deletions wptrunner/wptcommandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def create_parser(product_choices=None):
b2g_group.add_argument("--b2g-no-backup", action="store_true", default=False,
help="Don't backup device before testrun with --product=b2g")

servo_group = parser.add_argument_group("Servo-specific")
servo_group.add_argument("--user-stylesheet",
default=[], action="append", dest="user_stylesheets",
help="Inject a user CSS stylesheet into every test.")

parser.add_argument("test_list", nargs="*",
help="List of URLs for tests to run, or paths including tests to run. "
"(equivalent to --include)")
Expand Down

0 comments on commit 71c7894

Please sign in to comment.