Commit 992d543a authored by Mustaq Ahmed's avatar Mustaq Ahmed Committed by Commit Bot

Misc fixes to WPTs for user activation api.

This CL fixes/refactors existing tests to prepare for new WPTs for UAv2.
- Fix a test name suffix.
- Fix github issue number.
- Make postMessage format consistent.
- Clarify a child-frame name.
- Replace parent refs to "top" to allow deep iframes.

Change-Id: I9da97ee827d6556116eab9d592e44665dc71d4c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2106538Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#751348}
parent c1c66c64
......@@ -94,7 +94,7 @@ crbug.com/970285 external/wpt/forced-high-contrast-colors-mode/forced-colors-mod
crbug.com/852645 external/wpt/fullscreen/api/element-request-fullscreen-two-iframes-manual.html [ Timeout ]
crbug.com/982194 external/wpt/html/dom/elements/requirements-relating-to-bidirctional-algorithm-formatting-characters/dir-isolation-005c.html [ Failure ]
crbug.com/982194 external/wpt/html/rendering/non-replaced-elements/the-fieldset-and-legend-elements/fieldset-vertical.html [ Failure ]
crbug.com/736415 external/wpt/html/user-activation/activation-api-iframe.tenative.html [ Failure ]
crbug.com/736415 external/wpt/html/user-activation/activation-api-iframe.tentative.html [ Failure ]
crbug.com/928838 external/wpt/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html [ Failure ]
crbug.com/928838 external/wpt/html/user-activation/activation-transfer-cross-origin-with-click.sub.tentative.html [ Failure ]
crbug.com/928838 external/wpt/html/user-activation/activation-transfer-with-click.tentative.html [ Failure ]
......
......@@ -5266,7 +5266,7 @@ crbug.com/854910 [ Mac ] virtual/scroll_customization/fast/scroll-behavior/smoot
crbug.com/855816 [ Win ] virtual/stable/http/tests/navigation/rename-subframe-goback.html [ Pass Timeout ]
# User Activation
crbug.com/736415 external/wpt/html/user-activation/activation-api-iframe.tenative.html [ Failure ]
crbug.com/736415 external/wpt/html/user-activation/activation-api-iframe.tentative.html [ Failure ]
crbug.com/978620 external/wpt/html/user-activation/activation-hierarchy-crossorigin-parent-manual.sub.html [ Timeout ]
crbug.com/978620 external/wpt/html/user-activation/activation-hierarchy-sameorigin-parent-manual.html [ Timeout ]
......
......@@ -633,7 +633,7 @@ external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import
external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-classic.html [ Pass Failure ]
external/wpt/html/semantics/scripting-1/the-script-element/module/dynamic-import/string-compilation-base-url-inline-module.html [ Pass Failure ]
external/wpt/html/semantics/scripting-1/the-script-element/module/module-in-xhtml.xhtml [ Pass Failure ]
external/wpt/html/user-activation/activation-api-iframe.tenative.html [ Pass Failure ]
external/wpt/html/user-activation/activation-api-iframe.tentative.html [ Pass Failure ]
external/wpt/html/user-activation/activation-transfer-cross-origin-with-click-two-child-frames.sub.tentative.html [ Pass Failure ]
external/wpt/html/user-activation/activation-transfer-cross-origin-with-click.sub.tentative.html [ Pass Failure ]
external/wpt/html/user-activation/activation-transfer-with-click.tentative.html [ Pass Failure ]
......
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/1983
https://github.com/whatwg/html/issues/1983
-->
<html>
<head>
......
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/3739
https://github.com/whatwg/html/issues/1983
-->
<html>
<head>
......@@ -16,7 +15,9 @@
<ol id="instructions">
<li>Click this instruction text.
</ol>
<iframe id="child" width="200" height="200"></iframe>
<iframe id="child" width="200" height="200"
src="resources/child-one.html">
</iframe>
<script>
async_test(function(t) {
var child = document.getElementById("child");
......@@ -25,33 +26,32 @@
window.addEventListener("message", t.step_func(event => {
var msg = JSON.parse(event.data);
if (msg.type == 'child-one-loaded') {
// state should be false after load
// Child's states should be false after load.
assert_false(msg.isActive);
assert_false(msg.hasBeenActive);
// click in parent document
// Click in parent document.
test_driver.click(document.getElementById('instructions'));
} else if (msg.type == 'child-one-report') {
// only the transient state should be false after asked to report
// Only the transient state in child should be false after consumption below.
assert_false(msg.isActive);
assert_true(msg.hasBeenActive);
t.done();
}
}));
window.addEventListener("click", t.step_func(event => {
assert_true(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
assert_true(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
// Opening a window should consume the activation.
var win = window.open('404.html');
win.close();
assert_false(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
// Opening a window should consume the activation.
var win = window.open('404.html');
win.close();
assert_false(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
// ask child to report their state
child.contentWindow.postMessage('report', '*');
// Ask child to report its state.
child.contentWindow.postMessage(JSON.stringify({"type": "report"}), '*');
}));
child.src = "resources/child-one.html";
}, "Values adjust on activity");
</script>
</body>
......
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/3739
https://github.com/whatwg/html/issues/1983
-->
<html>
<head>
......@@ -14,9 +13,11 @@
<body>
<h1>Clicking in iframe has activation state in child</h1>
<ol id="instructions">
<li>Click inside the light-grey area.
<li>Click inside the yellow area.
</ol>
<iframe id="child" width="200" height="200"></iframe>
<iframe id="child" width="200" height="200"
src="resources/child-one.html">
</iframe>
<script>
async_test(function(t) {
var child = document.getElementById("child");
......@@ -45,7 +46,6 @@
t.done();
}
}));
child.src = "resources/child-one.html";
}, "Values adjust on activity");
</script>
</body>
......
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/3739
https://github.com/whatwg/html/issues/1983
-->
<html>
<head>
......@@ -16,39 +15,40 @@
<ol id="instructions">
<li>Click inside the red area.
</ol>
<iframe id="child" width="200" height="200"></iframe>
<iframe id="child" width="200" height="200"
src="http://{{domains[www]}}:{{ports[http][0]}}/html/user-activation/resources/child-message-event-api.html">
</iframe>
<script>
async_test(function(t) {
var child = document.getElementById("child");
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
window.addEventListener("message", t.step_func(event => {
if (event.data == 'child-three-loaded') {
if (event.data == 'child-loaded') {
// values have false after load
assert_true(event.userActivation != null);
assert_false(event.userActivation.isActive);
assert_false(event.userActivation.hasBeenActive);
test_driver.click(child);
} else if (event.data == 'child-three-clicked') {
} else if (event.data == 'child-clicked') {
// values have activation state on click
assert_true(navigator.userActivation.hasBeenActive);
assert_true(event.userActivation != null);
assert_true(event.userActivation.isActive);
assert_true(event.userActivation.hasBeenActive);
child.contentWindow.postMessage('report', "*");
} else if (event.data == 'child-three-report') {
} else if (event.data == 'child-report') {
assert_false(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
assert_true(event.userActivation != null);
assert_false(event.userActivation.isActive);
assert_true(event.userActivation.hasBeenActive);
child.contentWindow.postMessage('report-no-activation', "*");
} else if (event.data == 'child-three-report-no-activation') {
} else if (event.data == 'child-report-no-activation') {
assert_true(event.userActivation === null);
t.done();
}
}));
child.src = "http://{{domains[www]}}:{{ports[http][0]}}/html/user-activation/resources/child-three.html";
}, "Message propagates values on post");
</script>
</body>
......
<!DOCTYPE html>
<body style="background: red;">
<script>
window.parent.postMessage("child-loaded",
{targetOrigin: "*", includeUserActivation: true});
window.addEventListener("click", event => {
window.parent.postMessage("child-clicked",
{targetOrigin: "*", includeUserActivation: true});
var win = window.open('404.html');
win.close();
});
window.addEventListener("message", event => {
if (event.data == "report") {
window.parent.postMessage("child-report",
{targetOrigin: "*", includeUserActivation: true});
}
if (event.data == "report-no-activation") {
window.parent.postMessage("child-report-no-activation",
{targetOrigin: "*", includeUserActivation: false});
}
});
</script>
</body>
<!DOCTYPE html>
<body style="background: red;">
<body style="background: yellow;">
<script>
window.parent.postMessage(JSON.stringify({"type": "child-one-loaded", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
window.top.postMessage(JSON.stringify({
"type": "child-one-loaded",
"isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive
}), "*");
window.addEventListener("click", event => {
window.parent.postMessage(JSON.stringify({"type": "child-one-clicked", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
});
window.addEventListener("click", event => {
window.top.postMessage(JSON.stringify({
"type": "child-one-clicked",
"isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive
}), "*");
});
window.addEventListener("message", event => {
if (event.data == "report") {
window.parent.postMessage(JSON.stringify({"type": "child-one-report", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
}
});
</script>
window.addEventListener("message", event => {
var msg = JSON.parse(event.data);
if (msg.type == "report") {
window.top.postMessage(JSON.stringify({
"type": "child-one-report",
"isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive
}), "*");
}
});
</script>
</body>
<!DOCTYPE html>
<body style="background: red;">
<script>
window.parent.postMessage("child-three-loaded", {targetOrigin: "*", includeUserActivation: true});
window.addEventListener("click", event => {
window.parent.postMessage("child-three-clicked", {targetOrigin: "*", includeUserActivation: true});
var win = window.open('404.html');
win.close();
});
window.addEventListener("message", event => {
if (event.data == "report")
window.parent.postMessage("child-three-report", {targetOrigin: "*", includeUserActivation: true});
if (event.data == "report-no-activation")
window.parent.postMessage("child-three-report-no-activation", {targetOrigin: "*", includeUserActivation: false});
});
</script>
</body>
<!DOCTYPE html>
<body style="background: lightgrey;">
<script>
window.parent.postMessage(JSON.stringify({"type": "child-two-loaded", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
<script>
window.top.postMessage(JSON.stringify({
"type": "child-two-loaded",
"isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive
}), "*");
window.addEventListener("message", event => {
if (event.source === window.parent && event.data == "report") {
window.parent.postMessage(JSON.stringify({"type": "child-two-report", "isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive}), "*");
if (event.data == "report") {
window.top.postMessage(JSON.stringify({
"type": "child-two-report",
"isActive": navigator.userActivation.isActive,
"hasBeenActive": navigator.userActivation.hasBeenActive
}), "*");
}
});
</script>
</script>
</body>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment