Event-timestamp-high-resolution.https.html (790B)
1 <!DOCTYPE html> 2 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script type="text/javascript"> 6 'use strict'; 7 for (let eventType of ["GamepadEvent"]) { 8 test(function() { 9 let before = performance.now(); 10 let e = new window[eventType]('test'); 11 let after = performance.now(); 12 assert_greater_than_equal(e.timeStamp, before, "Event timestamp should be greater than performance.now() timestamp taken before its creation"); 13 assert_less_than_equal(e.timeStamp, after, "Event timestamp should be less than performance.now() timestamp taken after its creation"); 14 }, `Constructed ${eventType} timestamp should be high resolution and have the same time origin as performance.now()`); 15 } 16 </script>