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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/dom/events/Event-timestamp-safe-resolution.html

Issue 2744553007: Upstream high resolution event timestamp tests to WPT (Closed)
Patch Set: Make WPT lint happy Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 2
3 <script src="../../../resources/testharness.js"></script> 3 <script src="/resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script> 4 <script src="/resources/testharnessreport.js"></script>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6 'use strict'; 6 'use strict';
7 7
8 test(function() { 8 test(function() {
9 let e1 = new MouseEvent('test1'); 9 let e1 = new MouseEvent('test1');
10 let e2 = new MouseEvent('test2'); 10 let e2 = new MouseEvent('test2');
11 11
12 while (e1.timeStamp == e2.timeStamp) 12 while (e1.timeStamp == e2.timeStamp)
13 e2 = new MouseEvent('test2'); 13 e2 = new MouseEvent('test2');
14 14
15 let expectedResolutionMilliseconds = 0.005; 15 let expectedResolutionMilliseconds = 0.005;
16 let integerMultipleOfResolution = (e2.timeStamp - e1.timeStamp) / expectedRe solutionMilliseconds; 16 let integerMultipleOfResolution = (e2.timeStamp - e1.timeStamp) / expectedRe solutionMilliseconds;
17 let shouldBeNearZeroOrOne = integerMultipleOfResolution % 1; 17 let shouldBeNearZeroOrOne = integerMultipleOfResolution % 1;
18 assert_true(shouldBeNearZeroOrOne < 1e-10 || Math.abs(shouldBeNearZeroOrOne - 1) < 1e-10); 18 assert_true(shouldBeNearZeroOrOne < 1e-10 || Math.abs(shouldBeNearZeroOrOne - 1) < 1e-10);
19 }, 'Event timestamp should not have a resolution better that 5 microseconds'); 19 }, 'Event timestamp should not have a resolution better that 5 microseconds');
20 </script> 20 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698