Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Unified Diff: third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html

Issue 1352523002: Use high precision timestamp for Event.timestamp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html
new file mode 100644
index 0000000000000000000000000000000000000000..297b4ebce3e4f21637f819036605076f98e32078
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+'use strict';
+
+let testCases = {
+ 'mousedown': () => eventSender.mouseDown(),
+ 'keydown': () => eventSender.keyDown('x'),
+ 'touchstart': () => {
+ eventSender.addTouchPoint(1, 1);
+ eventSender.touchStart();
+ },
+ 'click': () => eventSender.gestureTap(1, 1)
+};
+
+for (let eventName in testCases)
+ createTest(eventName, testCases[eventName]);
+
+function createTest(eventName, dispatchEventFn) {
+ async_test(function(t) {
+ document.addEventListener(eventName, t.step_func(function(e) {
+ let platformTimestamp = eventSender.lastEventTimestamp(); // in seconds
+ let expectedTimestamp = internals.monotonicTimeToZeroBasedDocumentTime(platformTimestamp) * 1000; // in milliseconds
+ assert_approx_equals(e.timeStamp, expectedTimestamp, 0.005);
+ t.done();
+ }));
+ dispatchEventFn();
+ }, "Event timestamp should be equal to the timestamp provided by the platform for " + eventName);
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698