Bug 1552139 - fix race condition in doorhanger startup processing tests. r=bytesized
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 16 May 2019 17:41:42 +0000
changeset 474214 f3b9043b4ab15a95c32835dce9c64e76f4a7fa6c
parent 474213 b0887a64bb5fa71d8a2428579f581c7a8dadddf2
child 474215 3200f7d369342c9c42dce3088211631deb0f52fb
push id113144
push usershindli@mozilla.com
push dateFri, 17 May 2019 16:44:55 +0000
treeherdermozilla-inbound@f4c4b796f845 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1552139
milestone68.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 1552139 - fix race condition in doorhanger startup processing tests. r=bytesized Makes the startup processing doorhanger tests immediately reload the update manager after writing the active-update.xml so there isn't a race Reverts the doorhanger tests to waiting for the popupshown even since that wasn't failing previously Sets the app.update.badgeWaitTime and app.update.promptWaitTime prefs so non-doorhanger tests don't display the doorhanger as often Changes browser_doorhanger_bc_downloadOptIn_staging.js to use the app.update.promptWaitTime so it tests that the pref works Added a call to UpdateListener.reset() to reset UpdateListener during the common test setup Added a call to AppMenuNotifications.removeNotification(/.*/) to remove doorhangers when a test finishes Differential Revision: https://phabricator.services.mozilla.com/D31479
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_cantApply.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_malformedXML.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_unsupported.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadAutoFailures.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadAutoFailures_bgWin.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn_bgWin.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn_staging.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloaded.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloaded_staged.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_completeBadSize.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize_complete.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize_completeBadSize.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_completeApplyFailure.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_complete.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js
toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_complete_staging.js
toolkit/mozapps/update/tests/browser/head.js
toolkit/mozapps/update/tests/data/shared.js
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_cantApply.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_cantApply.js
@@ -1,18 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_check_cantApply() {
   lockWriteTestFile();
 
-  let updateParams = "&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-manual",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDetailsURL,
                  manual: URL_MANUAL_UPDATE},
     },
   ]);
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_malformedXML.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_malformedXML.js
@@ -6,18 +6,19 @@
 add_task(async function doorhanger_bc_check_malformedXML() {
   const maxBackgroundErrors = 10;
   await SpecialPowers.pushPrefEnv({
     set: [
       [PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
     ],
   });
 
-  let updateParams = "&xmlMalformed=1";
-  await runDoorhangerUpdateTest(updateParams, maxBackgroundErrors, [
+  let params = {checkAttempts: maxBackgroundErrors,
+                queryString: "&xmlMalformed=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       // If the update check fails 10 consecutive attempts then the manual
       // update doorhanger.
       notificationId: "update-manual",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDetailsURL,
                  manual: URL_MANUAL_UPDATE},
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_unsupported.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_check_unsupported.js
@@ -1,18 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 // Test for doorhanger background check for updates
 // with an unsupported update.
 add_task(async function doorhanger_bc_check_unsupported() {
-  let updateParams = "&unsupported=1";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&unsupported=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-unsupported",
       button: "button",
       pageURLs: {manual: gDetailsURL},
     },
     async function doorhanger_unsupported_persist() {
       is(PanelUI.notificationPanel.state, "closed",
          "The window's doorhanger is closed.");
@@ -31,20 +32,21 @@ add_task(async function doorhanger_bc_ch
       UpdateListener.init();
       is(PanelUI.notificationPanel.state, "closed",
          "The window's doorhanger is closed.");
       ok(PanelUI.menuButton.hasAttribute("badge-status"),
          "The window has a badge.");
       is(PanelUI.menuButton.getAttribute("badge-status"), "update-unsupported",
          "The correct badge is showing for the background window.");
     },
- ]);
+  ]);
 
-  updateParams = "&invalidCompleteSize=1&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  params = {checkAttempts: 1,
+            queryString: "&invalidCompleteSize=1&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_PENDING},
     },
     async function doorhanger_unsupported_removed() {
       // Test that finding an update removes the app.update.unsupported.url
       // preference.
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadAutoFailures.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadAutoFailures.js
@@ -6,18 +6,19 @@
 add_task(async function doorhanger_bc_downloadAutoFailures() {
   const maxBackgroundErrors = 5;
   await SpecialPowers.pushPrefEnv({
     set: [
       [PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
     ],
   });
 
-  let updateParams = "&badURL=1";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&badURL=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       // If the update download fails maxBackgroundErrors download attempts then
       // show the update available prompt.
       notificationId: "update-available",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL},
     },
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadAutoFailures_bgWin.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadAutoFailures_bgWin.js
@@ -38,18 +38,19 @@ add_task(async function doorhanger_bc_do
     set: [
       [PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
     ],
   });
 
   let extraWindow = await BrowserTestUtils.openNewBrowserWindow();
   await SimpleTest.promiseFocus(extraWindow);
 
-  let updateParams = "&badURL=1";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&badURL=1"};
+  await runDoorhangerUpdateTest(params, [
     getBackgroundWindowHandler(false),
     getBackgroundWindowHandler(true),
     {
       // If the update process is unable to install the update show the manual
       // update doorhanger.
       notificationId: "update-manual",
       button: "button",
       checkActiveUpdate: null,
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn.js
@@ -1,18 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_downloadOptIn() {
   await UpdateUtils.setAppUpdateAutoEnabled(false);
 
-  let updateParams = "&invalidCompleteSize=1&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&invalidCompleteSize=1&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-available",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL},
     },
     {
       notificationId: "update-restart",
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn_bgWin.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn_bgWin.js
@@ -33,18 +33,19 @@ add_task(async function doorhanger_bc_do
     };
   }
 
   await UpdateUtils.setAppUpdateAutoEnabled(false);
 
   let extraWindow = await BrowserTestUtils.openNewBrowserWindow();
   await SimpleTest.promiseFocus(extraWindow);
 
-  let updateParams = "&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     getBackgroundWindowHandler(),
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_PENDING},
     },
   ]);
 });
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn_staging.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloadOptIn_staging.js
@@ -1,23 +1,26 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_downloadOptIn_staging() {
   await SpecialPowers.pushPrefEnv({
     set: [
+      // Tests the app.update.promptWaitTime pref
+      [PREF_APP_UPDATE_PROMPTWAITTIME, 0],
       [PREF_APP_UPDATE_STAGING_ENABLED, true],
     ],
   });
   await UpdateUtils.setAppUpdateAutoEnabled(false);
 
-  let updateParams = "&invalidCompleteSize=1&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&invalidCompleteSize=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-available",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL},
     },
     {
       notificationId: "update-restart",
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloaded.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloaded.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_downloaded() {
-  let updateParams = "&invalidCompleteSize=1&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&invalidCompleteSize=1&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_PENDING},
     },
   ]);
 });
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloaded_staged.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_downloaded_staged.js
@@ -5,17 +5,18 @@
 
 add_task(async function doorhanger_bc_downloaded_staged() {
   await SpecialPowers.pushPrefEnv({
     set: [
       [PREF_APP_UPDATE_STAGING_ENABLED, true],
     ],
   });
 
-  let updateParams = "&invalidCompleteSize=1&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&invalidCompleteSize=1&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_APPLIED},
     },
   ]);
 });
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_completeBadSize.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_completeBadSize.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_patch_completeBadSize() {
-  let updateParams = "&completePatchOnly=1&invalidCompleteSize=1";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&completePatchOnly=1&invalidCompleteSize=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       // If the update download fails maxBackgroundErrors download attempts then
       // show the update available prompt.
       notificationId: "update-available",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL},
     },
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_patch_partialBadSize() {
-  let updateParams = "&partialPatchOnly=1&invalidPartialSize=1";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&partialPatchOnly=1&invalidPartialSize=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       // If the update download fails maxBackgroundErrors download attempts then
       // show the update available prompt.
       notificationId: "update-available",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL},
     },
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize_complete.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize_complete.js
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_patch_partialBadSize_complete() {
-  let updateParams = "&invalidPartialSize=1&promptWaitTime=0";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&invalidPartialSize=1&promptWaitTime=0"};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_PENDING},
     },
   ]);
 });
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize_completeBadSize.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_bc_patch_partialBadSize_completeBadSize.js
@@ -1,16 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 add_task(async function doorhanger_bc_patch_partialBadSize_completeBadSize() {
-  let updateParams = "&invalidPartialSize=1&invalidCompleteSize=1";
-  await runDoorhangerUpdateTest(updateParams, 1, [
+  let params = {checkAttempts: 1,
+                queryString: "&invalidPartialSize=1&invalidCompleteSize=1"};
+  await runDoorhangerUpdateTest(params, [
     {
       // If the update download fails maxBackgroundErrors download attempts then
       // show the update available prompt.
       notificationId: "update-available",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL},
     },
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_completeApplyFailure.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_completeApplyFailure.js
@@ -3,20 +3,19 @@
 
 "use strict";
 
 add_task(async function doorhanger_sp_patch_completeApplyFailure() {
   let patchProps = {state: STATE_PENDING};
   let patches = getLocalPatchString(patchProps);
   let updateProps = {checkInterval: "1"};
   let updates = getLocalUpdateString(updateProps, patches);
-  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
-  let updateParams = "";
-  await runDoorhangerUpdateTest(updateParams, 0, [
+  let params = {updates};
+  await runDoorhangerUpdateTest(params, [
     {
       // If the update process is unable to install the update show the manual
       // update doorhanger.
       notificationId: "update-manual",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL,
                  manual: URL_MANUAL_UPDATE},
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure.js
@@ -5,20 +5,19 @@
 
 add_task(async function doorhanger_sp_patch_partialApplyFailure() {
   let patchProps = {type: "partial",
                     state: STATE_PENDING};
   let patches = getLocalPatchString(patchProps);
   let updateProps = {isCompleteUpdate: "false",
                      checkInterval: "1"};
   let updates = getLocalUpdateString(updateProps, patches);
-  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
-  let updateParams = "";
-  await runDoorhangerUpdateTest(updateParams, 0, [
+  let params = {updates};
+  await runDoorhangerUpdateTest(params, [
     {
       // If there is only an invalid patch show the manual update doorhanger.
       notificationId: "update-manual",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL,
                  manual: URL_MANUAL_UPDATE},
     },
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_complete.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_complete.js
@@ -7,19 +7,18 @@ add_task(async function doorhanger_sp_pa
   let patchProps = {type: "partial",
                     state: STATE_PENDING};
   let patches = getLocalPatchString(patchProps);
   patchProps = {selected: "false"};
   patches += getLocalPatchString(patchProps);
   let updateProps = {isCompleteUpdate: "false",
                      promptWaitTime: "0"};
   let updates = getLocalUpdateString(updateProps, patches);
-  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
-  let updateParams = "";
-  await runDoorhangerUpdateTest(updateParams, 0, [
+  let params = {updates};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_PENDING},
     },
   ]);
 });
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_completeBadSize.js
@@ -15,20 +15,19 @@ add_task(async function doorhanger_sp_pa
   let patchProps = {type: "partial",
                     state: STATE_PENDING};
   let patches = getLocalPatchString(patchProps);
   patchProps = {size: "1234",
                 selected: "false"};
   patches += getLocalPatchString(patchProps);
   let updateProps = {isCompleteUpdate: "false"};
   let updates = getLocalUpdateString(updateProps, patches);
-  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
-  let updateParams = "";
-  await runDoorhangerUpdateTest(updateParams, 0, [
+  let params = {updates};
+  await runDoorhangerUpdateTest(params, [
     {
       // If there is only an invalid patch show the manual update doorhanger.
       notificationId: "update-manual",
       button: "button",
       checkActiveUpdate: null,
       pageURLs: {whatsNew: gDefaultWhatsNewURL,
                  manual: URL_MANUAL_UPDATE},
     },
--- a/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_complete_staging.js
+++ b/toolkit/mozapps/update/tests/browser/browser_doorhanger_sp_patch_partialApplyFailure_complete_staging.js
@@ -13,19 +13,18 @@ add_task(async function doorhanger_sp_pa
   let patchProps = {type: "partial",
                     state: STATE_PENDING};
   let patches = getLocalPatchString(patchProps);
   patchProps = {selected: "false"};
   patches += getLocalPatchString(patchProps);
   let updateProps = {isCompleteUpdate: "false",
                      promptWaitTime: "0"};
   let updates = getLocalUpdateString(updateProps, patches);
-  writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
 
-  let updateParams = "";
-  await runDoorhangerUpdateTest(updateParams, 0, [
+  let params = {updates};
+  await runDoorhangerUpdateTest(params, [
     {
       notificationId: "update-restart",
       button: "secondaryButton",
       checkActiveUpdate: {state: STATE_APPLIED},
     },
   ]);
 });
--- a/toolkit/mozapps/update/tests/browser/head.js
+++ b/toolkit/mozapps/update/tests/browser/head.js
@@ -48,42 +48,46 @@ gDebugTest = false;
 requestLongerTimeout(10);
 
 /**
  * Common tasks to perform for all tests before each one has started.
  */
 add_task(async function setupTestCommon() {
   await SpecialPowers.pushPrefEnv({
     set: [
+      [PREF_APP_UPDATE_BADGEWAITTIME, 1800],
       [PREF_APP_UPDATE_DOWNLOAD_ATTEMPTS, 0],
       [PREF_APP_UPDATE_DOWNLOAD_MAXATTEMPTS, 2],
       [PREF_APP_UPDATE_LOG, gDebugTest],
+      [PREF_APP_UPDATE_PROMPTWAITTIME, 3600],
       [PREF_APP_UPDATE_SERVICE_ENABLED, false],
       // Disable activity stream to prevent errors when opening pages during
       // TV runs. See bug 1548422 for an example.
       ["browser.library.activity-stream.enabled", false],
     ],
   });
 
   setUpdateTimerPrefs();
   removeUpdateFiles(true);
+  UpdateListener.reset();
   AppMenuNotifications.removeNotification(/.*/);
   // Most app update mochitest-browser-chrome tests expect auto update to be
   // enabled. Those that don't will explicitly change this.
   await setAppUpdateAutoEnabledHelper(true);
 });
 
 /**
  * Common tasks to perform for all tests after each one has finished.
  */
 registerCleanupFunction(async () => {
   AppMenuNotifications.removeNotification(/.*/);
   gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "");
   gEnv.set("MOZ_TEST_SLOW_SKIP_UPDATE_STAGE", "");
   UpdateListener.reset();
+  AppMenuNotifications.removeNotification(/.*/);
   reloadUpdateManagerData(true);
   // Pass false when the log files are needed for troubleshooting the tests.
   removeUpdateFiles(true);
   // Always try to restore the original updater files. If none of the updater
   // backup files are present then this is just a no-op.
   await finishTestRestoreUpdaterBackup();
 });
 
@@ -507,47 +511,33 @@ function getPatchOfType(type) {
   }
   return null;
 }
 
 /**
  * Runs a Doorhanger update test. This will set various common prefs for
  * updating and runs the provided list of steps.
  *
- * @param  updateParams
- *         Params which will be sent to app_update.sjs.
- * @param  checkAttempts
- *         How many times to check for updates. Useful for testing the UI
- *         for check failures. If this is 0 then a startup processing test will
- *         be performed.
+ * @param  params
+ *         An object containing parameters used to run the test.
  * @param  steps
  *         An array of test steps to perform. A step will either be an object
  *         containing expected conditions and actions or a function to call.
  * @return A promise which will resolve once all of the steps have been run.
  */
-function runDoorhangerUpdateTest(updateParams, checkAttempts, steps) {
+function runDoorhangerUpdateTest(params, steps) {
   function processDoorhangerStep(step) {
     if (typeof(step) == "function") {
       return step();
     }
 
     const {notificationId, button, checkActiveUpdate, pageURLs} = step;
     return (async function() {
-      await TestUtils.waitForCondition(() =>
-        (PanelUI.notificationPanel.state == "open"),
-        "Waiting on PanelUI.notificationPanel.state to equal open",
-        undefined, 200
-      ).catch(e => {
-        // Instead of throwing let the check below fail the test so the
-        // notification ID and the expected notification ID is printed in the
-        // log.
-        logTestInfo(e);
-      });
-      is(PanelUI.notificationPanel.state, "open",
-         "The PanelUI.notificationPanel.state should equal open");
+      await BrowserTestUtils.waitForEvent(PanelUI.notificationPanel,
+                                          "popupshown");
       const shownNotificationId = AppMenuNotifications.activeNotification.id;
       is(shownNotificationId, notificationId,
          "The right notification showed up.");
 
       if (checkActiveUpdate) {
         ok(!!gUpdateManager.activeUpdate,
            "There should be an active update");
         is(gUpdateManager.activeUpdate.state, checkActiveUpdate.state,
@@ -575,41 +565,43 @@ function runDoorhangerUpdateTest(updateP
   }
 
   return (async function() {
     gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "1");
     await SpecialPowers.pushPrefEnv({
       set: [
         [PREF_APP_UPDATE_DISABLEDFORTESTING, false],
         [PREF_APP_UPDATE_IDLETIME, 0],
+        [PREF_APP_UPDATE_URL_DETAILS, gDetailsURL],
         [PREF_APP_UPDATE_URL_MANUAL, URL_MANUAL_UPDATE],
-        [PREF_APP_UPDATE_URL_DETAILS, gDetailsURL],
       ],
     });
 
     await setupTestUpdater();
 
+    let queryString = params.queryString ? params.queryString : "";
     let updateURL = URL_HTTP_UPDATE_SJS + "?detailsURL=" + gDetailsURL +
-                    updateParams + getVersionParams();
+                    queryString + getVersionParams();
     setUpdateURL(updateURL);
 
-    if (checkAttempts) {
+    if (params.checkAttempts) {
       // Perform a background check doorhanger test.
       executeSoon(() => {
         (async function() {
           gAUS.checkForBackgroundUpdates();
-          for (var i = 0; i < checkAttempts - 1; i++) {
+          for (var i = 0; i < params.checkAttempts - 1; i++) {
             await waitForEvent("update-error", "check-attempt-failed");
             gAUS.checkForBackgroundUpdates();
           }
         })();
       });
     } else {
       // Perform a startup processing doorhanger test.
       writeStatusFile(STATE_FAILED_CRC_ERROR);
+      writeUpdatesToXMLFile(getLocalUpdatesXMLString(params.updates), true);
       reloadUpdateManagerData();
       testPostUpdateProcessing();
     }
 
     for (let step of steps) {
       await processDoorhangerStep(step);
     }
   })();
--- a/toolkit/mozapps/update/tests/data/shared.js
+++ b/toolkit/mozapps/update/tests/data/shared.js
@@ -16,16 +16,17 @@ const {TelemetryTestUtils} =
 ChromeUtils.defineModuleGetter(this, "ctypes",
                                "resource://gre/modules/ctypes.jsm");
 ChromeUtils.defineModuleGetter(this, "UpdateUtils",
                                "resource://gre/modules/UpdateUtils.jsm");
 
 const PREF_APP_UPDATE_AUTO                 = "app.update.auto";
 const PREF_APP_UPDATE_BACKGROUNDERRORS     = "app.update.backgroundErrors";
 const PREF_APP_UPDATE_BACKGROUNDMAXERRORS  = "app.update.backgroundMaxErrors";
+const PREF_APP_UPDATE_BADGEWAITTIME        = "app.update.badgeWaitTime";
 const PREF_APP_UPDATE_BITS_ENABLED         = "app.update.BITS.enabled";
 const PREF_APP_UPDATE_CANCELATIONS         = "app.update.cancelations";
 const PREF_APP_UPDATE_CHANNEL              = "app.update.channel";
 const PREF_APP_UPDATE_DOORHANGER           = "app.update.doorhanger";
 const PREF_APP_UPDATE_DOWNLOAD_MAXATTEMPTS = "app.update.download.maxAttempts";
 const PREF_APP_UPDATE_DOWNLOAD_ATTEMPTS    = "app.update.download.attempts";
 const PREF_APP_UPDATE_DISABLEDFORTESTING   = "app.update.disabledForTesting";
 const PREF_APP_UPDATE_IDLETIME             = "app.update.idletime";