Created
October 19, 2022 08:37
-
-
Save linusg/933d5d5f17c92995b2f54ef80b302f72 to your computer and use it in GitHub Desktop.
SerenityOS Browser support in WPT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tools/wpt/browser.py b/tools/wpt/browser.py | |
index 66796a8968..6a581b0675 100644 | |
--- a/tools/wpt/browser.py | |
+++ b/tools/wpt/browser.py | |
@@ -2046,3 +2046,27 @@ class Epiphany(Browser): | |
# Tech Preview output looks like "Web 3.31.3-88-g97db4f40f" | |
return output.split()[1] | |
return None | |
+ | |
+class SerenityOSBrowser(Browser): | |
+ """SerenityOS Browser-specific interface.""" | |
+ | |
+ product = "serenityos_browser" | |
+ requirements = None | |
+ | |
+ def download(self, dest=None, channel=None, rename=None): | |
+ raise NotImplementedError | |
+ | |
+ def install(self, dest=None, channel=None): | |
+ raise NotImplementedError | |
+ | |
+ def find_binary(self, venv_path=None, channel=None): | |
+ raise NotImplementedError | |
+ | |
+ def find_webdriver(self, venv_path=None, channel=None): | |
+ return None | |
+ | |
+ def install_webdriver(self, dest=None, channel=None, browser_binary=None): | |
+ raise NotImplementedError | |
+ | |
+ def version(self, binary=None, webdriver_binary=None): | |
+ return None | |
diff --git a/tools/wpt/run.py b/tools/wpt/run.py | |
index 560cbe38fb..f177b67679 100644 | |
--- a/tools/wpt/run.py | |
+++ b/tools/wpt/run.py | |
@@ -725,6 +725,17 @@ class Epiphany(BrowserSetup): | |
kwargs["webdriver_binary"] = webdriver_binary | |
+class SerenityOSBrowser(BrowserSetup): | |
+ name = "serenityos_browser" | |
+ browser_cls = browser.SerenityOSBrowser | |
+ | |
+ def install(self, channel=None): | |
+ raise NotImplementedError | |
+ | |
+ def setup_kwargs(self, kwargs): | |
+ pass | |
+ | |
+ | |
product_setup = { | |
"android_weblayer": AndroidWeblayer, | |
"android_webview": AndroidWebview, | |
@@ -747,6 +758,7 @@ product_setup = { | |
"webkit": WebKit, | |
"webkitgtk_minibrowser": WebKitGTKMiniBrowser, | |
"epiphany": Epiphany, | |
+ "serenityos_browser": SerenityOSBrowser, | |
} | |
diff --git a/tools/wptrunner/wptrunner/browsers/__init__.py b/tools/wptrunner/wptrunner/browsers/__init__.py | |
index b2a53ca23a..88aff48d31 100644 | |
--- a/tools/wptrunner/wptrunner/browsers/__init__.py | |
+++ b/tools/wptrunner/wptrunner/browsers/__init__.py | |
@@ -42,4 +42,5 @@ product_list = ["android_weblayer", | |
"opera", | |
"webkit", | |
"webkitgtk_minibrowser", | |
- "epiphany"] | |
+ "epiphany", | |
+ "serenityos_browser"] | |
diff --git a/tools/wptrunner/wptrunner/browsers/serenityos_browser.py b/tools/wptrunner/wptrunner/browsers/serenityos_browser.py | |
new file mode 100644 | |
index 0000000000..357b4166a2 | |
--- /dev/null | |
+++ b/tools/wptrunner/wptrunner/browsers/serenityos_browser.py | |
@@ -0,0 +1,55 @@ | |
+# mypy: allow-untyped-defs | |
+ | |
+from .base import (WebDriverBrowser, | |
+ get_timeout_multiplier, # noqa: F401 | |
+ maybe_add_args) | |
+from ..executors import executor_kwargs as base_executor_kwargs | |
+from ..executors.base import WdspecExecutor # noqa: F401 | |
+from ..executors.executorwebdriver import (WebDriverTestharnessExecutor, # noqa: F401 | |
+ WebDriverRefTestExecutor, # noqa: F401 | |
+ WebDriverCrashtestExecutor) # noqa: F401 | |
+ | |
+__wptrunner__ = {"product": "serenityos_browser", | |
+ "check_args": "check_args", | |
+ "browser": "WebDriverBrowser", | |
+ "browser_kwargs": "browser_kwargs", | |
+ "executor": {"testharness": "WebDriverTestharnessExecutor", | |
+ "reftest": "WebDriverRefTestExecutor", | |
+ "wdspec": "WdspecExecutor", | |
+ "crashtest": "WebDriverCrashtestExecutor"}, | |
+ "executor_kwargs": "executor_kwargs", | |
+ "env_extras": "env_extras", | |
+ "env_options": "env_options", | |
+ "run_info_extras": "run_info_extras", | |
+ "timeout_multiplier": "get_timeout_multiplier"} | |
+ | |
+def check_args(**kwargs): | |
+ pass | |
+ | |
+ | |
+def browser_kwargs(logger, test_type, run_info_data, config, **kwargs): | |
+ return {"webdriver_binary": "true", "port": 8000} | |
+ | |
+ | |
+def capabilities(server_config, **kwargs): | |
+ return {} | |
+ | |
+ | |
+def executor_kwargs(logger, test_type, test_environment, run_info_data, | |
+ **kwargs): | |
+ executor_kwargs = base_executor_kwargs(test_type, test_environment, run_info_data, **kwargs) | |
+ executor_kwargs["close_after_done"] = True | |
+ executor_kwargs["capabilities"] = capabilities(test_environment.config, **kwargs) | |
+ return executor_kwargs | |
+ | |
+ | |
+def env_extras(**kwargs): | |
+ return [] | |
+ | |
+ | |
+def env_options(): | |
+ return {} | |
+ | |
+ | |
+def run_info_extras(**kwargs): | |
+ return {} | |
diff --git a/tools/wptrunner/wptrunner/executors/executorwebdriver.py b/tools/wptrunner/wptrunner/executors/executorwebdriver.py | |
index e3cbb95f2e..e600f31fa2 100644 | |
--- a/tools/wptrunner/wptrunner/executors/executorwebdriver.py | |
+++ b/tools/wptrunner/wptrunner/executors/executorwebdriver.py | |
@@ -136,6 +136,9 @@ class WebDriverTestharnessProtocolPart(TestharnessProtocolPart): | |
:param timeout: The time in seconds to wait for the window to appear. This is because in | |
some implementations there's a race between calling window.open and the | |
window being added to the list of WebDriver accessible windows.""" | |
+ # FIXME: I stubbed out window.open() to return the parent window, obviously needs more work | |
+ return parent | |
+ | |
test_window = None | |
end_time = time.time() + timeout | |
while time.time() < end_time: | |
diff --git a/wpt b/wpt | |
index b0e415d844..fd1e3ab5a1 100755 | |
--- a/wpt | |
+++ b/wpt | |
@@ -1,3 +1,4 @@ | |
+#!/var/home/linus/Dev/wpt/_venv3/bin/python | |
#!/usr/bin/env python3 | |
if __name__ == "__main__": |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment