| <!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> |