| <!DOCTYPE html> |
| |
| <script src="../../../resources/testharness.js"></script> |
| <script src="../../../resources/testharnessreport.js"></script> |
| <script type="text/javascript"> |
| async_test(function(t) { |
| document.addEventListener('contextmenu', t.step_func(function(e) { |
| const platformTimestamp = eventSender.lastEventTimestamp(); // in seconds |
| const expectedUnclampedTimestamp = internals.monotonicTimeToZeroBasedDocumentTime(platformTimestamp) * 1000; // in milliseconds |
| // Time clamping logic in Blink can introduce at most 2*100us of |
| // difference. Use 0.200001 instead of 0.2 to deal with floating |
| // point comparison issues. |
| assert_approx_equals(e.timeStamp, expectedUnclampedTimestamp, 0.200001); |
| t.done(); |
| })); |
| eventSender.contextClick(); |
| }, "ContextMenu event timestamp should be equal to the timestamp provided by the platform"); |
| </script> |