Bug 897789 - Add a fuzz factor to watchdog tests. r=Waldo

CLOSED TREE
This commit is contained in:
Bobby Holley 2013-07-24 23:00:22 -04:00
Родитель 8ae277fbe9
Коммит ba2b09a6d5
1 изменённых файлов: 10 добавлений и 4 удалений

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

@ -144,10 +144,16 @@ function testBody() {
do_log_info("stateChange: " + stateChange / 1000000);
do_log_info("startHibernation: " + startHibernation / 1000000);
do_log_info("stopHibernation: " + stopHibernation / 1000000);
do_check_true(stateChange > now + 10*1000*1000);
do_check_true(startHibernation > now + 2*1000*1000);
do_check_true(startHibernation < now + 5*1000*1000);
do_check_true(stopHibernation > now + 10*1000*1000);
// XPCOM timers, JS times, and PR_Now() are apparently not directly
// comparable, as evidenced by certain seemingly-impossible timing values
// that occasionally get logged in windows automation. We're really just
// making sure this behavior is roughly as expected on the macro scale,
// so we add a 1 second fuzz factor here.
const FUZZ_FACTOR = 1 * 1000 * 1000;
do_check_true(stateChange > now + 10*1000*1000 - FUZZ_FACTOR);
do_check_true(startHibernation > now + 2*1000*1000 - FUZZ_FACTOR);
do_check_true(startHibernation < now + 5*1000*1000 + FUZZ_FACTOR);
do_check_true(stopHibernation > now + 10*1000*1000 - FUZZ_FACTOR);
do_test_finished();
yield;