https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 9cef0de514b1aa162f3b7191ea395476d06840a1 authored by Yoav Weiss on 20 November 2018, 21:30:06 UTC
Align resource timing buffer full processing to spec PR 163
Tip revision: 9cef0de
activation-api-iframe-no-activate.tenative.html
<!DOCTYPE html>
<!--
   Tentative due to:
    https://github.com/whatwg/html/issues/3739

-->
<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>Clicking in parent frame does not propagate state to child</h1>
  <ol id="instructions">
    <li>Click this instruction text.
  </ol>
  <iframe id="child" width="200" height="200"></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 => {
        var msg = JSON.parse(event.data);
        if (msg.type == 'child-one-loaded') {
          // state should be false after load
          assert_false(msg.isActive);
          assert_false(msg.hasBeenActive);

          // click in parent document
          test_driver.click(document.getElementById('instructions'));
        } else if (msg.type == 'child-one-report') {
          // state should be false after asked to report
          assert_false(msg.isActive);
          assert_false(msg.hasBeenActive);
          t.done();
        }
      }));
      window.addEventListener("click", t.step_func(event => {
          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);

          // ask child to report their state
          child.contentWindow.postMessage('report', '*');
      }));
      child.src = "resources/child-one.html";
    }, "Values adjust on activity");
  </script>
</body>
</html>
back to top