tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

user-activation-interface.html (1255B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <script src="/resources/testharness.js"></script>
      5  <script src="/resources/testharnessreport.js"></script>
      6  <script src="/resources/testdriver.js"></script>
      7  <script src="/resources/testdriver-vendor.js"></script>
      8  <script src="resources/utils.js"></script>
      9 </head>
     10 <body onload="runTests()">
     11  <h1>Basic test for navigator.userActivation interface</h1>
     12  <p>Tests that navigator.userActivation shows user activation states.</p>
     13  <ol id="instructions">
     14    <li>Click anywhere in the document.
     15  </ol>
     16  <script>
     17  function runTests() {
     18    promise_test(async () => {
     19        assert_true(!!navigator.userActivation, "This test requires navigator.userActivation API");
     20 
     21        assert_false(navigator.userActivation.hasBeenActive, "No sticky activation before click");
     22        assert_false(navigator.userActivation.isActive, "No transient activation before click");
     23 
     24        await test_driver.click(document.body);
     25 
     26        assert_true(navigator.userActivation.hasBeenActive, "Has sticky activation after click");
     27        assert_true(navigator.userActivation.isActive, "Has transient activation after click");
     28    }, "navigator.userActivation shows correct states before/after a click");
     29  }
     30  </script>
     31 </body>
     32 </html>