tor-browser

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

interactionid-keypress.html (1571B)


      1 <!DOCTYPE html>
      2 <html>
      3 <meta charset=utf-8 />
      4 <meta name="timeout" content="long">
      5 <title>Event Timing: interactionId-keypress.</title>
      6 <textarea id='test'></textarea>
      7 <script src=/resources/testharness.js></script>
      8 <script src=/resources/testharnessreport.js></script>
      9 <script src=/resources/testdriver.js></script>
     10 <script src=/resources/testdriver-actions.js></script>
     11 <script src=/resources/testdriver-vendor.js></script>
     12 <script src=resources/event-timing-test-utils.js></script>
     13 
     14 <script>
     15  let observedEntries = [];
     16  let map = new Map();
     17          const events = ['keydown','keypress','keyup'];
     18 
     19  async_test(function (t) {
     20    assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
     21 
     22    new PerformanceObserver(t.step_func(entryList => {
     23      observedEntries = observedEntries.concat(entryList.getEntries().filter(filterAndAddToMap(events, map)));
     24      if (observedEntries.length < 3)
     25        return;
     26      assert_greater_than(map.get('keypress'), 0, 'Should have a non-trivial interactionId');
     27      assert_equals(map.get('keydown'), map.get('keypress'), 'The keydown and the keypress should have the same interactionId');
     28      assert_equals(map.get('keyup'), map.get('keypress'), 'The keyup and the keypress should have the same interactionId');
     29      assert_equals('t', document.getElementById('test').value);
     30      t.done();
     31    })).observe({ type: "event" });
     32 
     33    addListenersAndPress(document.getElementById('test'), 't', events);
     34  }, "Event Timing: compare event timing interactionId for keypress.");
     35 
     36 
     37 </script>
     38 
     39 </html>