From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../tests/html/user-activation/META.yml | 3 + .../activation-trigger-keyboard-enter.html | 47 +++++++ .../activation-trigger-keyboard-escape.html | 41 ++++++ .../activation-trigger-mouse-left.html | 45 ++++++ .../activation-trigger-mouse-right.html | 60 ++++++++ .../activation-trigger-pointerevent.html | 64 +++++++++ .../html/user-activation/chained-setTimeout.html | 63 +++++++++ .../consumption-crossorigin.sub.tentative.html | 129 ++++++++++++++++++ .../consumption-sameorigin.tentative.html | 122 +++++++++++++++++ .../html/user-activation/detached-iframe.html | 47 +++++++ ...tion-api-iframe-cross-origin.sub.tentative.html | 55 ++++++++ .../message-event-init.tentative.html | 19 +++ .../navigation-state-reset-crossorigin.sub.html | 53 ++++++++ .../navigation-state-reset-sameorigin.html | 62 +++++++++ .../no-activation-thru-escape-key.html | 65 +++++++++ .../propagation-crossorigin.sub.html | 121 +++++++++++++++++ .../propagation-same-and-cross-origin.sub.html | 151 +++++++++++++++++++++ .../user-activation/propagation-sameorigin.html | 118 ++++++++++++++++ .../resources/child-message-event-api.html | 24 ++++ .../html/user-activation/resources/child-one.html | 29 ++++ .../html/user-activation/resources/child-two.html | 29 ++++ .../consumption-crossorigin-child.sub.html | 29 ++++ .../resources/consumption-sameorigin-child.html | 29 ++++ .../propagation-crossorigin-child.sub.html | 27 ++++ .../resources/propagation-sameorigin-child.html | 27 ++++ .../tests/html/user-activation/resources/utils.js | 48 +++++++ .../user-activation/user-activation-interface.html | 32 +++++ 27 files changed, 1539 insertions(+) create mode 100644 testing/web-platform/tests/html/user-activation/META.yml create mode 100644 testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-enter.html create mode 100644 testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-escape.html create mode 100644 testing/web-platform/tests/html/user-activation/activation-trigger-mouse-left.html create mode 100644 testing/web-platform/tests/html/user-activation/activation-trigger-mouse-right.html create mode 100644 testing/web-platform/tests/html/user-activation/activation-trigger-pointerevent.html create mode 100644 testing/web-platform/tests/html/user-activation/chained-setTimeout.html create mode 100644 testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.tentative.html create mode 100644 testing/web-platform/tests/html/user-activation/consumption-sameorigin.tentative.html create mode 100644 testing/web-platform/tests/html/user-activation/detached-iframe.html create mode 100644 testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html create mode 100644 testing/web-platform/tests/html/user-activation/message-event-init.tentative.html create mode 100644 testing/web-platform/tests/html/user-activation/navigation-state-reset-crossorigin.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/navigation-state-reset-sameorigin.html create mode 100644 testing/web-platform/tests/html/user-activation/no-activation-thru-escape-key.html create mode 100644 testing/web-platform/tests/html/user-activation/propagation-crossorigin.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/propagation-same-and-cross-origin.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/propagation-sameorigin.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/child-one.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/child-two.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html create mode 100644 testing/web-platform/tests/html/user-activation/resources/utils.js create mode 100644 testing/web-platform/tests/html/user-activation/user-activation-interface.html (limited to 'testing/web-platform/tests/html/user-activation') diff --git a/testing/web-platform/tests/html/user-activation/META.yml b/testing/web-platform/tests/html/user-activation/META.yml new file mode 100644 index 0000000000..e50fcfc84f --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/META.yml @@ -0,0 +1,3 @@ +spec: https://html.spec.whatwg.org/multipage/interaction.html#tracking-user-activation +suggested_reviewers: + - marcoscaceres diff --git a/testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-enter.html b/testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-enter.html new file mode 100644 index 0000000000..be32d999b1 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-enter.html @@ -0,0 +1,47 @@ + + + + + + + + + + + +

Test for keyboard activation trigger for ENTER key

+

Tests user activation from a ENTER keyboard event.

+ +
    +
  1. Press ENTER key. +
+ + + diff --git a/testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-escape.html b/testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-escape.html new file mode 100644 index 0000000000..82c94d84c2 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/activation-trigger-keyboard-escape.html @@ -0,0 +1,41 @@ + + + + + + + + + + + +

Test for keyboard activation trigger for ESCAPE key

+

Tests missing user activation from a ESCAPE keyboard event.

+ +
    +
  1. Press ESCAPE key. +
+ + + diff --git a/testing/web-platform/tests/html/user-activation/activation-trigger-mouse-left.html b/testing/web-platform/tests/html/user-activation/activation-trigger-mouse-left.html new file mode 100644 index 0000000000..75a248c425 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/activation-trigger-mouse-left.html @@ -0,0 +1,45 @@ + + + + + + + + + + + +

Test for click activation trigger

+

Tests user activation from a mouse click.

+
    +
  1. Click anywhere in the document. +
+ + + diff --git a/testing/web-platform/tests/html/user-activation/activation-trigger-mouse-right.html b/testing/web-platform/tests/html/user-activation/activation-trigger-mouse-right.html new file mode 100644 index 0000000000..f98a54fe23 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/activation-trigger-mouse-right.html @@ -0,0 +1,60 @@ + + + + + + + + + + + + +

Test for right-click activation trigger

+

Tests user activation from a mouse right-click.

+
    +
  1. Right-click anywhere in the document. +
+ + + diff --git a/testing/web-platform/tests/html/user-activation/activation-trigger-pointerevent.html b/testing/web-platform/tests/html/user-activation/activation-trigger-pointerevent.html new file mode 100644 index 0000000000..5d3eedb925 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/activation-trigger-pointerevent.html @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + +

Test for pointerevent click activation trigger

+

Tests user activation from a pointer click.

+
    +
  1. Click anywhere in the document. +
+ + + diff --git a/testing/web-platform/tests/html/user-activation/chained-setTimeout.html b/testing/web-platform/tests/html/user-activation/chained-setTimeout.html new file mode 100644 index 0000000000..a530837392 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/chained-setTimeout.html @@ -0,0 +1,63 @@ + + + + + + + + + + +

User activation state in chained setTimeout calls

+

Tests that user activation state is visible in arbitrary call depth of setTimeout.

+
    +
  1. Click anywhere in the document. +
+ diff --git a/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.tentative.html b/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.tentative.html new file mode 100644 index 0000000000..ebb1661559 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.tentative.html @@ -0,0 +1,129 @@ + + + + + + + + + + + + + +

User activation consumption across cross-origin frame boundary

+

Tests that user activation consumption resets the transient states in all cross-origin frames.

+
    +
  1. Click anywhere on the yellow area. +
  2. Click anywhere on the green area (child frame). +
+ + diff --git a/testing/web-platform/tests/html/user-activation/consumption-sameorigin.tentative.html b/testing/web-platform/tests/html/user-activation/consumption-sameorigin.tentative.html new file mode 100644 index 0000000000..81cd5d3ca1 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/consumption-sameorigin.tentative.html @@ -0,0 +1,122 @@ + + + + + + + + + + + +

User activation consumption across same-origin frame boundary

+

Tests that user activation consumption resets the transient states in all same-origin frames.

+
    +
  1. Click anywhere on the green area (child frame). +
+ + diff --git a/testing/web-platform/tests/html/user-activation/detached-iframe.html b/testing/web-platform/tests/html/user-activation/detached-iframe.html new file mode 100644 index 0000000000..af3d23072b --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/detached-iframe.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + diff --git a/testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html b/testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html new file mode 100644 index 0000000000..2a16f45496 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/message-event-activation-api-iframe-cross-origin.sub.tentative.html @@ -0,0 +1,55 @@ + + + + + + + + + + +

Clicking in iframe has activation state in child via MessageEvent

+
    +
  1. Click inside the red area. +
+ + + + diff --git a/testing/web-platform/tests/html/user-activation/message-event-init.tentative.html b/testing/web-platform/tests/html/user-activation/message-event-init.tentative.html new file mode 100644 index 0000000000..1f3ef55170 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/message-event-init.tentative.html @@ -0,0 +1,19 @@ + + +MessageEvent constructor + + + diff --git a/testing/web-platform/tests/html/user-activation/navigation-state-reset-crossorigin.sub.html b/testing/web-platform/tests/html/user-activation/navigation-state-reset-crossorigin.sub.html new file mode 100644 index 0000000000..5e16e9d46c --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/navigation-state-reset-crossorigin.sub.html @@ -0,0 +1,53 @@ + + + + + + + + + + +

Post-navigation activation state in child

+

Tests that navigating a cross-origin child frame resets its activation states.

+
    +
  1. Click inside the yellow area. +
+ + + + diff --git a/testing/web-platform/tests/html/user-activation/navigation-state-reset-sameorigin.html b/testing/web-platform/tests/html/user-activation/navigation-state-reset-sameorigin.html new file mode 100644 index 0000000000..c240f96b2c --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/navigation-state-reset-sameorigin.html @@ -0,0 +1,62 @@ + + + + + + + + + +

Post-navigation activation state in child

+

+ Tests that navigating a same-origin child frame resets its activation + states. +

+
    +
  1. Click inside the yellow area.
  2. +
+ + + + + diff --git a/testing/web-platform/tests/html/user-activation/no-activation-thru-escape-key.html b/testing/web-platform/tests/html/user-activation/no-activation-thru-escape-key.html new file mode 100644 index 0000000000..0045e20788 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/no-activation-thru-escape-key.html @@ -0,0 +1,65 @@ + + + + No user activation through 'Escape' key + + + + + + + + + + + + +

No user activation through 'Escape' key

+

Tests that pressing/releasing 'Escape' key is not treated as a user activation.

+ + + diff --git a/testing/web-platform/tests/html/user-activation/propagation-crossorigin.sub.html b/testing/web-platform/tests/html/user-activation/propagation-crossorigin.sub.html new file mode 100644 index 0000000000..d317764036 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/propagation-crossorigin.sub.html @@ -0,0 +1,121 @@ + + + + + + + + + + + + +

User activation propagation across cross-origin frame boundary

+

Tests that user activation does not propagate across cross-origin frame boundary.

+
    +
  1. Click anywhere on the green area (child frame). +
+ + diff --git a/testing/web-platform/tests/html/user-activation/propagation-same-and-cross-origin.sub.html b/testing/web-platform/tests/html/user-activation/propagation-same-and-cross-origin.sub.html new file mode 100644 index 0000000000..31a7222448 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/propagation-same-and-cross-origin.sub.html @@ -0,0 +1,151 @@ + + + + + + + + + + +

Check that cross origin iframes don't get activated

+

+ Tests that activating a same-origin navigable doesn't activate a cross + origin navigable. +

+
    +
  1. Click inside the yellow area.
  2. +
+

Same origin

+ +

Cross origin

+ + + + diff --git a/testing/web-platform/tests/html/user-activation/propagation-sameorigin.html b/testing/web-platform/tests/html/user-activation/propagation-sameorigin.html new file mode 100644 index 0000000000..61debbf948 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/propagation-sameorigin.html @@ -0,0 +1,118 @@ + + + + + + + + + + +

User activation propagation across same-origin frame boundary

+

Tests that user activation propagates across same-origin frame boundary.

+
    +
  1. Click anywhere on the green area (child frame). +
+ + diff --git a/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html b/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html new file mode 100644 index 0000000000..a0001633c2 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/child-message-event-api.html @@ -0,0 +1,24 @@ + + + + diff --git a/testing/web-platform/tests/html/user-activation/resources/child-one.html b/testing/web-platform/tests/html/user-activation/resources/child-one.html new file mode 100644 index 0000000000..9668372620 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/child-one.html @@ -0,0 +1,29 @@ + + + + diff --git a/testing/web-platform/tests/html/user-activation/resources/child-two.html b/testing/web-platform/tests/html/user-activation/resources/child-two.html new file mode 100644 index 0000000000..9fb68dbd51 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/child-two.html @@ -0,0 +1,29 @@ + + + + diff --git a/testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html b/testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html new file mode 100644 index 0000000000..518e000d0b --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/consumption-crossorigin-child.sub.html @@ -0,0 +1,29 @@ + + + + + + + +
Cross-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html b/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html new file mode 100644 index 0000000000..9e421fc0f1 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/consumption-sameorigin-child.html @@ -0,0 +1,29 @@ + + + + + + + +
Same-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html b/testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html new file mode 100644 index 0000000000..e920566a21 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/propagation-crossorigin-child.sub.html @@ -0,0 +1,27 @@ + + + + + + + +
Cross-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html b/testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html new file mode 100644 index 0000000000..69ad50cb71 --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/propagation-sameorigin-child.html @@ -0,0 +1,27 @@ + + + + + + + +
Same-origin child frame
+ + + diff --git a/testing/web-platform/tests/html/user-activation/resources/utils.js b/testing/web-platform/tests/html/user-activation/resources/utils.js new file mode 100644 index 0000000000..5d3302583f --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/resources/utils.js @@ -0,0 +1,48 @@ +function delayByFrames(f, num_frames) { + function recurse(depth) { + if (depth == 0) + f(); + else + requestAnimationFrame(() => recurse(depth-1)); + } + recurse(num_frames); +} + +// Returns a Promise which is resolved with the event object when the event is +// fired. +function getEvent(eventType) { + return new Promise(resolve => { + document.body.addEventListener(eventType, e => resolve(e), {once: true}); + }); +} + + +// Returns a Promise which is resolved with a "true" iff transient activation +// was available and successfully consumed. +// +// This function relies on Fullscreen API to check/consume user activation +// state. +async function consumeTransientActivation() { + try { + await document.body.requestFullscreen(); + await document.exitFullscreen(); + return true; + } catch(e) { + return false; + } +} + +function receiveMessage(type) { + return new Promise((resolve) => { + window.addEventListener("message", function listener(event) { + if (typeof event.data !== "string") { + return; + } + const data = JSON.parse(event.data); + if (data.type === type) { + window.removeEventListener("message", listener); + resolve(data); + } + }); + }); +} diff --git a/testing/web-platform/tests/html/user-activation/user-activation-interface.html b/testing/web-platform/tests/html/user-activation/user-activation-interface.html new file mode 100644 index 0000000000..8ece08f11d --- /dev/null +++ b/testing/web-platform/tests/html/user-activation/user-activation-interface.html @@ -0,0 +1,32 @@ + + + + + + + + + + +

Basic test for navigator.userActivation interface

+

Tests that navigator.userActivation shows user activation states.

+
    +
  1. Click anywhere in the document. +
+ + + -- cgit v1.2.3