summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html')
-rw-r--r--testing/web-platform/tests/window-placement/fullscreen-companion-window-manual.tentative.https.html76
1 files changed, 76 insertions, 0 deletions
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 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<meta name="timeout" content="long">
+<!-- user agents are not required to support open features other than `noopener`
+ and on some platforms position and size features don't make sense -->
+<meta name="flags" content="may">
+<title>Multi-Screen Window Management test: Fullscreen Companion Window</title>
+<link rel="help" href="https://w3c.github.io/window-placement/">
+This test uses multi-screen details to request fullscreen and open a pop-up<br>
+(companion window) in the same user activation.<br>
+It runs manually with `wpt serve` and a compatible browser.<br><br>
+<button id="setUpButton">Request screen details</button>
+<ul id="popupButtons"></ul>
+<button id="cleanUpButton">Close any open popups</button><br>
+<input id="autoCleanUp" type="checkbox" checked=true>Auto-close popups</input>
+<ul id="logger"></ul>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/resources/testdriver.js"></script>
+<script src="/resources/testdriver-vendor.js"></script>
+<script src="resources/helpers.js"></script>
+
+<script>
+'use strict';
+let popups = [];
+
+cleanUpButton.addEventListener('click', async () => {
+ popups.forEach(p => p.close());
+});
+
+// expectPopup should be true if the test should expect the pop-up to be
+// created, or false if the popup is not expected to be created (blocked).
+async function testPopupOnScreen(popupTest, screen, expectPopup) {
+ // Show a popup child window on the associated screen.
+ const left = screen.availLeft + Math.floor(screen.availWidth / 2) - 150;
+ const top = screen.availTop + Math.floor(screen.availHeight / 2) - 50;
+ log(`Opening a popup on '${screen.label}' at (${left}, ${top})`);
+ let popup = window.open(
+ '/resources/blank.html', '',
+ `left=${left},top=${top},width=300,height=100`);
+ assert_equals(!!popup, expectPopup, 'Popup reference');
+ if (popup === null)
+ return;
+ assert_equals(!popup.closed, expectPopup, 'Popup open');
+ popups.push(popup);
+ if (autoCleanUp.checked) {
+ // TODO(crbug.com/1338645): Remove this workaround (delay) after browser code is
+ // fixed.
+ popupTest.add_cleanup(()=>{
+ setTimeout(popup.close, 1000);
+ });
+ }
+}
+
+promise_test(async setUpTest => {
+ await setUpWindowManagement(setUpTest, setUpButton);
+ const screenDetails = await getScreenDetails();
+ assert_true(!!screenDetails, 'Error getting screen details');
+ for (const [i, fullscreenScreen] of screenDetails.screens.entries()) {
+ const popupScreen =
+ screenDetails.screens[(i + 1) % screenDetails.screens.length];
+ let testName =
+ `Fullscreen on '${fullscreenScreen.label}' and open popup on '${popupScreen.label}'`;
+ promise_test(async popupTest => {
+ await addTestTriggerButtonAndAwaitClick(popupButtons,
+ testName,
+ popupTest);
+ await document.documentElement.requestFullscreen(
+ { screen: fullscreenScreen }
+ );
+ await testPopupOnScreen(popupTest, popupScreen,
+ /*expectPopup=*/screenDetails.screens.length > 1);
+ }, testName);
+ }
+}, 'Use multi-screen details to request fullscreen and open a pop-up in the same user activation.');
+</script>