Fix test from r186208 and r186216.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jul 2015 06:41:31 +0000 (06:41 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Jul 2015 06:41:31 +0000 (06:41 +0000)
* http/tests/misc/webtiming-resolution-expected.txt:
* http/tests/misc/webtiming-resolution.html:
Properly and explicitly test if the time delta is close to a multiple of the expected resolution.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186219 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/misc/webtiming-resolution-expected.txt
LayoutTests/http/tests/misc/webtiming-resolution.html

index 2baee7a..4fced2c 100644 (file)
@@ -1,3 +1,11 @@
+2015-07-01  Alex Christensen  <achristensen@webkit.org>
+
+        Fix test from r186208 and r186216.
+
+        * http/tests/misc/webtiming-resolution-expected.txt:
+        * http/tests/misc/webtiming-resolution.html:
+        Properly and explicitly test if the time delta is close to a multiple of the expected resolution.
+
 2015-07-01  Chris Dumez  <cdumez@apple.com>
 
         Reduce resolution of performance.now
index b6173f8..f892b46 100644 (file)
@@ -3,5 +3,5 @@ Verifies the minimum resolution is 5 microseconds.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS Math.abs(1 - (t1 - t0) / 0.005) < 1e-10 is true
+PASS shouldBeNearZeroOrOne < 1e-10 || Math.abs(shouldBeNearZeroOrOne - 1) < 1e-10 is true
 
index 798e32e..0e7efb4 100644 (file)
@@ -14,7 +14,10 @@ while (t0 == t1) {
     t1 = performance.now();
 }
 
-shouldBe("Math.abs(1 - (t1 - t0) / 0.005) < 1e-10", "true");
+var expectedResolutionMilliseconds = 0.005;
+var integerMultipleOfResolution = (t1 - t0) / expectedResolutionMilliseconds;
+var shouldBeNearZeroOrOne = integerMultipleOfResolution % 1;
+shouldBe("shouldBeNearZeroOrOne < 1e-10 || Math.abs(shouldBeNearZeroOrOne - 1) < 1e-10", "true");
 
 </script>
 </body>