OLD | NEW |
(Empty) | |
| 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 |
| 8 let testCases = { |
| 9 'mousedown': () => eventSender.mouseDown(), |
| 10 'keydown': () => eventSender.keyDown('x'), |
| 11 'touchstart': () => { |
| 12 eventSender.addTouchPoint(1, 1); |
| 13 eventSender.touchStart(); |
| 14 }, |
| 15 'click': () => eventSender.gestureTap(1, 1) |
| 16 }; |
| 17 |
| 18 for (let eventName in testCases) |
| 19 createTest(eventName, testCases[eventName]); |
| 20 |
| 21 function createTest(eventName, dispatchEventFn) { |
| 22 async_test(function(t) { |
| 23 document.addEventListener(eventName, t.step_func(function(e) { |
| 24 let platformTimestamp = eventSender.lastEventTimestamp(); // in seco
nds |
| 25 let expectedTimestamp = internals.monotonicTimeToZeroBasedDocumentTi
me(platformTimestamp) * 1000; // in milliseconds |
| 26 assert_approx_equals(e.timeStamp, expectedTimestamp, 0.005); |
| 27 t.done(); |
| 28 })); |
| 29 dispatchEventFn(); |
| 30 }, "Event timestamp should be equal to the timestamp provided by the platfor
m for " + eventName); |
| 31 } |
| 32 </script> |
OLD | NEW |