Bug 1274134 - Intermittent browser_ext_history.js | no results returned for late start time - Expected: 0, Actual: 2. r=aswan
authorBob Silverberg <bsilverberg@mozilla.com>
Thu, 19 May 2016 08:32:10 -0400
changeset 337983 ae6c0fa8384e4bbdc12b0f5a19211a371259c23e
parent 337982 ef9331b59ca8847b0162902dc11d805a301e1c7a
child 337984 b050868120226fbcf67bf0c4d162755ea656f7ac
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1274134
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274134 - Intermittent browser_ext_history.js | no results returned for late start time - Expected: 0, Actual: 2. r=aswan The test assumes that Date.now() will provide a date that is far enough in the future to return 0 results, because the history should have been added before that code is run, but evidently sometimes it is not. Changing the date used as a late start date to one day in the future, which should address this issue. MozReview-Commit-ID: KUSyfvtE2B0
browser/components/extensions/test/browser/browser_ext_history.js
--- a/browser/components/extensions/test/browser/browser_ext_history.js
+++ b/browser/components/extensions/test/browser/browser_ext_history.js
@@ -104,38 +104,40 @@ add_task(function* test_delete() {
 });
 
 add_task(function* test_search() {
   const SINGLE_VISIT_URL = "http://example.com/";
   const DOUBLE_VISIT_URL = "http://example.com/2/";
   const MOZILLA_VISIT_URL = "http://mozilla.com/";
 
   function background() {
+    const futureTime = Date.now() + 24 * 60 * 60 * 1000;
+
     browser.test.onMessage.addListener(msg => {
       browser.history.search({text: ""}).then(results => {
         browser.test.sendMessage("empty-search", results);
         return browser.history.search({text: "mozilla.com"});
       }).then(results => {
         browser.test.sendMessage("text-search", results);
         return browser.history.search({text: "example.com", maxResults: 1});
       }).then(results => {
         browser.test.sendMessage("max-results-search", results);
-        return browser.history.search({text: "", startTime: Date.now()});
+        return browser.history.search({text: "", startTime: futureTime});
       }).then(results => {
         browser.test.assertEq(0, results.length, "no results returned for late start time");
         return browser.history.search({text: "", endTime: 0});
       }).then(results => {
         browser.test.assertEq(0, results.length, "no results returned for early end time");
         return browser.history.search({text: "", startTime: Date.now(), endTime: 0});
       }).then(results => {
         browser.test.fail("history.search rejects with startTime that is after the endTime");
       }, error => {
         browser.test.assertEq(
+          "The startTime cannot be after the endTime",
           error.message,
-          "The startTime cannot be after the endTime",
           "history.search rejects with startTime that is after the endTime");
       }).then(() => {
         browser.test.notifyPass("search");
       });
     });
 
     browser.test.sendMessage("ready");
   }