Bug 662178 - Harden test_utils_namedTimer.js. r=rnewman

This commit is contained in:
Philipp von Weitershausen 2011-06-08 18:12:12 +02:00
Родитель 47b1aab0b3
Коммит 49004370ec
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -28,7 +28,9 @@ add_test(function test_simple() {
do_check_eq(this, that);
do_check_eq(this._zetimer, null);
do_check_true(timer instanceof Ci.nsITimer);
do_check_true((Date.now() - t0) >= delay);
// Difference should be ~delay, but hard to predict on all platforms,
// particularly Windows XP.
do_check_true(Date.now() > t0);
run_next_test();
}, delay, that, "_zetimer");
});
@ -40,8 +42,9 @@ add_test(function test_delay() {
let that = {};
let t0 = Date.now();
function callback(timer) {
// The 2nd delay counts.
do_check_true((Date.now() - t0) >= 2 * delay);
// Difference should be ~2*delay, but hard to predict on all platforms,
// particularly Windows XP.
do_check_true((Date.now() - t0) > delay);
run_next_test();
}
Utils.namedTimer(callback, delay, that, "_zetimer");