Skip to content

Commit

Permalink
Double threshold in timeOrigin test
Browse files Browse the repository at this point in the history
This CL doubles the thresholds of tests that would fail if we allowed
arbitrarily long interruptions to the test execution. This attempts to
make them less flaky in slower machines.

Bug: chromium:752574
Change-Id: I9b3610a44ca5199b8a906dbe9715d280bd3439c5
Reviewed-on: https://chromium-review.googlesource.com/602381
WPT-Export-Revision: 067afcad3f2d6a59d7859b52728333f97c3e7594
  • Loading branch information
npm1 authored and chromium-wpt-export-bot committed Aug 4, 2017
1 parent 3ac1302 commit c29ff24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hr-time/timeOrigin.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
test(() => {
const startTime = Date.now();
assert_greater_than_equal(startTime, windowOrigin, 'Date.now() should be at least as large as the window timeOrigin.');
assert_less_than(startTime - windowOrigin, 500, 'Date.now() should be close to window timeOrigin.');
assert_less_than(startTime - windowOrigin, 1000, 'Date.now() should be close to window timeOrigin.');
}, 'Window timeOrigin is close to Date.now() when there is no system clock adjustment.');

const workerScript = 'postMessage({timeOrigin: performance.timeOrigin})';
Expand All @@ -22,7 +22,7 @@
worker.addEventListener('message', t.step_func_done(function(event) {
const workerOrigin = event.data.timeOrigin;
assert_greater_than(workerOrigin, windowOrigin, 'Worker timeOrigin should be greater than the window timeOrigin.');
assert_less_than(workerOrigin - windowOrigin, 500, 'Window and worker timeOrigins should be close.');
assert_less_than(workerOrigin - windowOrigin, 1000, 'Window and worker timeOrigins should be close.');
}));
}, 'Window and worker timeOrigins are close when created one after another.');

Expand All @@ -32,7 +32,7 @@
const worker = new Worker(URL.createObjectURL(blob));
worker.addEventListener('message', t.step_func_done(function(event) {
const workerOrigin = event.data.timeOrigin;
assert_less_than(workerOrigin - windowOrigin - workerCreation, 100, 'Difference between worker and window timeOrigins should roughly be equal to performance.now() at time of creation.');
assert_less_than(workerOrigin - windowOrigin - workerCreation, 200, 'Difference between worker and window timeOrigins should roughly be equal to performance.now() at time of creation.');
assert_greater_than(workerOrigin - windowOrigin, 200, 'We waited 200ms to spawn the second worker, so its timeOrigin should be much greater than that of the window.');
}));
}, 200);
Expand Down

0 comments on commit c29ff24

Please # to comment.