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

Unified Diff: LayoutTests/resources/js-test.js

Issue 80983002: File constructor understands lastModified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added isolate to v8::Date::New to avoid deprecation warning. Created 7 years 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
« no previous file with comments | « LayoutTests/fast/harness/should-be-now-expected.txt ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/resources/js-test.js
diff --git a/LayoutTests/resources/js-test.js b/LayoutTests/resources/js-test.js
index 2754c84082f860e7350a9fca31e78d92e1275d4b..016c67f8ae3a08edfc76dfa59dd2afb4b86d87e9 100644
--- a/LayoutTests/resources/js-test.js
+++ b/LayoutTests/resources/js-test.js
@@ -569,8 +569,16 @@ function shouldThrow(_a, _e)
testFailed(_a + " should throw " + (typeof _e == "undefined" ? "an exception" : _ev) + ". Was " + _av + ".");
}
-function shouldBeNow(a)
+function shouldBeNow(a, delta)
{
+ // Right now, V8 and Chromium / Blink use two different clock
+ // implementations. On Windows, the implementations are non-trivial and can
+ // be slightly out of sync. The delta is intended to compensate for that.
+ //
+ // FIXME: reconsider this when the V8 and Blink clocks get unified, see http://crbug.com/324110
+ if (delta === undefined)
+ delta = 1000;
+
for (var i = 0; i < 1000; ++i) {
var startDate = Date.now();
var av = eval(a);
@@ -587,11 +595,11 @@ function shouldBeNow(a)
testFailed(a + " is not a number or a Date. Got " + av);
return;
}
- if (date < startDate) {
+ if (date < startDate - delta) {
testFailed(a + " is not the curent time. Got " + av + " which is " + (startDate - date) / 1000 + " seconds in the past.");
return;
}
- if (date > endDate) {
+ if (date > endDate + delta) {
testFailed(a + " is not the current time. Got " + av + " which is " + (date - endDate) / 1000 + " seconds in the future.");
return;
}
« no previous file with comments | « LayoutTests/fast/harness/should-be-now-expected.txt ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698