Bug 1356001 - Set MOZ_TEST_SKIP_UPDATE_STAGE in tests draft
authorDoug Thayer <dothayer@mozilla.com>
Wed, 12 Apr 2017 14:04:18 -0700
changeset 562381 81297f51ed227f4573923e5f9ca5a9c6f106b6b1
parent 562355 3243c8fc3ce7831dda843b60d6bb2d7e4acf1fd4
child 624231 8b985514f1c5fc737d3c063aa0304c15f8b82c59
push id54017
push userbmo:dothayer@mozilla.com
push dateThu, 13 Apr 2017 20:47:58 +0000
bugs1356001
milestone55.0a1
Bug 1356001 - Set MOZ_TEST_SKIP_UPDATE_STAGE in tests "The existing mochitest chrome tests do this since tests that stage have periodically timed out due to having to copy the installation directory... especially on Linux." (from bug) MozReview-Commit-ID: 7Gqqa9hLGVl
browser/base/content/test/appUpdate/head.js
--- a/browser/base/content/test/appUpdate/head.js
+++ b/browser/base/content/test/appUpdate/head.js
@@ -23,16 +23,19 @@ const LOG_FUNCTION = info;
 /* import-globals-from testConstants.js */
 Services.scriptloader.loadSubScript(DATA_URI_SPEC + "testConstants.js", this);
 /* import-globals-from ../../../../../toolkit/mozapps/update/tests/data/shared.js */
 Services.scriptloader.loadSubScript(DATA_URI_SPEC + "shared.js", this);
 
 var gURLData = URL_HOST + "/" + REL_PATH_DATA;
 const URL_MANUAL_UPDATE = gURLData + "downloadPage.html";
 
+const gEnv = Cc["@mozilla.org/process/environment;1"].
+             getService(Components.interfaces.nsIEnvironment);
+
 const NOTIFICATIONS = [
   "update-available",
   "update-manual",
   "update-restart"
 ];
 
 /**
  * Delay for a very short period. Useful for moving the code after this
@@ -95,21 +98,23 @@ function setUpdateTimerPrefs() {
  *         A list of test steps to perform, specifying expected doorhangers
  *         and additional validation/cleanup callbacks.
  * @return A promise which will resolve once all of the steps have been run
  *         and cleanup has been performed.
  */
 function runUpdateTest(updateParams, checkAttempts, steps) {
   return Task.spawn(function*() {
     registerCleanupFunction(() => {
+      gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "");
       gMenuButtonUpdateBadge.uninit();
       gMenuButtonUpdateBadge.init();
       cleanUpUpdates();
     });
 
+    gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "1");
     setUpdateTimerPrefs();
     yield SpecialPowers.pushPrefEnv({
       set: [
         [PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS, 0],
         [PREF_APP_UPDATE_ENABLED, true],
         [PREF_APP_UPDATE_IDLETIME, 0],
         [PREF_APP_UPDATE_URL_MANUAL, URL_MANUAL_UPDATE],
         [PREF_APP_UPDATE_LOG, DEBUG_AUS_TEST],
@@ -150,21 +155,23 @@ function runUpdateTest(updateParams, che
  *         A list of test steps to perform, specifying expected doorhangers
  *         and additional validation/cleanup callbacks.
  * @return A promise which will resolve once all of the steps have been run
  *         and cleanup has been performed.
  */
 function runUpdateProcessingTest(updates, steps) {
   return Task.spawn(function*() {
     registerCleanupFunction(() => {
+      gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "");
       gMenuButtonUpdateBadge.reset();
       cleanUpUpdates();
     });
 
     setUpdateTimerPrefs();
+    gEnv.set("MOZ_TEST_SKIP_UPDATE_STAGE", "1");
     SpecialPowers.pushPrefEnv({
       set: [
         [PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS, 0],
         [PREF_APP_UPDATE_ENABLED, true],
         [PREF_APP_UPDATE_IDLETIME, 0],
         [PREF_APP_UPDATE_URL_MANUAL, URL_MANUAL_UPDATE],
         [PREF_APP_UPDATE_LOG, DEBUG_AUS_TEST],
       ]});