Bug 1295896 test code - Remove mock XMLHttpRequest from app update tests. r=mhowell
authorRobert Strong <robert.bugzilla@gmail.com>
Wed, 17 Aug 2016 13:31:07 -0700
changeset 310033 1cb4f99e5d56091ca6adb7bef16af15a41451b46
parent 310032 8dabba1b5342da979ac56a44f1f54d868ec7be3f
child 310034 f09e0ebac665c1bb2c411c85797f349fd95b22f1
push id30576
push userryanvm@gmail.com
push dateFri, 19 Aug 2016 13:53:39 +0000
treeherdermozilla-central@74f332c38a69 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1295896
milestone51.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 1295896 test code - Remove mock XMLHttpRequest from app update tests. r=mhowell
toolkit/mozapps/update/tests/chrome/chrome.ini
toolkit/mozapps/update/tests/chrome/test_0152_notify_backgroundCheckOfflineRetry.xul
toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js
toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js
toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js
toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js
toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js
toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
--- a/toolkit/mozapps/update/tests/chrome/chrome.ini
+++ b/toolkit/mozapps/update/tests/chrome/chrome.ini
@@ -57,16 +57,17 @@ reason = only Windows has the maintenanc
 [test_0121_check_requireBuiltinCert.xul]
 [test_0122_check_allowNonBuiltinCert_validCertAttrs.xul]
 [test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul]
 [test_0131_check_invalidCertAttrs_noUpdate.xul]
 [test_0132_check_invalidCertAttrs_hasUpdate.xul]
 [test_0141_notify_invalidCertAttrs_noUpdate.xul]
 [test_0142_notify_invalidCertAttrs_hasUpdate.xul]
 [test_0151_notify_backgroundCheckError.xul]
+[test_0152_notify_backgroundCheckOfflineRetry.xul]
 [test_0161_check_unsupported.xul]
 [test_0162_notify_unsupported.xul]
 [test_0171_check_noPerms_manual.xul]
 skip-if = os != 'win'
 reason = test must be able to prevent file deletion.
 [test_0172_notify_noPerms_manual.xul]
 skip-if = os != 'win'
 reason = test must be able to prevent file deletion.
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/update/tests/chrome/test_0152_notify_backgroundCheckOfflineRetry.xul
@@ -0,0 +1,96 @@
+<?xml version="1.0"?>
+<!--
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+-->
+
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+
+<window title="Test that an update check that fails due to being offline is performed after going online"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="runTestDefault();">
+<script type="application/javascript"
+        src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+<script type="application/javascript"
+        src="utils.js"/>
+
+<script type="application/javascript">
+<![CDATA[
+
+const TESTS = [ {
+  pageid: PAGEID_FOUND_BASIC,
+  buttonClick: "extra1"
+} ];
+
+const NETWORK_ERROR_OFFLINE = 111;
+var gProxyPrefValue;
+
+function runTest() {
+  debugDump("entering");
+
+  let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams();
+  setUpdateURLOverride(url);
+
+  Services.prefs.setBoolPref(PREF_APP_UPDATE_ENABLED, true);
+  Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
+
+  Services.io.offline = true;
+  gProxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
+  Services.prefs.setIntPref("network.proxy.type", 0);
+
+  gUpdateChecker.checkForUpdates(updateCheckListener, true);
+}
+
+function resetOffline() {
+  Services.prefs.setIntPref("network.proxy.type", gProxyPrefValue);
+  Services.io.offline = false;
+}
+
+/* Update check listener */
+const updateCheckListener = {
+  onProgress: function UCL_onProgress(aRequest, aPosition, aTotalSize) {
+  },
+
+  onCheckComplete: function UCL_onCheckComplete(aRequest, aUpdates, aUpdateCount) {
+    let status = aRequest.status;
+    if (status == 0) {
+      status = aRequest.channel.QueryInterface(Ci.nsIRequest).status;
+    }
+    debugDump("url = " + aRequest.channel.originalURI.spec + ", " +
+              "request.status = " + status + ", " +
+              "updateCount = " + aUpdateCount);
+    ok(false, "Unexpected updateCheckListener::onCheckComplete called");
+  },
+
+  onError: function UCL_onError(aRequest, aUpdate) {
+    let status = aRequest.status;
+    if (status == 0) {
+      status = aRequest.channel.QueryInterface(Ci.nsIRequest).status;
+    }
+    is(status, Cr.NS_ERROR_OFFLINE,
+       "checking the request status value");
+    is(aUpdate.errorCode, NETWORK_ERROR_OFFLINE,
+       "checking the update error code");
+    debugDump("url = " + aRequest.channel.originalURI.spec + ", " +
+              "request.status = " + status + ", " +
+              "update.statusText = " +
+              (aUpdate.statusText ? aUpdate.statusText : "null"));
+    gAUS.onError(aRequest, aUpdate);
+    // Use a timeout to allow the XHR to complete
+    SimpleTest.executeSoon(resetOffline);
+  },
+
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIUpdateCheckListener])
+};
+
+]]>
+</script>
+
+<body xmlns="http://www.w3.org/1999/xhtml">
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test"></pre>
+</body>
+</window>
--- a/toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellConstantsPP.js
@@ -48,18 +48,18 @@ const IS_ANDROID = false;
 
 #ifdef MOZ_WIDGET_GONK
 const IS_TOOLKIT_GONK = true;
 #else
 const IS_TOOLKIT_GONK = false;
 #endif
 
 #ifdef MOZ_VERIFY_MAR_SIGNATURE
-const IS_MAR_CHECKS_ENABLED = true;
+const MOZ_VERIFY_MAR_SIGNATURE = true;
 #else
-const IS_MAR_CHECKS_ENABLED = false;
+const MOZ_VERIFY_MAR_SIGNATURE = false;
 #endif
 
 #ifdef DISABLE_UPDATER_AUTHENTICODE_CHECK
  const IS_AUTHENTICODE_CHECK_ENABLED = false;
 #else
  const IS_AUTHENTICODE_CHECK_ENABLED = true;
 #endif
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -121,16 +121,18 @@ const HELPER_SLEEP_TIMEOUT = 180;
 // Maximum number of milliseconds the process that is launched can run before
 // the test will try to kill it.
 const APP_TIMER_TIMEOUT = 120000;
 
 const PIPE_TO_NULL = IS_WIN ? ">nul" : "> /dev/null 2>&1";
 
 const LOG_FUNCTION = do_print;
 
+const gHTTPHandlerPath = "updates.xml";
+
 // This default value will be overridden when using the http server.
 var gURLData = URL_HOST + "/";
 
 var gTestID;
 
 var gTestserver;
 
 var gRegisteredServiceCleanup;
@@ -1108,30 +1110,16 @@ function checkPostUpdateRunningFile(aSho
  */
 function standardInit() {
   createAppInfo("xpcshell@tests.mozilla.org", APP_INFO_NAME, "1.0", "2.0");
   // Initialize the update service stub component
   initUpdateServiceStub();
 }
 
 /**
- * Custom path handler for the http server
- *
- * @param   aMetadata
- *          The http metadata for the request.
- * @param   aResponse
- *          The http response for the request.
- */
-function pathHandler(aMetadata, aResponse) {
-  aResponse.setHeader("Content-Type", "text/xml", false);
-  aResponse.setStatusLine(aMetadata.httpVersion, gResponseStatusCode, "OK");
-  aResponse.bodyOutputStream.write(gResponseBody, gResponseBody.length);
-}
-
-/**
  * Helper function for getting the application version from the application.ini
  * file. This will look in both the GRE and the application directories for the
  * application.ini file.
  *
  * @return  The version string from the application.ini file.
  */
 function getAppVersion() {
   // Read the application.ini and use its application version.
@@ -3580,92 +3568,16 @@ function checkFilesInDirRecursive(aDir, 
         checkFilesInDirRecursive(entry, aCallback);
       } else {
         aCallback(entry);
       }
     }
   }
 }
 
-/**
- * Sets up the bare bones XMLHttpRequest implementation below.
- *
- * @param   aCallback
- *          The callback function that will call the nsIDomEventListener's
- *          handleEvent method.
- *
- *          Example of the callback function
- *
- *            function callHandleEvent(aXHR) {
- *              aXHR.status = gExpectedStatus;
- *              let e = { target: aXHR };
- *              aXHR.onload.handleEvent(e);
- *            }
- */
-function overrideXHR(aCallback) {
-  Cu.import("resource://testing-common/MockRegistrar.jsm");
-  MockRegistrar.register("@mozilla.org/xmlextras/xmlhttprequest;1", xhr, [aCallback]);
-}
-
-/**
- * Bare bones XMLHttpRequest implementation for testing onprogress, onerror,
- * and onload nsIDomEventListener handleEvent.
- */
-function makeHandler(aVal) {
-  if (typeof aVal == "function") {
-    return { handleEvent: aVal };
-  }
-  return aVal;
-}
-function xhr(aCallback) {
-  this._callback = aCallback;
-}
-xhr.prototype = {
-  overrideMimeType: function(aMimetype) { },
-  setRequestHeader: function(aHeader, aValue) { },
-  status: null,
-  channel: {
-    set notificationCallbacks(aVal) { },
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIChannel])
-  },
-  _url: null,
-  _method: null,
-  open: function(aMethod, aUrl) {
-    this.channel.originalURI = Services.io.newURI(aUrl, null, null);
-    this._method = aMethod; this._url = aUrl;
-  },
-  responseXML: null,
-  responseText: null,
-  send: function(aBody) {
-    do_execute_soon(function() {
-      this._callback(this);
-    }.bind(this)); // Use a timeout so the XHR completes
-  },
-  _onprogress: null,
-  set onprogress(aValue) { this._onprogress = makeHandler(aValue); },
-  get onprogress() { return this._onprogress; },
-  _onerror: null,
-  set onerror(aValue) { this._onerror = makeHandler(aValue); },
-  get onerror() { return this._onerror; },
-  _onload: null,
-  set onload(aValue) { this._onload = makeHandler(aValue); },
-  get onload() { return this._onload; },
-  addEventListener: function(aEvent, aValue, aCapturing) {
-    eval("this._on" + aEvent + " = aValue");
-  },
-  flags: Ci.nsIClassInfo.SINGLETON,
-  getScriptableHelper: () => null,
-  getInterfaces: function(aCount) {
-    let interfaces = [Ci.nsISupports];
-    aCount.value = interfaces.length;
-    return interfaces;
-  },
-  get wrappedJSObject() { return this; },
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIClassInfo])
-};
 
 /**
  * Helper function to override the update prompt component to verify whether it
  * is called or not.
  *
  * @param   aCallback
  *          The callback to call if the update prompt component is called.
  */
@@ -3722,16 +3634,19 @@ const updateCheckListener = {
               "updateCount = " + aUpdateCount);
     // Use a timeout to allow the XHR to complete
     do_execute_soon(gCheckFunc);
   },
 
   onError: function UCL_onError(aRequest, aUpdate) {
     gRequestURL = aRequest.channel.originalURI.spec;
     gStatusCode = aRequest.status;
+    if (gStatusCode == 0) {
+      gStatusCode = aRequest.channel.QueryInterface(Ci.nsIRequest).status;
+    }
     gStatusText = aUpdate.statusText ? aUpdate.statusText : null;
     debugDump("url = " + gRequestURL + ", " +
               "request.status = " + gStatusCode + ", " +
               "update.statusText = " + gStatusText);
     // Use a timeout to allow the XHR to complete
     do_execute_soon(gCheckFunc.bind(null, aRequest, aUpdate));
   },
 
@@ -3769,23 +3684,38 @@ function start_httpserver() {
   if (!dir.isDirectory()) {
     do_throw("A file instead of a directory was specified for HttpServer " +
              "registerDirectory! Path: " + dir.path);
   }
 
   let { HttpServer } = Cu.import("resource://testing-common/httpd.js", {});
   gTestserver = new HttpServer();
   gTestserver.registerDirectory("/", dir);
+  gTestserver.registerPathHandler("/" + gHTTPHandlerPath, pathHandler);
   gTestserver.start(-1);
   let testserverPort = gTestserver.identity.primaryPort;
   gURLData = URL_HOST + ":" + testserverPort + "/";
   debugDump("http server port = " + testserverPort);
 }
 
 /**
+ * Custom path handler for the http server
+ *
+ * @param   aMetadata
+ *          The http metadata for the request.
+ * @param   aResponse
+ *          The http response for the request.
+ */
+function pathHandler(aMetadata, aResponse) {
+  aResponse.setHeader("Content-Type", "text/xml", false);
+  aResponse.setStatusLine(aMetadata.httpVersion, gResponseStatusCode, "OK");
+  aResponse.bodyOutputStream.write(gResponseBody, gResponseBody.length);
+}
+
+/**
  * Helper for stopping the http server used by the tests
  *
  * @param   aCallback
  *          The callback to call after stopping the http server.
  */
 function stop_httpserver(aCallback) {
   Assert.ok(!!aCallback, "the aCallback parameter should be defined");
   gTestserver.stop(aCallback);
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js
@@ -12,51 +12,33 @@ function run_test() {
   // do_get_profile in xpcshell tests. This prevents an error from being logged.
   do_get_profile();
 
   setupTestCommon();
 
   debugDump("testing mar download and mar hash verification");
 
   Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false);
-  // The HTTP server is only used for the mar file downloads since it is slow
   start_httpserver();
-  setUpdateURLOverride(gURLData + "update.xml");
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
+  setUpdateURLOverride(gURLData + gHTTPHandlerPath);
   standardInit();
   // Only perform the non hash check tests when mar signing is enabled since the
   // update service doesn't perform hash checks when mar signing is enabled.
-  if (IS_MAR_CHECKS_ENABLED) {
+  if (MOZ_VERIFY_MAR_SIGNATURE) {
     do_execute_soon(run_test_pt11);
   } else {
     do_execute_soon(run_test_pt1);
   }
 }
 
 // The HttpServer must be stopped before calling do_test_finished
 function finish_test() {
   stop_httpserver(doTestFinish);
 }
 
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  aXHR.status = 400;
-  aXHR.responseText = gResponseBody;
-  try {
-    let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                 createInstance(Ci.nsIDOMParser);
-    aXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
-  } catch (e) {
-  }
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
-
 // Helper function for testing mar downloads that have the correct size
 // specified in the update xml.
 function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
   gUpdates = null;
   gUpdateCount = null;
   gStatusResult = null;
   gCheckFunc = check_test_helper_pt1_1;
   gNextRunFunc = aNextRunFunc;
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
@@ -8,23 +8,23 @@ const KEY_UPDATE_ARCHIVE_DIR = "UpdArchD
 var gActiveUpdate;
 var gDirService;
 var gDirProvider;
 var gOldProviders;
 
 function run_test() {
   setupTestCommon();
 
-  setUpdateURLOverride();
-  overrideXHR(xhr_pt1);
-  standardInit();
-
   debugDump("testing that error codes set from a directory provider propagate" +
             "up to AUS.downloadUpdate() correctly (Bug 794211).");
 
+  start_httpserver();
+  setUpdateURLOverride(gURLData + gHTTPHandlerPath);
+  standardInit();
+
   gDirProvider = new FakeDirProvider();
 
   let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
   gOldProviders = [];
   let enumerator = cm.enumerateCategory("xpcom-directory-providers");
   while (enumerator.hasMoreElements()) {
     let entry = enumerator.getNext().QueryInterface(Ci.nsISupportsCString).data;
     let contractID = cm.getCategoryEntry("xpcom-directory-providers", entry);
@@ -38,36 +38,21 @@ function run_test() {
     gDirService.unregisterProvider(p);
   });
   gDirService.registerProvider(gDirProvider);
 
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, true);
   do_execute_soon(run_test_pt1);
 }
 
-function xhr_pt1(aXHR) {
-  aXHR.status = 200;
-  aXHR.responseText = gResponseBody;
-  try {
-    let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                 createInstance(Ci.nsIDOMParser);
-    aXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
-  } catch (e) {
-    aXHR.responseXML = null;
-  }
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
-
 function run_test_pt1() {
   gUpdates = null;
   gUpdateCount = null;
   gCheckFunc = check_test_pt1;
 
-
   let patches = getRemotePatchString();
   let updates = getRemoteUpdateString(patches);
   gResponseBody = getRemoteUpdatesXMLString(updates);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt1() {
   Assert.equal(gUpdateCount, 1,
deleted file mode 100644
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-// Needs to be in sync w/ nsUpdateService.js
-const NETWORK_ERROR_OFFLINE = 111;
-
-function run_test() {
-  setupTestCommon();
-
-  debugDump("testing when an update check fails because the network is " +
-            "offline that we check again when the network comes online " +
-            "(Bug 794211).");
-
-  setUpdateURLOverride();
-  Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
-
-  overrideXHR(xhr_pt1);
-  overrideUpdatePrompt(updatePrompt);
-  standardInit();
-
-  do_execute_soon(run_test_pt1);
-}
-
-function run_test_pt1() {
-  gResponseBody = null;
-  gCheckFunc = check_test_pt1;
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function xhr_pt1(aXHR) {
-  aXHR.status = Cr.NS_ERROR_OFFLINE;
-  aXHR.onerror({ target: aXHR });
-}
-
-function check_test_pt1(request, update) {
-  Assert.equal(gStatusCode, Cr.NS_ERROR_OFFLINE,
-               "the download status code" + MSG_SHOULD_EQUAL);
-  Assert.equal(update.errorCode, NETWORK_ERROR_OFFLINE,
-               "the update error code" + MSG_SHOULD_EQUAL);
-
-  // Forward the error to AUS, which should register the online observer
-  gAUS.onError(request, update);
-
-  // Trigger another check by notifying the offline status observer
-  overrideXHR(xhr_pt2);
-  Services.obs.notifyObservers(gAUS, "network:offline-status-changed", "online");
-}
-
-const updatePrompt = {
-  showUpdateAvailable: function(update) {
-    check_test_pt2(update);
-  }
-};
-
-function xhr_pt2(aXHR) {
-  let patches = getLocalPatchString();
-  let updates = getLocalUpdateString(patches);
-  let responseBody = getLocalUpdatesXMLString(updates);
-
-  aXHR.status = 200;
-  aXHR.responseText = responseBody;
-  try {
-    let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                 createInstance(Ci.nsIDOMParser);
-    aXHR.responseXML = parser.parseFromString(responseBody, "application/xml");
-  } catch (e) {
-  }
-  aXHR.onload({ target: aXHR });
-}
-
-function check_test_pt2(update) {
-  // We just verify that there are updates to know the check succeeded.
-  Assert.ok(!!update, "there should be an update");
-  Assert.equal(update.name, "App Update Test",
-               "the update name" + MSG_SHOULD_EQUAL);
-
-  doTestFinish();
-}
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedRecovery.js
@@ -17,45 +17,27 @@ var gExpectedStatusResult;
 
 function run_test() {
   setupTestCommon();
 
   debugDump("testing mar downloads, mar hash verification, and " +
             "mar download interrupted recovery");
 
   Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false);
-  // The HTTP server is only used for the mar file downloads since it is slow
   start_httpserver();
-  setUpdateURLOverride(gURLData + "update.xml");
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
+  setUpdateURLOverride(gURLData + gHTTPHandlerPath);
   standardInit();
   do_execute_soon(run_test_pt1);
 }
 
 // The HttpServer must be stopped before calling do_test_finished
 function finish_test() {
   stop_httpserver(doTestFinish);
 }
 
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  aXHR.status = 400;
-  aXHR.responseText = gResponseBody;
-  try {
-    let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                 createInstance(Ci.nsIDOMParser);
-    aXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
-  } catch (e) {
-  }
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
-
 // Helper function for testing mar downloads that have the correct size
 // specified in the update xml.
 function run_test_helper_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
   gUpdates = null;
   gUpdateCount = null;
   gStatusResult = null;
   gCheckFunc = check_test_helper_pt1_1;
   gNextRunFunc = aNextRunFunc;
--- a/toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
@@ -6,20 +6,19 @@
 var gNextRunFunc;
 var gExpectedCount;
 
 function run_test() {
   setupTestCommon();
 
   debugDump("testing remote update xml attributes");
 
-  setUpdateURLOverride();
+  start_httpserver();
+  setUpdateURLOverride(gURLData + gHTTPHandlerPath);
   setUpdateChannel("test_channel");
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
   standardInit();
   do_execute_soon(run_test_pt01);
 }
 
 // Helper function for testing update counts returned from an update xml
 function run_test_helper_pt1(aMsg, aExpectedCount, aNextRunFunc) {
   gUpdates = null;
   gUpdateCount = null;
@@ -31,34 +30,16 @@ function run_test_helper_pt1(aMsg, aExpe
 }
 
 function check_test_helper_pt1() {
   Assert.equal(gUpdateCount, gExpectedCount,
                "the update count" + MSG_SHOULD_EQUAL);
   gNextRunFunc();
 }
 
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  aXHR.status = 400;
-  aXHR.responseText = gResponseBody;
-  try {
-    if (gResponseBody) {
-      let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                   createInstance(Ci.nsIDOMParser);
-      aXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
-    }
-  } catch (e) {
-    aXHR.responseXML = null;
-  }
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
-
 // update xml not found
 function run_test_pt01() {
   run_test_helper_pt1("testing update xml not available",
                       null, run_test_pt02);
 }
 
 // one update available and the update's property values
 function run_test_pt02() {
@@ -120,17 +101,17 @@ function check_test_pt02() {
   Assert.equal(bestUpdate.billboardURL, "http://billboard/",
                "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(bestUpdate.showPrompt,
             "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(bestUpdate.showNeverForVersion,
             "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
   Assert.equal(bestUpdate.promptWaitTime, "345600",
                "the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
-  Assert.equal(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1",
+  Assert.equal(bestUpdate.serviceURL, gURLData + gHTTPHandlerPath + "?force=1",
                "the update serviceURL attribute" + MSG_SHOULD_EQUAL);
   Assert.equal(bestUpdate.channel, "test_channel",
                "the update channel attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(!bestUpdate.isCompleteUpdate,
             "the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(!bestUpdate.isSecurityUpdate,
             "the update isSecurityUpdate attribute" + MSG_SHOULD_EQUAL);
   // Check that installDate is within 10 seconds of the current date.
@@ -238,17 +219,17 @@ function check_test_pt03() {
   Assert.equal(bestUpdate.billboardURL, "http://details/",
                "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(bestUpdate.showPrompt,
             "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(bestUpdate.showNeverForVersion,
             "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
   Assert.equal(bestUpdate.promptWaitTime, "691200",
                "the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
-  Assert.equal(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1",
+  Assert.equal(bestUpdate.serviceURL, gURLData + gHTTPHandlerPath + "?force=1",
                "the update serviceURL attribute" + MSG_SHOULD_EQUAL);
   Assert.equal(bestUpdate.channel, "test_channel",
                "the update channel attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(!bestUpdate.isCompleteUpdate,
             "the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
   Assert.ok(!bestUpdate.isSecurityUpdate,
             "the update isSecurityUpdate attribute" + MSG_SHOULD_EQUAL);
   // Check that installDate is within 10 seconds of the current date.
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
@@ -10,19 +10,18 @@ function run_test() {
   do_get_profile();
 
   debugDump("testing that an update download doesn't start when the " +
             PREF_APP_UPDATE_AUTO + " preference is false");
 
   Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false);
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false);
 
-  setUpdateURLOverride();
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
+  start_httpserver();
+  setUpdateURLOverride(gURLData + gHTTPHandlerPath);
   standardInit();
 
   let windowWatcherCID =
     MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1",
                            WindowWatcher);
   let windowMediatorCID =
     MockRegistrar.register("@mozilla.org/appshell/window-mediator;1",
                            WindowMediator);
@@ -49,31 +48,16 @@ function check_status() {
   gAUS.pauseDownload();
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   reloadUpdateManagerData();
 
   do_execute_soon(doTestFinish);
 }
 
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  aXHR.status = 400;
-  aXHR.responseText = gResponseBody;
-  try {
-    let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                 createInstance(Ci.nsIDOMParser);
-    aXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
-  } catch (e) {
-  }
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
-
 function check_showUpdateAvailable() {
   do_throw("showUpdateAvailable should not have called openWindow!");
 }
 
 const WindowWatcher = {
   openWindow: function(aParent, aUrl, aName, aFeatures, aArgs) {
     gCheckFunc();
   },
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
@@ -1,25 +1,24 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-Components.utils.import("resource://testing-common/MockRegistrar.jsm");
+Cu.import("resource://testing-common/MockRegistrar.jsm");
 
 function run_test() {
   setupTestCommon();
 
   debugDump("testing nsIUpdatePrompt notifications should not be displayed " +
             "when showUpdateAvailable is called for an unsupported system " +
             "update when the unsupported notification has already been " +
             "shown (bug 843497)");
 
-  setUpdateURLOverride();
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
+  start_httpserver();
+  setUpdateURLOverride(gURLData + gHTTPHandlerPath);
   standardInit();
 
   let windowWatcherCID =
     MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1",
                            WindowWatcher);
   let windowMediatorCID =
     MockRegistrar.register("@mozilla.org/appshell/window-mediator;1",
                            WindowMediator);
@@ -46,32 +45,17 @@ function run_test() {
 function check_test() {
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS)) {
     do_execute_soon(check_test);
     return;
   }
   Assert.ok(true,
             PREF_APP_UPDATE_BACKGROUNDERRORS + " preference should not exist");
 
-  doTestFinish();
-}
-
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  aXHR.status = 400;
-  aXHR.responseText = gResponseBody;
-  try {
-    let parser = Cc["@mozilla.org/xmlextras/domparser;1"].
-                 createInstance(Ci.nsIDOMParser);
-    aXHR.responseXML = parser.parseFromString(gResponseBody, "application/xml");
-  } catch (e) {
-  }
-  let e = { target: aXHR };
-  aXHR.onload(e);
+  stop_httpserver(doTestFinish);
 }
 
 function check_showUpdateAvailable() {
   do_throw("showUpdateAvailable should not have called openWindow!");
 }
 
 const WindowWatcher = {
   openWindow: function(aParent, aUrl, aName, aFeatures, aArgs) {
deleted file mode 100644
--- a/toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js
+++ /dev/null
@@ -1,173 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-// Errors tested:
-// 200, 403, 404, 500, 2152398849, 2152398862, 2152398864, 2152398867,
-// 2152398868, 2152398878, 2152398890, 2152398919, 2152398920, 2153390069,
-// 2152398918, 2152398861
-
-var gNextRunFunc;
-var gExpectedStatusCode;
-var gExpectedStatusText;
-
-function run_test() {
-  setupTestCommon();
-
-  debugDump("testing nsIUpdateCheckListener onload and onerror error code " +
-            "and statusText values");
-
-  setUpdateURLOverride();
-  standardInit();
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
-  do_execute_soon(run_test_pt1);
-}
-
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  aXHR.status = gExpectedStatusCode;
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
-
-// Helper functions for testing nsIUpdateCheckListener statusText
-function run_test_helper(aNextRunFunc, aExpectedStatusCode, aMsg) {
-  gStatusCode = null;
-  gStatusText = null;
-  gCheckFunc = check_test_helper;
-  gNextRunFunc = aNextRunFunc;
-  gExpectedStatusCode = aExpectedStatusCode;
-  debugDump(aMsg, Components.stack.caller);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_helper() {
-  Assert.equal(gStatusCode, gExpectedStatusCode,
-               "the download status code" + MSG_SHOULD_EQUAL);
-  let expectedStatusText = getStatusText(gExpectedStatusCode);
-  Assert.equal(gStatusText, expectedStatusText,
-               "the update status text" + MSG_SHOULD_EQUAL);
-  gNextRunFunc();
-}
-
-/**
- * The following tests use a custom XMLHttpRequest to return the status codes
- */
-
-// default onerror error message (error code 399 is not defined)
-function run_test_pt1() {
-  gStatusCode = null;
-  gStatusText = null;
-  gCheckFunc = check_test_pt1;
-  gExpectedStatusCode = 399;
-  debugDump("testing default onerror error message");
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt1() {
-  Assert.equal(gStatusCode, gExpectedStatusCode,
-               "the download status code" + MSG_SHOULD_EQUAL);
-  let expectedStatusText = getStatusText(404);
-  Assert.equal(gStatusText, expectedStatusText,
-               "the update status text" + MSG_SHOULD_EQUAL);
-  run_test_pt2();
-}
-
-// file malformed - 200
-function run_test_pt2() {
-  run_test_helper(run_test_pt3, 200,
-                  "testing file malformed");
-}
-
-// access denied - 403
-function run_test_pt3() {
-  run_test_helper(run_test_pt4, 403,
-                  "testing access denied");
-}
-
-// file not found - 404
-function run_test_pt4() {
-  run_test_helper(run_test_pt5, 404,
-                  "testing file not found");
-}
-
-// internal server error - 500
-function run_test_pt5() {
-  run_test_helper(run_test_pt6, 500,
-                  "testing internal server error");
-}
-
-// failed (unknown reason) - NS_BINDING_FAILED (2152398849)
-function run_test_pt6() {
-  run_test_helper(run_test_pt7, Cr.NS_BINDING_FAILED,
-                  "testing failed (unknown reason)");
-}
-
-// connection timed out - NS_ERROR_NET_TIMEOUT (2152398862)
-function run_test_pt7() {
-  run_test_helper(run_test_pt8, Cr.NS_ERROR_NET_TIMEOUT,
-                  "testing connection timed out");
-}
-
-// network offline - NS_ERROR_OFFLINE (2152398864)
-function run_test_pt8() {
-  run_test_helper(run_test_pt9, Cr.NS_ERROR_OFFLINE,
-                  "testing network offline");
-}
-
-// port not allowed - NS_ERROR_PORT_ACCESS_NOT_ALLOWED (2152398867)
-function run_test_pt9() {
-  run_test_helper(run_test_pt10, Cr.NS_ERROR_PORT_ACCESS_NOT_ALLOWED,
-                  "testing port not allowed");
-}
-
-// no data was received - NS_ERROR_NET_RESET (2152398868)
-function run_test_pt10() {
-  run_test_helper(run_test_pt11, Cr.NS_ERROR_NET_RESET,
-                  "testing no data was received");
-}
-
-// update server not found - NS_ERROR_UNKNOWN_HOST (2152398878)
-function run_test_pt11() {
-  run_test_helper(run_test_pt12, Cr.NS_ERROR_UNKNOWN_HOST,
-                  "testing update server not found");
-}
-
-// proxy server not found - NS_ERROR_UNKNOWN_PROXY_HOST (2152398890)
-function run_test_pt12() {
-  run_test_helper(run_test_pt13, Cr.NS_ERROR_UNKNOWN_PROXY_HOST,
-                  "testing proxy server not found");
-}
-
-// data transfer interrupted - NS_ERROR_NET_INTERRUPT (2152398919)
-function run_test_pt13() {
-  run_test_helper(run_test_pt14, Cr.NS_ERROR_NET_INTERRUPT,
-                  "testing data transfer interrupted");
-}
-
-// proxy server connection refused - NS_ERROR_PROXY_CONNECTION_REFUSED (2152398920)
-function run_test_pt14() {
-  run_test_helper(run_test_pt15, Cr.NS_ERROR_PROXY_CONNECTION_REFUSED,
-                  "testing proxy server connection refused");
-}
-
-// server certificate expired - 2153390069
-function run_test_pt15() {
-  run_test_helper(run_test_pt16, 2153390069,
-                  "testing server certificate expired");
-}
-
-// network is offline - NS_ERROR_DOCUMENT_NOT_CACHED (2152398918)
-function run_test_pt16() {
-  run_test_helper(run_test_pt17, Cr.NS_ERROR_DOCUMENT_NOT_CACHED,
-                  "testing network is offline");
-}
-
-// connection refused - NS_ERROR_CONNECTION_REFUSED (2152398861)
-function run_test_pt17() {
-  run_test_helper(doTestFinish, Cr.NS_ERROR_CONNECTION_REFUSED,
-                  "testing connection refused");
-}
--- a/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
@@ -4,102 +4,112 @@
  */
 
 /* General URL Construction Tests */
 
 const URL_PREFIX = URL_HOST + "/";
 
 var gAppInfo;
 
+// Since gUpdateChecker.checkForUpdates uses XMLHttpRequest and XMLHttpRequest
+// can be slow it combines the checks whenever possible.
 function run_test() {
   // This test needs access to omni.ja to read the update.locale file so don't
   // use a custom directory for the application directory.
   gUseTestAppDir = false;
   setupTestCommon();
 
-  // The mock XMLHttpRequest is MUCH faster
-  overrideXHR(callHandleEvent);
   standardInit();
   gAppInfo = Cc["@mozilla.org/xre/app-info;1"].
              getService(Ci.nsIXULAppInfo).
              QueryInterface(Ci.nsIXULRuntime);
   do_execute_soon(run_test_pt1);
 }
 
-// Callback function used by the custom XMLHttpRequest implementation to
-// call the nsIDOMEventListener's handleEvent method for onload.
-function callHandleEvent(aXHR) {
-  // The mock xmlhttprequest needs a status code to return to the consumer and
-  // the value is not important for this test.
-  aXHR.status = 404;
-  let e = { target: aXHR };
-  aXHR.onload(e);
-}
 
-// Helper function for parsing the result from the contructed url
-function getResult(url) {
-  return url.substr(URL_PREFIX.length).split("/")[0];
-}
-
-// url constructed with %PRODUCT%
+// url constructed with:
+// %PRODUCT%
+// %VERSION%
+// %BUILD_ID%
+// %BUILD_TARGET%
+// %LOCALE%
+// %CHANNEL%
+// %PLATFORM_VERSION%
+// %OS_VERSION%
+// %SYSTEM_CAPABILITIES%
+// %DISTRIBUTION%
+// %DISTRIBUTION_VERSION%
 function run_test_pt1() {
   gCheckFunc = check_test_pt1;
-  let url = URL_PREFIX + "%PRODUCT%/";
-  debugDump("testing url constructed with %PRODUCT% - " + url);
+  // The code that gets the locale accesses the profile which is only available
+  // after calling do_get_profile in xpcshell tests. This prevents an error from
+  // being logged.
+  do_get_profile();
+
+  setUpdateChannel("test_channel");
+  gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_ID, "test_distro");
+  gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_VERSION, "test_distro_version");
+
+  let url = URL_PREFIX + "%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/" +
+            "%LOCALE%/%CHANNEL%/%PLATFORM_VERSION%/%OS_VERSION%/" +
+            "%SYSTEM_CAPABILITIES%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/" +
+            "updates.xml";
+  debugDump("testing url construction - url: " + url);
   setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
+  try {
+    gUpdateChecker.checkForUpdates(updateCheckListener, true);
+  } catch (e) {
+    debugDump("The following error is most likely due to a missing " +
+              "update.locale file");
+    do_throw(e);
+  }
 }
 
 function check_test_pt1() {
-  Assert.equal(getResult(gRequestURL), gAppInfo.name,
-               "the url param for %PRODUCT%" + MSG_SHOULD_EQUAL);
+  let url = URL_PREFIX + gAppInfo.name + "/" + gAppInfo.version + "/" +
+            gAppInfo.appBuildID + "/" + gAppInfo.OS + "_" + getABI() + "/" +
+            INSTALL_LOCALE + "/test_channel/" + gAppInfo.platformVersion + "/" +
+            getOSVersion() + "/" + getSystemCapabilities() +
+            "/test_distro/test_distro_version/updates.xml?force=1"
+  // Log the urls since Assert.equal won't print the entire urls to the log.
+  if (gRequestURL != url) {
+    logTestInfo("expected url: " + url);
+    logTestInfo("returned url: " + gRequestURL);
+  }
+  Assert.equal(gRequestURL, url,
+               "the url" + MSG_SHOULD_EQUAL);
   run_test_pt2();
 }
 
-// url constructed with %VERSION%
+// url constructed with:
+// %CHANNEL% with distribution partners
+// %CUSTOM% parameter
+// force param when there already is a param - bug 454357
 function run_test_pt2() {
   gCheckFunc = check_test_pt2;
-  let url = URL_PREFIX + "%VERSION%/";
-  debugDump("testing url constructed with %VERSION% - " + url);
+  let url = URL_PREFIX + "%CHANNEL%/updates.xml?custom=%CUSTOM%";
+  debugDump("testing url constructed with %CHANNEL% - " + url);
   setUpdateURLOverride(url);
+  gDefaultPrefBranch.setCharPref(PREFBRANCH_APP_PARTNER + "test_partner1",
+                                 "test_partner1");
+  gDefaultPrefBranch.setCharPref(PREFBRANCH_APP_PARTNER + "test_partner2",
+                                 "test_partner2");
+  Services.prefs.setCharPref("app.update.custom", "custom");
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt2() {
-  Assert.equal(getResult(gRequestURL), gAppInfo.version,
-               "the url param for %VERSION%" + MSG_SHOULD_EQUAL);
-  run_test_pt3();
-}
-
-// url constructed with %BUILD_ID%
-function run_test_pt3() {
-  gCheckFunc = check_test_pt3;
-  let url = URL_PREFIX + "%BUILD_ID%/";
-  debugDump("testing url constructed with %BUILD_ID% - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
+  let url = URL_PREFIX + "test_channel-cck-test_partner1-test_partner2/" +
+            "updates.xml?custom=custom&force=1";
+  Assert.equal(gRequestURL, url,
+               "the url" + MSG_SHOULD_EQUAL);
+  doTestFinish();
 }
 
-function check_test_pt3() {
-  Assert.equal(getResult(gRequestURL), gAppInfo.appBuildID,
-               "the url param for %BUILD_ID%" + MSG_SHOULD_EQUAL);
-  run_test_pt4();
-}
-
-// url constructed with %BUILD_TARGET%
-// XXX TODO - it might be nice if we tested the actual ABI
-function run_test_pt4() {
-  gCheckFunc = check_test_pt4;
-  let url = URL_PREFIX + "%BUILD_TARGET%/";
-  debugDump("testing url constructed with %BUILD_TARGET% - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt4() {
+function getABI() {
   let abi;
   try {
     abi = gAppInfo.XPCOMABI;
   } catch (e) {
     do_throw("nsIXULAppInfo:XPCOMABI not defined\n");
   }
 
   if (IS_MACOSX) {
@@ -111,107 +121,52 @@ function check_test_pt4() {
 
     if (macutils.isUniversalBinary) {
       abi += "-u-" + macutils.architecturesInBinary;
     }
   } else if (IS_WIN) {
     // Windows build should report the CPU architecture that it's running on.
     abi += "-" + getProcArchitecture();
   }
-
-  Assert.equal(getResult(gRequestURL), gAppInfo.OS + "_" + abi,
-               "the url param for %BUILD_TARGET%" + MSG_SHOULD_EQUAL);
-  run_test_pt5();
-}
-
-// url constructed with %LOCALE%
-// Bug 488936 added the update.locale file that stores the update locale
-function run_test_pt5() {
-  // The code that gets the locale accesses the profile which is only available
-  // after calling do_get_profile in xpcshell tests. This prevents an error from
-  // being logged.
-  do_get_profile();
-
-  gCheckFunc = check_test_pt5;
-  let url = URL_PREFIX + "%LOCALE%/";
-  debugDump("testing url constructed with %LOCALE% - " + url);
-  setUpdateURLOverride(url);
-  try {
-    gUpdateChecker.checkForUpdates(updateCheckListener, true);
-  } catch (e) {
-    debugDump("The following error is most likely due to a missing " +
-              "update.locale file");
-    do_throw(e);
-  }
-}
-
-function check_test_pt5() {
-  Assert.equal(getResult(gRequestURL), INSTALL_LOCALE,
-               "the url param for %LOCALE%" + MSG_SHOULD_EQUAL);
-  run_test_pt6();
-}
-
-// url constructed with %CHANNEL%
-function run_test_pt6() {
-  gCheckFunc = check_test_pt6;
-  let url = URL_PREFIX + "%CHANNEL%/";
-  debugDump("testing url constructed with %CHANNEL% - " + url);
-  setUpdateURLOverride(url);
-  setUpdateChannel("test_channel");
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
+  return abi;
 }
 
-function check_test_pt6() {
-  Assert.equal(getResult(gRequestURL), "test_channel",
-               "the url param for %CHANNEL%" + MSG_SHOULD_EQUAL);
-  run_test_pt7();
-}
+function getOSVersion() {
+  let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
+  let osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
 
-// url constructed with %CHANNEL% with distribution partners
-function run_test_pt7() {
-  gCheckFunc = check_test_pt7;
-  let url = URL_PREFIX + "%CHANNEL%/";
-  debugDump("testing url constructed with %CHANNEL% - " + url);
-  setUpdateURLOverride(url);
-  gDefaultPrefBranch.setCharPref(PREFBRANCH_APP_PARTNER + "test_partner1",
-                                 "test_partner1");
-  gDefaultPrefBranch.setCharPref(PREFBRANCH_APP_PARTNER + "test_partner2",
-                                 "test_partner2");
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
+  if (IS_WIN) {
+    try {
+      let servicePack = getServicePack();
+      osVersion += "." + servicePack;
+    } catch (e) {
+      do_throw("Failure obtaining service pack: " + e);
+    }
 
-function check_test_pt7() {
-  Assert.equal(getResult(gRequestURL),
-               "test_channel-cck-test_partner1-test_partner2",
-               "the url param for %CHANNEL%" + MSG_SHOULD_EQUAL);
-  run_test_pt8();
-}
+    if ("5.0" === sysInfo.getProperty("version")) { // Win2K
+      osVersion += " (unknown)";
+    } else {
+      try {
+        osVersion += " (" + getProcArchitecture() + ")";
+      } catch (e) {
+        do_throw("Failed to obtain processor architecture: " + e);
+      }
+    }
+  }
 
-// url constructed with %PLATFORM_VERSION%
-function run_test_pt8() {
-  gCheckFunc = check_test_pt8;
-  let url = URL_PREFIX + "%PLATFORM_VERSION%/";
-  debugDump("testing url constructed with %PLATFORM_VERSION% - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt8() {
-  Assert.equal(getResult(gRequestURL), gAppInfo.platformVersion,
-               "the url param for %PLATFORM_VERSION%" + MSG_SHOULD_EQUAL);
-  run_test_pt9();
-}
-
-// url constructed with %OS_VERSION%
-function run_test_pt9() {
-  gCheckFunc = check_test_pt9;
-  let url = URL_PREFIX + "%OS_VERSION%/";
-  debugDump("testing url constructed with %OS_VERSION% - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
+  if (osVersion) {
+    try {
+      osVersion += " (" + sysInfo.getProperty("secondaryLibrary") + ")";
+    } catch (e) {
+      // Not all platforms have a secondary widget library, so an error is
+      // nothing to worry about.
+    }
+    osVersion = encodeURIComponent(osVersion);
+  }
+  return osVersion
 }
 
 function getServicePack() {
   // NOTE: This function is a helper function and not a test.  Thus,
   // it uses throw() instead of do_throw().  Any tests that use this function
   // should catch exceptions thrown in this function and deal with them
   // appropriately (usually by calling do_throw).
   const BYTE = ctypes.uint8_t;
@@ -305,64 +260,16 @@ function getProcArchitecture() {
         // Using "throw" instead of "do_throw" (see NOTE above)
         throw ("Unknown architecture returned from GetNativeSystemInfo: " + sysInfo.wProcessorArchitecture);
     }
   } finally {
     kernel32.close();
   }
 }
 
-function check_test_pt9() {
-  let osVersion;
-  let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
-  osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
-
-  if (IS_WIN) {
-    try {
-      let servicePack = getServicePack();
-      osVersion += "." + servicePack;
-    } catch (e) {
-      do_throw("Failure obtaining service pack: " + e);
-    }
-
-    if ("5.0" === sysInfo.getProperty("version")) { // Win2K
-      osVersion += " (unknown)";
-    } else {
-      try {
-        osVersion += " (" + getProcArchitecture() + ")";
-      } catch (e) {
-        do_throw("Failed to obtain processor architecture: " + e);
-      }
-    }
-  }
-
-  if (osVersion) {
-    try {
-      osVersion += " (" + sysInfo.getProperty("secondaryLibrary") + ")";
-    } catch (e) {
-      // Not all platforms have a secondary widget library, so an error is
-      // nothing to worry about.
-    }
-    osVersion = encodeURIComponent(osVersion);
-  }
-
-  Assert.equal(getResult(gRequestURL), osVersion,
-               "the url param for %OS_VERSION%" + MSG_SHOULD_EQUAL);
-  run_test_pt10();
-}
-
-// url constructed with %SYSTEM_CAPABILITIES%
-function run_test_pt10() {
-  gCheckFunc = check_test_pt10;
-  let url = URL_PREFIX + "%SYSTEM_CAPABILITIES%/";
-  debugDump("testing url constructed with %SYSTEM_CAPABILITIES% - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
 /**
  * Provides system capability information for application update though it may
  * be used by other consumers.
  */
 function getSystemCapabilities() {
   if (IS_WIN) {
     const PF_MMX_INSTRUCTIONS_AVAILABLE = 3; // MMX
     const PF_XMMI_INSTRUCTIONS_AVAILABLE = 6; // SSE
@@ -391,99 +298,8 @@ function getSystemCapabilities() {
     }
 
     lib.close();
     return instructionSet;
   }
 
   return "NA"
 }
-
-function check_test_pt10() {
-  let systemCapabilities = "NA";
-  if (IS_WIN) {
-    systemCapabilities = getSystemCapabilities();
-  }
-
-  Assert.equal(getResult(gRequestURL), systemCapabilities,
-               "the url param for %SYSTEM_CAPABILITIES%" + MSG_SHOULD_EQUAL);
-  run_test_pt11();
-}
-
-// url constructed with %DISTRIBUTION%
-function run_test_pt11() {
-  gCheckFunc = check_test_pt11;
-  let url = URL_PREFIX + "%DISTRIBUTION%/";
-  debugDump("testing url constructed with %DISTRIBUTION% - " + url);
-  setUpdateURLOverride(url);
-  gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_ID, "test_distro");
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt11() {
-  Assert.equal(getResult(gRequestURL), "test_distro",
-               "the url param for %DISTRIBUTION%" + MSG_SHOULD_EQUAL);
-  run_test_pt12();
-}
-
-// url constructed with %DISTRIBUTION_VERSION%
-function run_test_pt12() {
-  gCheckFunc = check_test_pt12;
-  let url = URL_PREFIX + "%DISTRIBUTION_VERSION%/";
-  debugDump("testing url constructed with %DISTRIBUTION_VERSION% - " + url);
-  setUpdateURLOverride(url);
-  gDefaultPrefBranch.setCharPref(PREF_DISTRIBUTION_VERSION, "test_distro_version");
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt12() {
-  Assert.equal(getResult(gRequestURL), "test_distro_version",
-               "the url param for %DISTRIBUTION_VERSION%" + MSG_SHOULD_EQUAL);
-  run_test_pt13();
-}
-
-// url with force param that doesn't already have a param - bug 454357
-function run_test_pt13() {
-  gCheckFunc = check_test_pt13;
-  let url = URL_PREFIX;
-  debugDump("testing url with force param that doesn't already have a " +
-            "param - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt13() {
-  Assert.equal(getResult(gRequestURL), "?force=1",
-               "the url query string for force" + MSG_SHOULD_EQUAL);
-  run_test_pt14();
-}
-
-// url with force param that already has a param - bug 454357
-function run_test_pt14() {
-  gCheckFunc = check_test_pt14;
-  let url = URL_PREFIX + "?extra=param";
-  debugDump("testing url with force param that already has a param - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt14() {
-  Assert.equal(getResult(gRequestURL), "?extra=param&force=1",
-               "the url query string for force with an extra string" +
-               MSG_SHOULD_EQUAL);
-  run_test_pt15();
-}
-
-function run_test_pt15() {
-  Services.prefs.setCharPref("app.update.custom", "custom");
-  gCheckFunc = check_test_pt15;
-  let url = URL_PREFIX + "?custom=%CUSTOM%";
-  debugDump("testing url constructed with %CUSTOM% - " + url);
-  setUpdateURLOverride(url);
-  gUpdateChecker.checkForUpdates(updateCheckListener, true);
-}
-
-function check_test_pt15() {
-  Assert.equal(getResult(gRequestURL), "?custom=custom&force=1",
-               "the url query string for force with a custom string" +
-               MSG_SHOULD_EQUAL);
-  doTestFinish();
-}
--- a/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
+++ b/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini
@@ -4,33 +4,31 @@
 
 [DEFAULT]
 tags = appupdate
 head = head_update.js
 tail =
 
 [canCheckForAndCanApplyUpdates.js]
 [urlConstruction.js]
-[updateCheckOnLoadOnErrorStatusText.js]
 [updateManagerXML.js]
 [remoteUpdateXML.js]
 [downloadAndHashCheckMar.js]
 [cleanupDownloadingForOlderAppVersion.js]
 [cleanupDownloadingForDifferentChannel.js]
 [cleanupDownloadingForSameVersionAndBuildID.js]
 [cleanupDownloadingIncorrectStatus.js]
 [cleanupPendingVersionFileIncorrectStatus.js]
 [cleanupSuccessLogMove.js]
 [cleanupSuccessLogsFIFO.js]
 [downloadInterruptedRecovery.js]
 [downloadResumeForSameAppVersion.js]
 [downloadCompleteAfterPartialFailure.js]
 skip-if = buildapp == "mulet" || toolkit == 'gonk'
 reason = custom nsIUpdatePrompt
-[downloadInterruptedByOfflineRetry.js]
 [downloadFileTooBig_gonk.js]
 skip-if = toolkit != 'gonk'
 [uiSilentPref.js]
 skip-if = toolkit == 'gonk'
 reason = custom nsIUpdatePrompt
 [uiUnsupportedAlreadyNotified.js]
 skip-if = toolkit == 'gonk'
 reason = custom nsIUpdatePrompt
--- a/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 /* Test version downgrade MAR security check */
 
 function run_test() {
-  if (!IS_MAR_CHECKS_ENABLED) {
+  if (!MOZ_VERIFY_MAR_SIGNATURE) {
     return;
   }
 
   if (!setupTestCommon()) {
     return;
   }
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
--- a/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 /* Test product/channel MAR security check */
 
 function run_test() {
-  if (!IS_MAR_CHECKS_ENABLED) {
+  if (!MOZ_VERIFY_MAR_SIGNATURE) {
     return;
   }
 
   if (!setupTestCommon()) {
     return;
   }
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;