зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564645 [wpt PR 17515] - Add a wpt for UAv2 frame hierarchy check., a=testonly
Automatic update from web-platform-tests 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/+/1677067 Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org> Commit-Queue: Mustaq Ahmed <mustaq@chromium.org> Cr-Commit-Position: refs/heads/master@{#672503} -- wpt-commits: 22ac92d03adb94bc0999b2ae85ec9ce76c9d30a5 wpt-pr: 17515
This commit is contained in:
Родитель
e92c9fbab5
Коммит
8137f497bb
|
@ -0,0 +1,38 @@
|
|||
<!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>
|
|
@ -0,0 +1,32 @@
|
|||
<!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>
|
|
@ -0,0 +1,28 @@
|
|||
<!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>
|
Загрузка…
Ссылка в новой задаче