Bug 1082572 - Print timeDelta and check for at least half time. r=Mardak, a=test-only
--- a/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
+++ b/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
@@ -1300,24 +1300,26 @@ add_task(function test_timeSensetiveSugg
isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], ["hrblock.com", "1040.com"]);
do_check_eq(link.frecency, SUGGESTED_FRECENCY);
do_check_eq(link.type, "affiliate");
do_check_eq(link.url, suggestedTile.url);
let timeDelta = Date.now() - testStartTime;
if (!deleteFlag) {
// this is start timeout corresponding to campaign start
// a seconds must pass and targetedSite must be set
- do_check_true(timeDelta >= 1000);
+ do_print("TESTING START timeDelta: " + timeDelta);
+ do_check_true(timeDelta >= 1000 / 2); // check for at least half time
do_check_eq(link.targetedSite, "hrblock.com");
do_check_true(DirectoryLinksProvider._campaignTimeoutID);
}
else {
// this is the campaign end timeout, so 3 seconds must pass
// and timeout should be cleared
- do_check_true(timeDelta >= 3000);
+ do_print("TESTING END timeDelta: " + timeDelta);
+ do_check_true(timeDelta >= 3000 / 2); // check for at least half time
do_check_false(link.targetedSite);
do_check_false(DirectoryLinksProvider._campaignTimeoutID);
resolve();
}
};
});
}