From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../web-platform/tests/window-placement/META.yml | 4 + .../web-platform/tests/window-placement/README.md | 5 + ...en-companion-window-manual.tentative.https.html | 76 ++++++++++++++ ...i-screen-fullscreen-manual.tentative.https.html | 116 +++++++++++++++++++++ .../multi-screen-window-open.tentative.https.html | 99 ++++++++++++++++++ .../tests/window-placement/resources/helpers.js | 68 ++++++++++++ 6 files changed, 368 insertions(+) create mode 100644 testing/web-platform/tests/window-placement/META.yml create mode 100644 testing/web-platform/tests/window-placement/README.md create mode 100644 testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html create mode 100644 testing/web-platform/tests/window-placement/multi-screen-fullscreen-manual.tentative.https.html create mode 100644 testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html create mode 100644 testing/web-platform/tests/window-placement/resources/helpers.js (limited to 'testing/web-platform/tests/window-placement') diff --git a/testing/web-platform/tests/window-placement/META.yml b/testing/web-platform/tests/window-placement/META.yml new file mode 100644 index 0000000000..2c6d60f4e7 --- /dev/null +++ b/testing/web-platform/tests/window-placement/META.yml @@ -0,0 +1,4 @@ +spec: https://w3c.github.io/window-placement/ +suggested_reviewers: + - michaelwasserman + - bradtriebwasser diff --git a/testing/web-platform/tests/window-placement/README.md b/testing/web-platform/tests/window-placement/README.md new file mode 100644 index 0000000000..d9e324c911 --- /dev/null +++ b/testing/web-platform/tests/window-placement/README.md @@ -0,0 +1,5 @@ +# Window Management Testing + +[Window Management Specification](https://w3c.github.io/window-placement/) + +The tests in this directory require at least 2 displays on the host machine to yield meaningful results. A well-supported configuration is 2 displays at 1920x1080 resolution arranged horizonally (primary on the left, secondary on the right). diff --git a/testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html b/testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html new file mode 100644 index 0000000000..10f30a1906 --- /dev/null +++ b/testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html @@ -0,0 +1,76 @@ + + + + + +Multi-Screen Window Management test: Fullscreen Companion Window + +This test uses multi-screen details to request fullscreen and open a pop-up
+(companion window) in the same user activation.
+It runs manually with `wpt serve` and a compatible browser.

+ + +
+Auto-close popups + + + + + + + + diff --git a/testing/web-platform/tests/window-placement/multi-screen-fullscreen-manual.tentative.https.html b/testing/web-platform/tests/window-placement/multi-screen-fullscreen-manual.tentative.https.html new file mode 100644 index 0000000000..620cd6e507 --- /dev/null +++ b/testing/web-platform/tests/window-placement/multi-screen-fullscreen-manual.tentative.https.html @@ -0,0 +1,116 @@ + + + +Multi-Screen Window Placement test: element.requestFullscreen() + +This test uses multi-screen details to request fullscreen on different +displays and swap between them.
+It runs manually with `wpt serve` and a compatible browser.

+ + + + + + + + + + diff --git a/testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html b/testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html new file mode 100644 index 0000000000..c453107d56 --- /dev/null +++ b/testing/web-platform/tests/window-placement/multi-screen-window-open.tentative.https.html @@ -0,0 +1,99 @@ + + + + + +Multi-Screen Window Management test: window.open() + +This test uses multi-screen details to open a popup window on each screen.
+It runs automated or manually with `wpt serve` and a compatible browser.

+ + +
+Auto-close popups + + + + + + + + diff --git a/testing/web-platform/tests/window-placement/resources/helpers.js b/testing/web-platform/tests/window-placement/resources/helpers.js new file mode 100644 index 0000000000..92442f9133 --- /dev/null +++ b/testing/web-platform/tests/window-placement/resources/helpers.js @@ -0,0 +1,68 @@ + +// Logs (appends) an HTML string to a logger element in a list format. +// An element in the document with id "logger" will be used as the log +// container. +function log(str) { + const entry = document.createElement('li'); + entry.innerHTML = str; + const loggerElement = document.getElementById('logger'); + loggerElement.appendChild(entry); + return entry; +} + +// Common setup for window management tests. Performs some basic assertions, and +// then waits for a click on the `setUpButton` element (for manual tests). +// Example usage: +// promise_test(async setUpTest => { +// await setUpWindowManagement(setUpTest, setUpButton); +// ... +// }); +async function setUpWindowManagement(setUpTest, setUpButton) { + assert_true( + 'getScreenDetails' in self && 'isExtended' in screen, + `API not supported; use Chromium (not content_shell) and enable + chrome://flags/#enable-experimental-web-platform-features`); + if (!screen.isExtended) + log(`WARNING: Use multiple screens for full test coverage`); + if (window.location.href.startsWith('file')) + log(`WARNING: Run via 'wpt serve'; file URLs lack permission support`); + + try { // Support manual testing where test_driver is not running. + await test_driver.set_permission({ name: 'window-management' }, 'granted'); + } catch { + } + const setUpWatcher = new EventWatcher(setUpTest, setUpButton, ['click']); + const setUpClick = setUpWatcher.wait_for('click'); + try { // Support manual testing where test_driver is not running. + await test_driver.click(setUpButton); + } catch { + } + await setUpClick; + setUpButton.disabled = true; +} + + +// Adds a button to the given `buttonContainer` element with the contents of +// `name`. Attaches an event watcher to the given test and waits for a signal +// from the test driver to click the button. If no test driver is available +// (manual testing) then awaits an actual click from the user instead. If +// `disableOnClick` is true, the button will also be disabled after it is +// clicked. +async function addTestTriggerButtonAndAwaitClick(buttonContainer, name, test) { + const button = document.createElement('button'); + button.innerHTML = name; + const entry = document.createElement('li'); + entry.appendChild(button); + buttonContainer.appendChild(entry); + const testWatcher = new EventWatcher(test, button, ['click']); + const buttonClick = testWatcher.wait_for('click'); + // Disable the button when it is clicked. + button.onclick = function() { + button.disabled = true; + }; + try { // Support manual testing where test_driver is not running. + await test_driver.click(button); + } catch { + } + await buttonClick; +} -- cgit v1.2.3