From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../web-platform/tests/screen-orientation/META.yml | 6 ++ .../tests/screen-orientation/active-lock.html | 55 ++++++++++ .../screen-orientation/event-before-promise.html | 26 +++++ .../fullscreen-interactions.html | 45 ++++++++ .../tests/screen-orientation/hidden_document.html | 71 ++++++++++++ .../tests/screen-orientation/idlharness.window.js | 17 +++ .../screen-orientation/lock-bad-argument.html | 26 +++++ .../tests/screen-orientation/lock-basic.html | 76 +++++++++++++ .../screen-orientation/lock-sandboxed-iframe.html | 59 ++++++++++ .../screen-orientation/lock-unlock-check.html | 53 +++++++++ .../tests/screen-orientation/nested-documents.html | 83 ++++++++++++++ .../tests/screen-orientation/non-fully-active.html | 53 +++++++++ .../onchange-event-subframe.html | 90 ++++++++++++++++ .../tests/screen-orientation/onchange-event.html | 45 ++++++++ .../screen-orientation/orientation-reading.html | 119 +++++++++++++++++++++ .../screen-orientation/page-visibility-manual.html | 110 +++++++++++++++++++ .../tests/screen-orientation/resources/empty.html | 1 + .../iframe-listen-orientation-change.html | 9 ++ .../screen-orientation/resources/nav_iframe.html | 18 ++++ .../resources/orientation-utils.js | 52 +++++++++ .../resources/sandboxed-iframe-locking.html | 32 ++++++ .../tests/screen-orientation/unlock.html | 56 ++++++++++ 22 files changed, 1102 insertions(+) create mode 100644 testing/web-platform/tests/screen-orientation/META.yml create mode 100644 testing/web-platform/tests/screen-orientation/active-lock.html create mode 100644 testing/web-platform/tests/screen-orientation/event-before-promise.html create mode 100644 testing/web-platform/tests/screen-orientation/fullscreen-interactions.html create mode 100644 testing/web-platform/tests/screen-orientation/hidden_document.html create mode 100644 testing/web-platform/tests/screen-orientation/idlharness.window.js create mode 100644 testing/web-platform/tests/screen-orientation/lock-bad-argument.html create mode 100644 testing/web-platform/tests/screen-orientation/lock-basic.html create mode 100644 testing/web-platform/tests/screen-orientation/lock-sandboxed-iframe.html create mode 100644 testing/web-platform/tests/screen-orientation/lock-unlock-check.html create mode 100644 testing/web-platform/tests/screen-orientation/nested-documents.html create mode 100644 testing/web-platform/tests/screen-orientation/non-fully-active.html create mode 100644 testing/web-platform/tests/screen-orientation/onchange-event-subframe.html create mode 100644 testing/web-platform/tests/screen-orientation/onchange-event.html create mode 100644 testing/web-platform/tests/screen-orientation/orientation-reading.html create mode 100644 testing/web-platform/tests/screen-orientation/page-visibility-manual.html create mode 100644 testing/web-platform/tests/screen-orientation/resources/empty.html create mode 100644 testing/web-platform/tests/screen-orientation/resources/iframe-listen-orientation-change.html create mode 100644 testing/web-platform/tests/screen-orientation/resources/nav_iframe.html create mode 100644 testing/web-platform/tests/screen-orientation/resources/orientation-utils.js create mode 100644 testing/web-platform/tests/screen-orientation/resources/sandboxed-iframe-locking.html create mode 100644 testing/web-platform/tests/screen-orientation/unlock.html (limited to 'testing/web-platform/tests/screen-orientation') diff --git a/testing/web-platform/tests/screen-orientation/META.yml b/testing/web-platform/tests/screen-orientation/META.yml new file mode 100644 index 0000000000..633c917b0e --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/META.yml @@ -0,0 +1,6 @@ +spec: https://w3c.github.io/screen-orientation/ +suggested_reviewers: + - marcoscaceres + - cdumez + - michaelwasserman + - makotokato diff --git a/testing/web-platform/tests/screen-orientation/active-lock.html b/testing/web-platform/tests/screen-orientation/active-lock.html new file mode 100644 index 0000000000..72d2d7fc1d --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/active-lock.html @@ -0,0 +1,55 @@ + + + + + + + + +

+ fragment + + diff --git a/testing/web-platform/tests/screen-orientation/event-before-promise.html b/testing/web-platform/tests/screen-orientation/event-before-promise.html new file mode 100644 index 0000000000..56be4379ac --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/event-before-promise.html @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/fullscreen-interactions.html b/testing/web-platform/tests/screen-orientation/fullscreen-interactions.html new file mode 100644 index 0000000000..b1ac1c7000 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/fullscreen-interactions.html @@ -0,0 +1,45 @@ + + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/hidden_document.html b/testing/web-platform/tests/screen-orientation/hidden_document.html new file mode 100644 index 0000000000..6ff78ea866 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/hidden_document.html @@ -0,0 +1,71 @@ + + + + Prevent hidden documents from locking orientation + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/idlharness.window.js b/testing/web-platform/tests/screen-orientation/idlharness.window.js new file mode 100644 index 0000000000..115f6ccb1e --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/idlharness.window.js @@ -0,0 +1,17 @@ +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js + +'use strict'; + +// https://w3c.github.io/screen-orientation/ + +idl_test( + ['screen-orientation'], + ['dom', 'cssom-view', 'html'], + idl_array => { + idl_array.add_objects({ + Screen: ['screen'], + ScreenOrientation: ['screen.orientation'] + }); + } +); diff --git a/testing/web-platform/tests/screen-orientation/lock-bad-argument.html b/testing/web-platform/tests/screen-orientation/lock-bad-argument.html new file mode 100644 index 0000000000..f13ce2a8b9 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/lock-bad-argument.html @@ -0,0 +1,26 @@ + + + + + diff --git a/testing/web-platform/tests/screen-orientation/lock-basic.html b/testing/web-platform/tests/screen-orientation/lock-basic.html new file mode 100644 index 0000000000..584747113c --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/lock-basic.html @@ -0,0 +1,76 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/lock-sandboxed-iframe.html b/testing/web-platform/tests/screen-orientation/lock-sandboxed-iframe.html new file mode 100644 index 0000000000..ab954f04b4 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/lock-sandboxed-iframe.html @@ -0,0 +1,59 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/lock-unlock-check.html b/testing/web-platform/tests/screen-orientation/lock-unlock-check.html new file mode 100644 index 0000000000..6e373ecb1c --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/lock-unlock-check.html @@ -0,0 +1,53 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/nested-documents.html b/testing/web-platform/tests/screen-orientation/nested-documents.html new file mode 100644 index 0000000000..ec3c0b4809 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/nested-documents.html @@ -0,0 +1,83 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/non-fully-active.html b/testing/web-platform/tests/screen-orientation/non-fully-active.html new file mode 100644 index 0000000000..ee1acf07bd --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/non-fully-active.html @@ -0,0 +1,53 @@ + + + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/onchange-event-subframe.html b/testing/web-platform/tests/screen-orientation/onchange-event-subframe.html new file mode 100644 index 0000000000..6eb986b438 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/onchange-event-subframe.html @@ -0,0 +1,90 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/onchange-event.html b/testing/web-platform/tests/screen-orientation/onchange-event.html new file mode 100644 index 0000000000..e0d3afd7b4 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/onchange-event.html @@ -0,0 +1,45 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/orientation-reading.html b/testing/web-platform/tests/screen-orientation/orientation-reading.html new file mode 100644 index 0000000000..90bbb8071d --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/orientation-reading.html @@ -0,0 +1,119 @@ + + + + + + + + diff --git a/testing/web-platform/tests/screen-orientation/page-visibility-manual.html b/testing/web-platform/tests/screen-orientation/page-visibility-manual.html new file mode 100644 index 0000000000..cc63279217 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/page-visibility-manual.html @@ -0,0 +1,110 @@ + + + + + + + +

Switch the page to background, then switch back in a minute.

+ + + + diff --git a/testing/web-platform/tests/screen-orientation/resources/empty.html b/testing/web-platform/tests/screen-orientation/resources/empty.html new file mode 100644 index 0000000000..0e76edd65b --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/resources/empty.html @@ -0,0 +1 @@ + diff --git a/testing/web-platform/tests/screen-orientation/resources/iframe-listen-orientation-change.html b/testing/web-platform/tests/screen-orientation/resources/iframe-listen-orientation-change.html new file mode 100644 index 0000000000..68a67f8818 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/resources/iframe-listen-orientation-change.html @@ -0,0 +1,9 @@ + diff --git a/testing/web-platform/tests/screen-orientation/resources/nav_iframe.html b/testing/web-platform/tests/screen-orientation/resources/nav_iframe.html new file mode 100644 index 0000000000..bb26cf7c10 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/resources/nav_iframe.html @@ -0,0 +1,18 @@ + + + + A Document + + +

Section 1

+

This is the content of section 1.

+ +

Section 2

+

This is the content of section 2.

+ +

+ Go to Section 1 | + Go to Section 2 +

+ + diff --git a/testing/web-platform/tests/screen-orientation/resources/orientation-utils.js b/testing/web-platform/tests/screen-orientation/resources/orientation-utils.js new file mode 100644 index 0000000000..95383750f1 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/resources/orientation-utils.js @@ -0,0 +1,52 @@ +/** + * + * @param {object} options + * @param {string} options.src - The iframe src + * @param {Window} options.context - The browsing context in which the iframe will be created + * @param {string} options.sandbox - The sandbox attribute for the iframe + * @returns + */ +export async function attachIframe(options = {}) { + const { src, context, sandbox, allowFullscreen } = { + ...{ + src: "about:blank", + context: self, + allowFullscreen: true, + sandbox: null, + }, + ...options, + }; + const iframe = context.document.createElement("iframe"); + if (sandbox !== null) iframe.sandbox = sandbox; + iframe.allowFullscreen = allowFullscreen; + await new Promise((resolve) => { + iframe.onload = resolve; + iframe.src = src; + context.document.body.appendChild(iframe); + }); + return iframe; +} + +export function getOppositeOrientation() { + return screen.orientation.type.startsWith("portrait") + ? "landscape" + : "portrait"; +} + +export function makeCleanup( + initialOrientation = screen.orientation?.type.split(/-/)[0] +) { + return async () => { + if (initialOrientation) { + try { + await screen.orientation.lock(initialOrientation); + } catch {} + } + screen.orientation.unlock(); + requestAnimationFrame(async () => { + try { + await document.exitFullscreen(); + } catch {} + }); + }; +} diff --git a/testing/web-platform/tests/screen-orientation/resources/sandboxed-iframe-locking.html b/testing/web-platform/tests/screen-orientation/resources/sandboxed-iframe-locking.html new file mode 100644 index 0000000000..436c67f5b5 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/resources/sandboxed-iframe-locking.html @@ -0,0 +1,32 @@ + + + + diff --git a/testing/web-platform/tests/screen-orientation/unlock.html b/testing/web-platform/tests/screen-orientation/unlock.html new file mode 100644 index 0000000000..13442f98f2 --- /dev/null +++ b/testing/web-platform/tests/screen-orientation/unlock.html @@ -0,0 +1,56 @@ + + + + + + + + -- cgit v1.2.3