Index: third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html |
diff --git a/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..949bb1a9057ef8e9a8a9e1d541935d9456b434b4 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html |
@@ -0,0 +1,16 @@ |
+<!DOCTYPE html> |
+ |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script type="text/javascript"> |
+'use strict'; |
+for (let eventType of [MouseEvent, KeyboardEvent, WheelEvent, GamepadEvent, FocusEvent]) { |
+ test(function() { |
+ let before = performance.now(); |
+ let e = new eventType('test'); |
+ let after = performance.now(); |
+ assert_greater_than_equal(e.timeStamp, before, "Event timestamp should be greate that performance.now() timestamp taken before its creation"); |
+ assert_less_than_equal(e.timeStamp, after, "Event timestamp should be less that performance.now() timestamp taken after its creation"); |
+ }, `Constructed ${eventType.prototype.constructor.name} timestamp should be high resolution and have the same time origin as performance.now()`); |
+} |
+</script> |