From 0c0ffefb480546714e08d6641617a907e84e3a63 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Sun, 12 Jan 2025 03:23:26 -0500 Subject: [PATCH] Enable wdspec and crashtest tests in servodriver. (#34955) Signed-off-by: Josh Matthews --- python/wpt/run.py | 2 +- tests/wpt/meta/MANIFEST.json | 4 ++-- .../wptrunner/browsers/servodriver.py | 6 +++++- .../executors/executorservodriver.py | 20 ++++++++++++++++++- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/python/wpt/run.py b/python/wpt/run.py index 127a7fafca4..8bac430496b 100644 --- a/python/wpt/run.py +++ b/python/wpt/run.py @@ -93,7 +93,7 @@ def run_tests(default_binary_path: str, **kwargs): if not kwargs.get("no_default_test_types"): test_types = { "servo": ["testharness", "reftest", "wdspec", "crashtest"], - "servodriver": ["testharness", "reftest"], + "servodriver": ["testharness", "reftest", "wdspec", "crashtest"], } product = kwargs.get("product") or "servo" kwargs["test_types"] = test_types[product] diff --git a/tests/wpt/meta/MANIFEST.json b/tests/wpt/meta/MANIFEST.json index 8d77aa5b816..6f66395b9ab 100644 --- a/tests/wpt/meta/MANIFEST.json +++ b/tests/wpt/meta/MANIFEST.json @@ -503811,7 +503811,7 @@ [] ], "servodriver.py": [ - "d3cc341babecb750ad55862997e52efcdc4c7491", + "f8f50537740eea0c169af68becd42c8bc22ae0f7", [] ], "webkit.py": [ @@ -503877,7 +503877,7 @@ [] ], "executorservodriver.py": [ - "41b8ed9ac1891edb7ec332c61923314f8b1e5f19", + "7e4aee5e7af7b9719b4ccb1f5a0a7c7cb3aa1653", [] ], "executorwebdriver.py": [ diff --git a/tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py b/tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py index d3cc341babe..f8f50537740 100644 --- a/tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py +++ b/tests/wpt/tests/tools/wptrunner/wptrunner/browsers/servodriver.py @@ -10,8 +10,10 @@ from .base import (WebDriverBrowser, get_free_port) from .base import get_timeout_multiplier # noqa: F401 from ..executors import executor_kwargs as base_executor_kwargs +from ..executors.base import WdspecExecutor # noqa: F401 from ..executors.executorservodriver import (ServoWebDriverTestharnessExecutor, # noqa: F401 - ServoWebDriverRefTestExecutor) # noqa: F401 + ServoWebDriverRefTestExecutor, # noqa: F401 + ServoWebDriverCrashtestExecutor) # noqa: F401 here = os.path.dirname(__file__) @@ -22,6 +24,8 @@ __wptrunner__ = { "executor": { "testharness": "ServoWebDriverTestharnessExecutor", "reftest": "ServoWebDriverRefTestExecutor", + "crashtest": "ServoWebDriverCrashtestExecutor", + "wdspec": "WdspecExecutor", }, "browser_kwargs": "browser_kwargs", "executor_kwargs": "executor_kwargs", diff --git a/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py b/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py index 41b8ed9ac18..7e4aee5e7af 100644 --- a/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py +++ b/tests/wpt/tests/tools/wptrunner/wptrunner/executors/executorservodriver.py @@ -2,7 +2,7 @@ import os -from .executorwebdriver import WebDriverProtocol, WebDriverTestharnessExecutor, WebDriverRefTestExecutor +from .executorwebdriver import WebDriverProtocol, WebDriverTestharnessExecutor, WebDriverRefTestExecutor, WebDriverCrashtestExecutor webdriver = None ServoCommandExtensions = None @@ -108,3 +108,21 @@ class ServoWebDriverRefTestExecutor(WebDriverRefTestExecutor): self.last_environment.get("prefs", {}), new_environment.get("prefs", {}) ) + + +class ServoWebDriverCrashtestExecutor(WebDriverCrashtestExecutor): + protocol_cls = ServoWebDriverProtocol + + def __init__(self, logger, browser, server_config, timeout_multiplier=1, + screenshot_cache=None, capabilities={}, debug_info=None, + **kwargs): + WebDriverCrashtestExecutor.__init__(self, logger, browser, server_config, + timeout_multiplier, screenshot_cache, + capabilities=capabilities, + debug_info=debug_info) + + def on_environment_change(self, new_environment): + self.protocol.webdriver.extension.change_prefs( + self.last_environment.get("prefs", {}), + new_environment.get("prefs", {}) + )