Bug 1082572 - Print timeDelta and check for at least half time. r=Mardak, a=test-only
authorMaxim Zhilyaev <mzhilyaev@mozilla.com>
Wed, 13 May 2015 01:26:44 -0700
changeset 276858 7fcae55c0881ec363aa95c0331248b72cffaaa30
parent 276857 a126e704b703a707792ca99a33eaf9a1bbaffc94
child 276859 65b16a4f88c8946c4b5e01fa1af537bc1852d786
push id3356
push userbsmedberg@mozilla.com
push dateThu, 09 Jul 2015 21:52:23 +0000
reviewersMardak, test-only
bugs1082572
milestone40.0a2
Bug 1082572 - Print timeDelta and check for at least half time. r=Mardak, a=test-only
browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
--- 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();
         }
       };
     });
   }