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

Unified Diff: test/mjsunit/fixed-date.js

Issue 1160143004: Introduce a flag to overwrite Date.now() with a fixed value (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/runtime/runtime-date.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/fixed-date.js
diff --git a/test/mjsunit/fixed-date.js b/test/mjsunit/fixed-date.js
new file mode 100644
index 0000000000000000000000000000000000000000..5a684b0605ced3c12e06a7b3af970a27c003a040
--- /dev/null
+++ b/test/mjsunit/fixed-date.js
@@ -0,0 +1,11 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --fixed-date=42940800
+
+var Jan1_2014_millis = 1388534400000;
+var fixed_date_secs = 42940800;
+assertEquals(Date.now(), Jan1_2014_millis + fixed_date_secs * 1000);
+assertEquals(Date.now(), Jan1_2014_millis + fixed_date_secs * 1000);
+assertEquals(new Date().valueOf(), Jan1_2014_millis + fixed_date_secs * 1000);
« no previous file with comments | « src/runtime/runtime-date.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698