Commit c8c7fe76 authored by Mustaq Ahmed's avatar Mustaq Ahmed Committed by Commit Bot

Add a wpt for UAv2 frame hierarchy check.

The test passes manually.

Bug: 978620
Change-Id: Ic40cef889d41c8b21e8e184d158ecdd2b92ebabd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1677067Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#672503}
parent df5662fe
......@@ -5455,6 +5455,7 @@ crbug.com/855816 [ Win ] virtual/stable/http/tests/navigation/rename-subframe-go
# User Activation
crbug.com/736415 external/wpt/html/user-activation/activation-api-iframe.tenative.html [ Failure ]
crbug.com/978620 external/wpt/html/user-activation/activation-hierarchy-parent-manual.sub.tentative.html [ Timeout ]
# Sheriff 2018-07-05
crbug.com/860731 fast/scroll-snap/animate-fling-to-snap-points.html [ Failure Pass ]
......
<!DOCTYPE html>
<!--
Tentative due to:
https://github.com/whatwg/html/issues/1903
-->
<html>
<head>
<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>
</head>
<body>
<h1>Activation state is visible in parent and not in child</h1>
<ol id="instructions">
<li>Click anywhere on the green area (child frame).
</ol>
<iframe id="child" width="400" height="400"></iframe>
<script>
async_test(function(t) {
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
let child = document.getElementById("child");
window.addEventListener("message", t.step_func(event => {
if (event.source === frames[0].frames[0] && event.data === 'checked') {
// Parent should be active after child is clicked.
assert_true(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
t.done();
}
}));
child.src = "http://{{domains[www1]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-child.sub.html";
}, "Parent test");
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body style="background: lightgreen;">
<h1>Child frame</h1>
<iframe id="grandchild" width="350" height="200"></iframe>
<script>
async_test(function(t) {
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
var grandchild = document.getElementById("grandchild");
window.addEventListener("click", t.step_func(event => {
// Child should be active when clicked.
assert_true(navigator.userActivation.isActive);
assert_true(navigator.userActivation.hasBeenActive);
// Ask grandchild to check its state (and notify top frame).
grandchild.contentWindow.postMessage('check-request', '*');
t.done();
}));
grandchild.src = "http://{{domains[www2]}}:{{ports[http][0]}}/html/user-activation/resources/activation-hierarchy-grandchild.html";
}, "Child test");
</script>
</body>
</html>
<!DOCTYPE html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body style="background: lightgrey;">
<h1>Grandchild frame</h1>
<script>
async_test(function(t) {
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
window.addEventListener("message", event => {
if (event.source === parent && event.data === 'check-request') {
// Grandchild shouldn't be active after child is clicked.
assert_false(navigator.userActivation.isActive);
assert_false(navigator.userActivation.hasBeenActive);
// Notify top frame that checks are done.
parent.parent.postMessage('checked', '*');
t.done();
}
});
}, "Grandchild test");
</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