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-setTimeout.tentative.html
<!DOCTYPE html>
<!--
   Tentative due to:
    https://github.com/whatwg/html/issues/1983
-->
<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 on document sets user activation even after setTimeout</h1>
  <p>Click anywhere in the document.</p>
  <script>
    async_test(function(t) {
      assert_false(navigator.userActivation.hasBeenActive);
      assert_false(navigator.userActivation.isActive);
      window.addEventListener("click", event => {
        t.step_timeout(() => {
          assert_true(navigator.userActivation.hasBeenActive);
          assert_true(navigator.userActivation.isActive);

          // Opening a window should consume the activation.
          window.open('404.html');
          assert_true(navigator.userActivation.hasBeenActive);
          assert_false(navigator.userActivation.isActive);
          t.done();
        }, 0);
      });
      test_driver.click(document.body);
    }, "Values adjust on activity");
  </script>
</body>
</html>
back to top