Bug 1601369 - Fix intermittent browser/components/urlbar/tests/ext/browser/update/browser_installBrowserUpdateAndRestart.js. r=mak
authorDrew Willcoxon <adw@mozilla.com>
Fri, 06 Dec 2019 01:01:44 +0000
changeset 567932 28b2cfb9ddd8cd5a743496b4f5e44b3a15e499f5
parent 567931 c0280f40a19782f3756a6cf57a1a465bbee3d951
child 567933 a9a91a4e774c0cc597e2df031f2ea461fb1947ab
push id12493
push userffxbld-merge
push dateMon, 06 Jan 2020 15:38:57 +0000
treeherdermozilla-beta@63ae456b848d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1601369
milestone73.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 1601369 - Fix intermittent browser/components/urlbar/tests/ext/browser/update/browser_installBrowserUpdateAndRestart.js. r=mak The test needs to wait until the status of the mock update becomes downloadAndInstall before calling `installBrowserUpdateAndRestart`. The test fails intermittently because `installBrowserUpdateAndRestart` bails early if the status isn't that, so the test doesn't continue on the mock update path like it should. I also `await ext.awaitMessage("done")` before continuing with the mock update to make sure the extension has called `installBrowserUpdateAndRestart` first. Try is green after many retriggers: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7c6046c9633a84ccf741dd304a5abb54a6b34adc My earlier attempts at fixing this were orange very quickly, e.g.: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9e650fc0976febe4b0195bede281b40a4473f0d2 Differential Revision: https://phabricator.services.mozilla.com/D55920
browser/components/urlbar/tests/ext/browser/update/browser_installBrowserUpdateAndRestart.js
--- a/browser/components/urlbar/tests/ext/browser/update/browser_installBrowserUpdateAndRestart.js
+++ b/browser/components/urlbar/tests/ext/browser/update/browser_installBrowserUpdateAndRestart.js
@@ -51,35 +51,43 @@ add_task(async function test() {
   let ext = await loadExtension(async () => {
     browser.test.onMessage.addListener(async command => {
       switch (command) {
         case "check":
           await browser.experiments.urlbar.checkForBrowserUpdate();
           browser.test.sendMessage("done");
           break;
         case "install":
-          browser.test.withHandlingUserInput(async () => {
-            await browser.experiments.urlbar.installBrowserUpdateAndRestart();
-            browser.test.sendMessage("done", status);
-          });
+          let done = false;
+          let interval = setInterval(async () => {
+            let status = await browser.experiments.urlbar.getBrowserUpdateStatus();
+            if (status == "downloadAndInstall" && !done) {
+              done = true;
+              clearInterval(interval);
+              browser.test.withHandlingUserInput(async () => {
+                browser.experiments.urlbar.installBrowserUpdateAndRestart();
+                browser.test.sendMessage("done", status);
+              });
+            }
+          }, 100);
           break;
       }
     });
   });
 
   ext.sendMessage("check");
   await ext.awaitMessage("done");
 
   // Set up the "download and install" update state.
   await processUpdateSteps(preSteps);
 
   ext.sendMessage("install");
+  await ext.awaitMessage("done");
 
   await Promise.all([
-    ext.awaitMessage("done"),
     processUpdateSteps(postSteps),
     TestUtils.topicObserved(
       "quit-application-requested",
       (cancelQuit, data) => {
         if (data == "restart") {
           cancelQuit.QueryInterface(Ci.nsISupportsPRBool).data = true;
           return true;
         }