BUG=
R=jkummerow@chromium.org
Review URL: https://codereview.chromium.org/
24484003
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16948
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
// Tests timer milliseconds granularity.
-var start = Date.now();
-var end = Date.now();
-while (end - start == 0) {
- end = Date.now();
-}
-assertTrue(end - start <= 2);
+(function run() {
+ var start_test = Date.now();
+ // Let the retry run for maximum 20ms to reduce flakiness.
+ for (var start = Date.now(); start - start_test < 100; start = Date.now()) {
+ var end = Date.now();
+ while (end - start == 0) {
+ end = Date.now();
+ }
+ if (end - start == 1) {
+ // Found milliseconds granularity.
+ return;
+ } else {
+ print("Timer difference too big: " + (end - start) + "ms");
+ }
+ }
+ assertTrue(false);
+})()