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
index 4c1b31c50bd0d..be32d999b1a65 100644
--- 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
@@ -8,7 +8,7 @@
-
+
Test for keyboard activation trigger for ENTER key
Tests user activation from a ENTER keyboard event.
@@ -16,14 +16,16 @@ Test for keyboard activation trigger for ENTER key
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
index 01cb27d7b5f09..82c94d84c2a95 100644
--- 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
@@ -8,7 +8,7 @@
-
+
Test for keyboard activation trigger for ESCAPE key
Tests missing user activation from a ESCAPE keyboard event.
@@ -16,13 +16,15 @@ Test for keyboard activation trigger for ESCAPE key
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
index 51ad49a44ebdf..75a248c4259b5 100644
--- 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
@@ -8,20 +8,22 @@
-
+
Test for click activation trigger
Tests user activation from a mouse click.
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
index 1e9f839df3150..f98a54fe23810 100644
--- 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
@@ -9,13 +9,14 @@
-
+
Test for right-click activation trigger
Tests user activation from a mouse right-click.
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
index 49870936084f5..5d3eedb925e55 100644
--- a/testing/web-platform/tests/html/user-activation/activation-trigger-pointerevent.html
+++ b/testing/web-platform/tests/html/user-activation/activation-trigger-pointerevent.html
@@ -12,13 +12,14 @@
-
+
Test for pointerevent click activation trigger
Tests user activation from a pointer click.
Click anywhere in the document.
diff --git a/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.html b/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.html
index d84051cc93039..fbc2d25148376 100644
--- a/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.html
+++ b/testing/web-platform/tests/html/user-activation/consumption-crossorigin.sub.html
@@ -44,6 +44,10 @@
}
window.addEventListener("message", event => {
+
+ // Test driver can send messages too...
+ if (typeof event.data !== "string") return;
+
var msg = JSON.parse(event.data);
if (msg.type == 'child-one-loaded') {
@@ -65,8 +69,8 @@
test_driver.click(document.getElementById("child-xo"));
} else if (msg.type == 'child-one-report') {
test(() => {
- assert_false(msg.isActive);
- assert_true(msg.hasBeenActive);
+ assert_false(msg.isActive, "Child1 frame isActive");
+ assert_true(msg.hasBeenActive, "Child1 frame hasBeenActive");
}, "Child1 frame final state");
} else if (msg.type == 'child-crossorigin-report') {
// This msg was triggered by a user click followed by a window.open().
@@ -81,8 +85,8 @@
frames[1].frames[0].postMessage(ask_report, "*");
} else if (msg.type == 'child-two-report') {
test(() => {
- assert_false(msg.isActive);
- assert_false(msg.hasBeenActive);
+ assert_false(msg.isActive, "isActive");
+ assert_false(msg.hasBeenActive, "hasBeenActive");
}, "Grand child frame final state");
}
@@ -95,20 +99,27 @@
finishReportPhase();
}
});
+ async function createIframes() {
+ const child1 = document.createElement("iframe");
+ child1.src = "http://{{hosts[alt][]}}:{{ports[http][0]}}/html/user-activation/resources/child-one.html";
+ child1.id = "child1";
+ await new Promise((resolve) => {
+ child1.onload = resolve;
+ document.body.appendChild(child1);
+ });
+ const childXO = document.createElement("iframe");
+ childXO.id = "child-xo";
+ childXO.src = "http://{{hosts[alt][]}}:{{ports[http][1]}}/html/user-activation/resources/consumption-crossorigin-child.sub.html";
+ document.body.appendChild(childXO);
+ }
-
+
User activation consumption across cross-origin frame boundary
Tests that user activation consumption resets the transient states in all cross-origin frames.
Click anywhere on the yellow area.
Click anywhere on the green area (child frame).
-
-
diff --git a/testing/web-platform/tests/html/user-activation/consumption-sameorigin.html b/testing/web-platform/tests/html/user-activation/consumption-sameorigin.html
index 11dafea1646f9..46a328beebc94 100644
--- a/testing/web-platform/tests/html/user-activation/consumption-sameorigin.html
+++ b/testing/web-platform/tests/html/user-activation/consumption-sameorigin.html
@@ -26,7 +26,7 @@
assert_false(navigator.userActivation.hasBeenActive);
}, "Parent frame initial state");
- test_driver.click(document.getElementById("child-so"));
+ return test_driver.click(document.getElementById("child-so"));
}
function finishReportPhase() {
@@ -40,7 +40,10 @@
consumption_test.done();
}
- window.addEventListener("message", event => {
+ window.addEventListener("message", async event => {
+ // Test driver can send messages too...
+ if (typeof event.data !== "string") return;
+
var msg = JSON.parse(event.data);
if (msg.type == 'child-one-loaded') {
@@ -84,25 +87,32 @@
// Phase switching.
if (msg.type.endsWith("-loaded")) {
if (--num_children_to_load == 0)
- finishLoadPhase();
+ await finishLoadPhase();
} else if (msg.type.endsWith("-report")) {
if (--num_children_to_report == 0)
finishReportPhase();
}
});
+ async function createIframes() {
+ const child1 = document.createElement("iframe");
+ child1.src = "resources/child-one.html";
+ child1.id = "child1";
+ await new Promise((resolve) => {
+ child1.onload = resolve;
+ document.body.appendChild(child1);
+ });
+ const childSO = document.createElement("iframe");
+ childSO.id = "child-so";
+ childSO.src = "resources/consumption-sameorigin-child.html";
+ document.body.appendChild(childSO);
+ }
-
+
User activation consumption across same-origin frame boundary
Tests that user activation consumption resets the transient states in all same-origin frames.
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
index 7ef39f723d1c9..af3d23072b4c9 100644
--- a/testing/web-platform/tests/html/user-activation/detached-iframe.html
+++ b/testing/web-platform/tests/html/user-activation/detached-iframe.html
@@ -42,6 +42,6 @@
assert_equals(iframe.contentWindow, null, "No more global");
assert_true(userActivation.isActive, "isActive");
assert_true(userActivation.hasBeenActive, "hasBeenActive");
- }, "navigator.userActivation retains state even if browsing context is destroyed");
+ }, "navigator.userActivation retains state even if global is removed");