Bug 1384381 - Intermittent failures in browser_privatebrowsing_placestitle.js and browser_privatebrowsing_placesTitleNoUpdate.js. r=standard8
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 29 Aug 2017 18:45:36 +0200
changeset 377640 fd00228df86b08c5efd4252e97df80d774c14a24
parent 377639 02b4ffb8bcf020190d0a962be8092073c5331844
child 377641 af5b39d08a73a40519692e067406b76809dc4d63
push id32412
push userarchaeopteryx@coole-files.de
push dateWed, 30 Aug 2017 08:45:09 +0000
treeherdermozilla-central@ae9e6b6d3132 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstandard8
bugs1384381
milestone57.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 1384381 - Intermittent failures in browser_privatebrowsing_placestitle.js and browser_privatebrowsing_placesTitleNoUpdate.js. r=standard8 MozReview-Commit-ID: 8nvln9OLx9S
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placesTitleNoUpdate.js
@@ -17,30 +17,31 @@ add_task(async function test() {
   let promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_URL);
   registerCleanupFunction(async () => {
     await BrowserTestUtils.removeTab(tab);
   });
   info("Wait for a title change notification.");
   await promiseTitleChanged;
-  is((await PlacesUtils.history.fetch(TEST_URL)).title, TITLE_1,
-     "The title matches the orignal title after first visit");
+  await BrowserTestUtils.waitForCondition(async function() {
+    return (await PlacesUtils.history.fetch(TEST_URL)).title == TITLE_1;
+  }, "The title matches the orignal title after first visit");
 
   promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await PlacesTestUtils.addVisits({ uri: TEST_URL, title: TITLE_2 });
   info("Wait for a title change notification.");
   await promiseTitleChanged;
-  is((await PlacesUtils.history.fetch(TEST_URL)).title, TITLE_2,
-     "The title matches the orignal title after updating visit");
+  await BrowserTestUtils.waitForCondition(async function() {
+    return (await PlacesUtils.history.fetch(TEST_URL)).title == TITLE_2;
+  }, "The title matches the orignal title after updating visit");
 
   let privateWin = await BrowserTestUtils.openNewBrowserWindow({private: true});
   registerCleanupFunction(async () => {
     await BrowserTestUtils.closeWindow(privateWin);
   });
   await BrowserTestUtils.openNewForegroundTab(privateWin.gBrowser, TEST_URL);
   // Wait long enough to be sure history didn't set a title.
   await new Promise(resolve => setTimeout(resolve, 1000));
   is((await PlacesUtils.history.fetch(TEST_URL)).title, TITLE_2,
      "The title remains the same after visiting in private window");
 });
-
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_placestitle.js
@@ -25,34 +25,37 @@ add_task(async function test() {
   registerCleanupFunction(async () => {
     await BrowserTestUtils.closeWindow(win);
   });
 
   let promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
   await promiseTitleChanged;
-  is((await PlacesUtils.history.fetch(TEST_URL)).title, "No Cookie",
-     "The page should be loaded without any cookie for the first time");
+  await BrowserTestUtils.waitForCondition(async function() {
+    return (await PlacesUtils.history.fetch(TEST_URL)).title == "No Cookie";
+  }, "The page should be loaded without any cookie for the first time");
 
   promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
   await promiseTitleChanged;
-  is((await PlacesUtils.history.fetch(TEST_URL)).title, "Cookie",
-     "The page should be loaded with a cookie for the second time");
+  await BrowserTestUtils.waitForCondition(async function() {
+    return (await PlacesUtils.history.fetch(TEST_URL)).title == "Cookie";
+  }, "The page should be loaded with a cookie for the second time");
 
   await cleanup();
 
   promiseTitleChanged = PlacesTestUtils.waitForNotification(
     "onTitleChanged", (uri, title) => uri.spec == TEST_URL, "history");
   await BrowserTestUtils.openNewForegroundTab(win.gBrowser, TEST_URL);
   await promiseTitleChanged;
-  is((await PlacesUtils.history.fetch(TEST_URL)).title, "No Cookie",
-     "The page should be loaded without any cookie again");
+  await BrowserTestUtils.waitForCondition(async function() {
+    return (await PlacesUtils.history.fetch(TEST_URL)).title == "No Cookie";
+  }, "The page should be loaded without any cookie again");
 
   // Reopen the page in a private browser window, it should not notify a title
   // change.
   let win2 = await BrowserTestUtils.openNewBrowserWindow({private: true});
   registerCleanupFunction(async () => {
     let promisePBExit = TestUtils.topicObserved("last-pb-context-exited");
     await BrowserTestUtils.closeWindow(win2);
     await promisePBExit;