Bug 616924 - App update test cleanup. r=dtownsend, a=tests
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 07 Dec 2010 12:05:49 -0800
changeset 58789 37f3097fe17c169e71b97b574cd48a948f72a851
parent 58788 de295f93a28a111f65a0f238641438ee1e3a7977
child 58790 12bc6188524ca7aaeb176fd4f403ee1242cc705c
push id17428
push userrstrong@mozilla.com
push dateTue, 07 Dec 2010 20:06:48 +0000
treeherdermozilla-central@dbb99009d49e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdtownsend, tests
bugs616924
milestone2.0b8pre
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 616924 - App update test cleanup. r=dtownsend, a=tests
toolkit/mozapps/update/test/Makefile.in
toolkit/mozapps/update/test/shared.js
toolkit/mozapps/update/test/unit/head_update.js.in
toolkit/mozapps/update/test/unit/test_0020_general.js
toolkit/mozapps/update/test/unit/test_0030_general.js
toolkit/mozapps/update/test/unit/test_0040_general.js
toolkit/mozapps/update/test/unit/test_0050_general.js
toolkit/mozapps/update/test/unit/test_0063_manager.js
toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js
toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js
toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js
toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js
toolkit/mozapps/update/test/unit/test_bug595059.js
--- a/toolkit/mozapps/update/test/Makefile.in
+++ b/toolkit/mozapps/update/test/Makefile.in
@@ -113,10 +113,12 @@ check::
 	done
 	$(INSTALL) $(FINAL_TARGET)/TestAUSReadStrings$(BIN_SUFFIX) $(DEPTH)/_tests/updater/$(bug473417dir)/
 	@$(RUN_TEST_PROGRAM) $(DEPTH)/_tests/updater/$(bug473417dir)/TestAUSReadStrings$(BIN_SUFFIX)
 endif # ANDROID
 
 libs:: unit/head_update.js.in
 	$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $^ > $(TESTROOT)/unit/head_update.js
 
+ifndef ANDROID
 libs::
 	$(INSTALL) TestAUSHelper$(BIN_SUFFIX) $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit
+endif # ANDROID
--- a/toolkit/mozapps/update/test/shared.js
+++ b/toolkit/mozapps/update/test/shared.js
@@ -39,16 +39,17 @@
 
 // const Cc, Ci, and Cr are defined in netwerk/test/httpserver/httpd.js so we
 // need to define unique ones.
 const AUS_Cc = Components.classes;
 const AUS_Ci = Components.interfaces;
 const AUS_Cr = Components.results;
 const AUS_Cu = Components.utils;
 
+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_CERTS_BRANCH        = "app.update.certs.";
 const PREF_APP_UPDATE_CERT_CHECKATTRS     = "app.update.cert.checkAttributes";
 const PREF_APP_UPDATE_CERT_ERRORS         = "app.update.cert.errors";
 const PREF_APP_UPDATE_CERT_MAXERRORS      = "app.update.cert.maxErrors";
 const PREF_APP_UPDATE_CERT_REQUIREBUILTIN = "app.update.cert.requireBuiltIn";
 const PREF_APP_UPDATE_CHANNEL             = "app.update.channel";
@@ -154,117 +155,125 @@ function initUpdateServiceStub() {
 /* Reloads the update metadata from disk */
 function reloadUpdateManagerData() {
   gUpdateManager.QueryInterface(AUS_Ci.nsIObserver).
   observe(null, "um-reload-update-data", "");
 }
 
 /**
  * Sets the app.update.channel preference.
- * @param   aChannel
- *          The update channel. If not specified 'test_channel' will be used.
+ *
+ * @param  aChannel
+ *         The update channel. If not specified 'test_channel' will be used.
  */
 function setUpdateChannel(aChannel) {
   let channel = aChannel ? aChannel : "test_channel";
   debugDump("setting default pref " + PREF_APP_UPDATE_CHANNEL + " to " + channel);
   gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_CHANNEL, channel);
 }
 
 /**
  * Sets the app.update.url.override preference.
- * @param   aURL
- *          The update url. If not specified 'URL_HOST + "update.xml"' will be
- *          used.
+ *
+ * @param  aURL
+ *         The update url. If not specified 'URL_HOST + "update.xml"' will be
+ *         used.
  */
 function setUpdateURLOverride(aURL) {
   let url = aURL ? aURL : URL_HOST + "update.xml";
   debugDump("setting " + PREF_APP_UPDATE_URL_OVERRIDE + " to " + url);
   Services.prefs.setCharPref(PREF_APP_UPDATE_URL_OVERRIDE, url);
 }
 
 /**
  * Writes the updates specified to either the active-update.xml or the
  * updates.xml.
- * @param   updates
- *          The updates represented as a string to write to the XML file.
- * @param   isActiveUpdate
- *          If true this will write to the active-update.xml otherwise it will
- *          write to the updates.xml file.
+ *
+ * @param  aContent
+ *         The updates represented as a string to write to the XML file.
+ * @param  isActiveUpdate
+ *         If true this will write to the active-update.xml otherwise it will
+ *         write to the updates.xml file.
  */
 function writeUpdatesToXMLFile(aContent, aIsActiveUpdate) {
   var file = getCurrentProcessDir();
   file.append(aIsActiveUpdate ? FILE_UPDATE_ACTIVE : FILE_UPDATES_DB);
   writeFile(file, aContent);
 }
 
 /**
  * Writes the current update operation/state to a file in the patch
  * directory, indicating to the patching system that operations need
  * to be performed.
- * @param   aStatus
- *          The status value to write.
+ *
+ * @param  aStatus
+ *         The status value to write.
  */
 function writeStatusFile(aStatus) {
   var file = getUpdatesDir();
   file.append("0");
   file.append(FILE_UPDATE_STATUS);
   aStatus += "\n";
   writeFile(file, aStatus);
 }
 
 /**
  * Writes the current update version to a file in the patch directory,
- & indicating to the patching system the version of the update.
- * @param   aVersion
- *          The version value to write.
+ * indicating to the patching system the version of the update.
+ *
+ * @param  aVersion
+ *         The version value to write.
  */
 function writeVersionFile(aVersion) {
   var file = getUpdatesDir();
   file.append("0");
   file.append(FILE_UPDATE_VERSION);
   aVersion += "\n";
   writeFile(file, aVersion);
 }
 
 /**
  * Gets the updates directory.
- * @returns The updates directory.
+ *
+ * @return nsIFile for the updates directory.
  */
 function getUpdatesDir() {
   var dir = getCurrentProcessDir();
   dir.append("updates");
   return dir;
 }
 
 /**
  * Writes text to a file. This will replace existing text if the file exists
  * and create the file if it doesn't exist.
- * @param   aFile
- *          The file to write to. Will be created if it doesn't exist.
- * @param   aText
- *          The text to write to the file. If there is existing text it will be
- *          replaced.
+ *
+ * @param  aFile
+ *         The file to write to. Will be created if it doesn't exist.
+ * @param  aText
+ *         The text to write to the file. If there is existing text it will be
+ *         replaced.
  */
 function writeFile(aFile, aText) {
   var fos = AUS_Cc["@mozilla.org/network/file-output-stream;1"].
             createInstance(AUS_Ci.nsIFileOutputStream);
   if (!aFile.exists())
     aFile.create(AUS_Ci.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
   fos.init(aFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, PERMS_FILE, 0);
   fos.write(aText, aText.length);
   fos.close();
 }
 
 /**
  * Reads the current update operation/state in a file in the patch
  * directory.
- * @param   aDir (optional)
- *          nsIFile to read the update status from. If not provided the
- *          application's update status file will be used.
- * @returns The status value.
+ *
+ * @param  aFile (optional)
+ *         nsIFile to read the update status from. If not provided the
+ *         application's update status file will be used.
+ * @return The status value.
  */
 function readStatusFile(aFile) {
   var file;
   if (aFile) {
     file = aFile.clone();
     file.append(FILE_UPDATE_STATUS);
   }
   else {
@@ -272,19 +281,20 @@ function readStatusFile(aFile) {
     file.append("0");
     file.append(FILE_UPDATE_STATUS);
   }
   return readFile(file).split("\n")[0];
 }
 
 /**
  * Reads text from a file and returns the string.
- * @param   aFile
- *          The file to read from.
- * @returns The string of text read from the file.
+ *
+ * @param  aFile
+ *         The file to read from.
+ * @return The string of text read from the file.
  */
 function readFile(aFile) {
   var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
             createInstance(AUS_Ci.nsIFileInputStream);
   if (!aFile.exists())
     return null;
   fis.init(aFile, MODE_RDONLY, PERMS_FILE, 0);
   var sis = AUS_Cc["@mozilla.org/scriptableinputstream;1"].
@@ -292,19 +302,20 @@ function readFile(aFile) {
   sis.init(fis);
   var text = sis.read(sis.available());
   sis.close();
   return text;
 }
 
 /**
  * Reads the binary contents of a file and returns it as a string.
- * @param   aFile
- *          The file to read from.
- * @returns The contents of the file as a string.
+ *
+ * @param  aFile
+ *         The file to read from.
+ * @return The contents of the file as a string.
  */
 function readFileBytes(aFile) {
   var fis = AUS_Cc["@mozilla.org/network/file-input-stream;1"].
             createInstance(AUS_Ci.nsIFileInputStream);
   fis.init(aFile, -1, -1, false);
   var bis = AUS_Cc["@mozilla.org/binaryinputstream;1"].
             createInstance(AUS_Ci.nsIBinaryInputStream);
   bis.setInputStream(fis);
@@ -333,20 +344,21 @@ function getString(aName) {
     return gUpdateBundle.GetStringFromName(aName);
   }
   catch (e) {
   }
   return null;
 }
 
 /**
- * Gets the file extension for an nsIFile
- * @param   aFile
- *          The file to get the file extension for
- * @returns The file extension
+ * Gets the file extension for an nsIFile.
+ *
+ * @param  aFile
+ *         The file to get the file extension for.
+ * @return The file extension.
  */
 function getFileExtension(aFile) {
   return Services.io.newFileURI(aFile).QueryInterface(AUS_Ci.nsIURL).
          fileExtension;
 }
 
 /**
  * Removes the updates.xml file, active-update.xml file, and all files and
@@ -388,18 +400,19 @@ function removeUpdateDirsAndFiles() {
     dump("Unable to remove files / directories from directory\npath: " +
          updatesDir.path + "\nException: " + e + "\n");
   }
 }
 
 /**
  * Removes all files and sub-directories in the updates directory except for
  * the "0" sub-directory.
- * @param   dir
- *          A nsIFile for the directory to be deleted
+ *
+ * @param  aDir
+ *         nsIFile for the directory to be deleted.
  */
 function cleanUpdatesDir(aDir) {
   if (!aDir.exists())
     return;
 
   var dirEntries = aDir.directoryEntries;
   while (dirEntries.hasMoreElements()) {
     var entry = dirEntries.getNext().QueryInterface(AUS_Ci.nsIFile);
@@ -428,18 +441,18 @@ function cleanUpdatesDir(aDir) {
   }
 }
 
 /**
  * Deletes a directory and its children. First it tries nsIFile::Remove(true).
  * If that fails it will fall back to recursing, setting the appropriate
  * permissions, and deleting the current entry.
  *
- * @param   aDir
- *          A nsIFile for the directory to be deleted
+ * @param  aDir
+ *         nsIFile for the directory to be deleted.
  */
 function removeDirRecursive(aDir) {
   if (!aDir.exists())
     return;
   try {
     aDir.remove(true);
     return;
   }
@@ -461,51 +474,57 @@ function removeDirRecursive(aDir) {
   aDir.permissions = PERMS_DIRECTORY;
   aDir.remove(true);
 }
 
 /**
  * Returns the directory for the currently running process. This is used to
  * clean up after the tests and to locate the active-update.xml and updates.xml
  * files.
+ *
+ * @return nsIFile for the current process directory.
  */
 function getCurrentProcessDir() {
   return Services.dirsvc.get(NS_XPCOM_CURRENT_PROCESS_DIR, AUS_Ci.nsIFile);
 }
 
 /**
  * Returns the Gecko Runtime Engine directory. This is used to locate the the
  * updater binary (Windows and Linux) or updater package (Mac OS X). For
  * XULRunner applications this is different than the currently running process
  * directory.
+ *
+ * @return nsIFile for the Gecko Runtime Engine directory.
  */
 function getGREDir() {
   return Services.dirsvc.get(NS_GRE_DIR, AUS_Ci.nsIFile);
 }
 
 /**
  * Logs TEST-INFO messages.
- * @param   aText
- *          The text to log.
- * @param   aCaller (optional)
- *          An optional Components.stack.caller. If not specified
- *          Components.stack.caller will be used.
+ *
+ * @param  aText
+ *         The text to log.
+ * @param  aCaller (optional)
+ *         An optional Components.stack.caller. If not specified
+ *         Components.stack.caller will be used.
  */
 function logTestInfo(aText, aCaller) {
   let caller = (aCaller ? aCaller : Components.stack.caller);
   dump("TEST-INFO | " + caller.filename + " | [" + caller.name + " : " +
        caller.lineNumber + "] " + aText + "\n");
 }
 
 /**
  * Logs TEST-INFO messages when DEBUG_AUS_TEST evaluates to true.
- * @param   aText
- *          The text to log.
- * @param   aCaller (optional)
- *          An optional Components.stack.caller. If not specified
- *          Components.stack.caller will be used.
+ *
+ * @param  aText
+ *         The text to log.
+ * @param  aCaller (optional)
+ *         An optional Components.stack.caller. If not specified
+ *         Components.stack.caller will be used.
  */
 function debugDump(aText, aCaller) {
   if (DEBUG_AUS_TEST) {
     let caller = aCaller ? aCaller : Components.stack.caller;
     logTestInfo(aText, caller);
   }
 }
--- a/toolkit/mozapps/update/test/unit/head_update.js.in
+++ b/toolkit/mozapps/update/test/unit/head_update.js.in
@@ -497,30 +497,30 @@ function checkFilesAfterUpdateCommon(aTe
  * Helper function for updater tests for verifying the contents of the updater
  * callback application log which should contain the string executed and the
  * arguments passed to the callback application.
  */
 function checkCallbackAppLog(aTestID) {
   let appLaunchLog = do_get_file(aTestID + APPLY_TO_DIR_SUFFIX + "/" +
                                  CALLBACK_ARGS[0], true);
   if (!appLaunchLog.exists()) {
-    do_timeout(0, function() {
+    do_execute_soon(function() {
       checkCallbackAppLog(aTestID);
     });
     return;
   }
 
   let expectedLogContents = "executed\n" + CALLBACK_ARGS.join("\n") + "\n";
   let logContents = readFile(appLaunchLog).replace(/\r\n/g, "\n");
   // It is possible for the log file contents check to occur before the log file
   // contents are completely written so wait until the contents are the expected
   // value. If the contents are never the expected value then the test will
   // fail by timing out.
   if (logContents != expectedLogContents) {
-    do_timeout(0, function() {
+    do_execute_soon(function() {
       checkCallbackAppLog(aTestID);
     });
     return;
   }
 
   logTestInfo("testing that the callback application successfully launched " +
               "and the expected command line arguments passed to it");
   do_check_eq(logContents, expectedLogContents);
@@ -604,17 +604,17 @@ xhr.prototype = {
   _method: null,
   open: function (method, url) {
     gXHR.channel.originalURI = Services.io.newURI(url, null, null);
     gXHR._method = method; gXHR._url = url;
   },
   responseXML: null,
   responseText: null,
   send: function(body) {
-    do_timeout(0, gXHRCallback); // Use a timeout so the XHR completes
+    do_execute_soon(gXHRCallback); // Use a timeout so the XHR completes
   },
   _onprogress: null,
   set onprogress(val) { gXHR._onprogress = val; },
   get onprogress() { return gXHR._onprogress; },
   _onerror: null,
   set onerror(val) { gXHR._onerror = val; },
   get onerror() { return gXHR._onerror; },
   _onload: null,
@@ -652,33 +652,33 @@ xhr.prototype = {
 const updateCheckListener = {
   onProgress: function UCL_onProgress(request, position, totalSize) {
   },
 
   onCheckComplete: function UCL_onCheckComplete(request, updates, updateCount) {
     gRequestURL = request.channel.originalURI.spec;
     gUpdateCount = updateCount;
     gUpdates = updates;
-    logTestInfo("onError: url = " + gRequestURL + ", " +
+    logTestInfo("url = " + gRequestURL + ", " +
                 "request.status = " + request.status + ", " +
                 "update.statusText = " + request.statusText + ", " +
                 "updateCount = " + updateCount);
     // Use a timeout to allow the XHR to complete
-    do_timeout(0, gCheckFunc);
+    do_execute_soon(gCheckFunc);
   },
 
   onError: function UCL_onError(request, update) {
     gRequestURL = request.channel.originalURI.spec;
     gStatusCode = request.status;
     gStatusText = update.statusText;
-    logTestInfo("onError: url = " + gRequestURL + ", " +
+    logTestInfo("url = " + gRequestURL + ", " +
                 "request.status = " + gStatusCode + ", " +
                 "update.statusText = " + gStatusText);
     // Use a timeout to allow the XHR to complete
-    do_timeout(0, gCheckFunc);
+    do_execute_soon(gCheckFunc);
   },
 
   QueryInterface: function(aIID) {
     if (!aIID.equals(AUS_Ci.nsIUpdateCheckListener) &&
         !aIID.equals(AUS_Ci.nsISupports))
       throw AUS_Cr.NS_ERROR_NO_INTERFACE;
     return this;
   }
--- a/toolkit/mozapps/update/test/unit/test_0020_general.js
+++ b/toolkit/mozapps/update/test/unit/test_0020_general.js
@@ -45,17 +45,17 @@ function run_test() {
   do_test_pending();
   do_register_cleanup(end_test);
   removeUpdateDirsAndFiles();
   setUpdateURLOverride();
   setUpdateChannel();
   // The mock XMLHttpRequest is MUCH faster
   overrideXHR(callHandleEvent);
   standardInit();
-  do_timeout(0, run_test_pt01);
+  do_execute_soon(run_test_pt01);
 }
 
 function end_test() {
   cleanUp();
 }
 
 // Helper function for testing update counts returned from an update xml
 function run_test_helper_pt1(aMsg, aExpectedCount, aNextRunFunc) {
--- a/toolkit/mozapps/update/test/unit/test_0030_general.js
+++ b/toolkit/mozapps/update/test/unit/test_0030_general.js
@@ -47,17 +47,17 @@ function run_test() {
   do_register_cleanup(end_test);
   removeUpdateDirsAndFiles();
   setUpdateURLOverride();
   // The mock XMLHttpRequest is MUCH faster
   overrideXHR(callHandleEvent);
   standardInit();
   // The HTTP server is only used for the mar file downloads which is slow
   start_httpserver(URL_PATH);
-  do_timeout(0, run_test_pt1);
+  do_execute_soon(run_test_pt1);
 }
 
 // The nsHttpServer must be stopped before calling do_test_finished
 function finish_test() {
   stop_httpserver(do_test_finished);
 }
 
 function end_test() {
@@ -113,109 +113,109 @@ function setResponseBody(aHashFunction, 
   var patches = getRemotePatchString(null, null, aHashFunction, aHashValue);
   var updates = getRemoteUpdateString(patches);
   gResponseBody = getRemoteUpdatesXMLString(updates);
 }
 
 // mar download with a valid MD5 hash
 function run_test_pt1() {
   setResponseBody("MD5", MD5_HASH_SIMPLE_MAR);
-  run_test_helper_pt1("run_test_pt1 - mar download with a valid MD5 hash",
+  run_test_helper_pt1("mar download with a valid MD5 hash",
                       AUS_Cr.NS_OK, run_test_pt2);
 }
 
 // mar download with an invalid MD5 hash
 function run_test_pt2() {
   setResponseBody("MD5", MD5_HASH_SIMPLE_MAR + "0");
-  run_test_helper_pt1("run_test_pt2 - mar download with an invalid MD5 hash",
+  run_test_helper_pt1("mar download with an invalid MD5 hash",
                       AUS_Cr.NS_ERROR_UNEXPECTED, run_test_pt3);
 }
 
 // mar download with a valid SHA1 hash
 function run_test_pt3() {
   setResponseBody("SHA1", SHA1_HASH_SIMPLE_MAR);
-  run_test_helper_pt1("run_test_pt3 - mar download with a valid SHA1 hash",
+  run_test_helper_pt1("mar download with a valid SHA1 hash",
                       AUS_Cr.NS_OK, run_test_pt4);
 }
 
 // mar download with an invalid SHA1 hash
 function run_test_pt4() {
   setResponseBody("SHA1", SHA1_HASH_SIMPLE_MAR + "0");
-  run_test_helper_pt1("run_test_pt4 - mar download with an invalid SHA1 hash",
+  run_test_helper_pt1("mar download with an invalid SHA1 hash",
                       AUS_Cr.NS_ERROR_UNEXPECTED, run_test_pt5);
 }
 
 // mar download with a valid SHA256 hash
 function run_test_pt5() {
   setResponseBody("SHA256", SHA256_HASH_SIMPLE_MAR);
-  run_test_helper_pt1("run_test_pt5 - mar download with a valid SHA256 hash",
+  run_test_helper_pt1("mar download with a valid SHA256 hash",
                       AUS_Cr.NS_OK, run_test_pt6);
 }
 
 // mar download with an invalid SHA256 hash
 function run_test_pt6() {
   setResponseBody("SHA256", SHA256_HASH_SIMPLE_MAR + "0");
-  run_test_helper_pt1("run_test_pt6 - mar download with an invalid SHA256 hash",
+  run_test_helper_pt1("mar download with an invalid SHA256 hash",
                       AUS_Cr.NS_ERROR_UNEXPECTED, run_test_pt7);
 }
 
 // mar download with a valid SHA384 hash
 function run_test_pt7() {
   setResponseBody("SHA384", SHA384_HASH_SIMPLE_MAR);
-  run_test_helper_pt1("run_test_pt7 - mar download with a valid SHA384 hash",
+  run_test_helper_pt1("mar download with a valid SHA384 hash",
                       AUS_Cr.NS_OK, run_test_pt8);
 }
 
 // mar download with an invalid SHA384 hash
 function run_test_pt8() {
   setResponseBody("SHA384", SHA384_HASH_SIMPLE_MAR + "0");
-  run_test_helper_pt1("run_test_pt8 - mar download with an invalid SHA384 hash",
+  run_test_helper_pt1("mar download with an invalid SHA384 hash",
                       AUS_Cr.NS_ERROR_UNEXPECTED, run_test_pt9);
 }
 
 // mar download with a valid SHA512 hash
 function run_test_pt9() {
   setResponseBody("SHA512", SHA512_HASH_SIMPLE_MAR);
-  run_test_helper_pt1("run_test_pt9 - mar download with a valid SHA512 hash",
+  run_test_helper_pt1("mar download with a valid SHA512 hash",
                       AUS_Cr.NS_OK, run_test_pt10);
 }
 
 // mar download with an invalid SHA384 hash
 function run_test_pt10() {
   setResponseBody("SHA512", SHA512_HASH_SIMPLE_MAR + "0");
-  run_test_helper_pt1("run_test_pt10 - mar download with an invalid SHA512 hash",
+  run_test_helper_pt1("mar download with an invalid SHA512 hash",
                       AUS_Cr.NS_ERROR_UNEXPECTED, run_test_pt11);
 }
 
 // mar download with the mar not found
 function run_test_pt11() {
   var patches = getRemotePatchString(null, URL_HOST + URL_PATH + "/missing.mar");
   var updates = getRemoteUpdateString(patches);
   gResponseBody = getRemoteUpdatesXMLString(updates);
-  run_test_helper_pt1("run_test_pt11 - mar download with the mar not found",
+  run_test_helper_pt1("mar download with the mar not found",
                       AUS_Cr.NS_ERROR_UNEXPECTED, finish_test);
 }
 
 /* Update download listener - nsIRequestObserver */
 const downloadListener = {
-  onStartRequest: function(request, context) {
+  onStartRequest: function DL_onStartRequest(request, context) {
   },
 
-  onProgress: function(request, context, progress, maxProgress) {
+  onProgress: function DL_onProgress(request, context, progress, maxProgress) {
   },
 
-  onStatus: function(request, context, status, statusText) {
+  onStatus: function DL_onStatus(request, context, status, statusText) {
   },
 
-  onStopRequest: function(request, context, status) {
+  onStopRequest: function DL_onStopRequest(request, context, status) {
     gStatusResult = status;
     // Use a timeout to allow the request to complete
-    do_timeout(0, gCheckFunc);
+    do_execute_soon(gCheckFunc);
   },
 
-  QueryInterface: function(iid) {
+  QueryInterface: function DL_QueryInterface(iid) {
     if (!iid.equals(AUS_Ci.nsIRequestObserver) &&
         !iid.equals(AUS_Ci.nsIProgressEventSink) &&
         !iid.equals(AUS_Ci.nsISupports))
       throw AUS_Cr.NS_ERROR_NO_INTERFACE;
     return this;
   }
 };
--- a/toolkit/mozapps/update/test/unit/test_0040_general.js
+++ b/toolkit/mozapps/update/test/unit/test_0040_general.js
@@ -47,17 +47,17 @@ function run_test() {
   do_register_cleanup(end_test);
   removeUpdateDirsAndFiles();
   // The mock XMLHttpRequest is MUCH faster
   overrideXHR(callHandleEvent);
   standardInit();
   gAppInfo = AUS_Cc["@mozilla.org/xre/app-info;1"].
              getService(AUS_Ci.nsIXULAppInfo).
              QueryInterface(AUS_Ci.nsIXULRuntime);
-  do_timeout(0, run_test_pt1);
+  do_execute_soon(run_test_pt1);
 }
 
 function end_test() {
   cleanUp();
 }
 
 // Callback function used by the custom XMLHttpRequest implementation to
 // call the nsIDOMEventListener's handleEvent method for onload.
@@ -153,18 +153,18 @@ function run_test_pt5() {
   gCheckFunc = check_test_pt5;
   var url = URL_PREFIX + "%LOCALE%/";
   logTestInfo("testing url constructed with %LOCALE% - " + url);
   setUpdateURLOverride(url);
   try {
     gUpdateChecker.checkForUpdates(updateCheckListener, true);
   }
   catch (e) {
-    dump("***\n*** The following error is most likely due to a missing " +
-         "update.locale file\n***\n");
+    logTestInfo("The following error is most likely due to a missing " +
+                "update.locale file");
     do_throw(e);
   }
 }
 
 function check_test_pt5() {
   do_check_eq(getResult(gRequestURL), INSTALL_LOCALE);
   run_test_pt6();
 }
--- a/toolkit/mozapps/update/test/unit/test_0050_general.js
+++ b/toolkit/mozapps/update/test/unit/test_0050_general.js
@@ -51,17 +51,17 @@ var gExpectedStatusText;
 function run_test() {
   do_test_pending();
   do_register_cleanup(end_test);
   removeUpdateDirsAndFiles();
   setUpdateURLOverride();
   standardInit();
   // The mock XMLHttpRequest is MUCH faster
   overrideXHR(callHandleEvent);
-  do_timeout(0, run_test_pt1);
+  do_execute_soon(run_test_pt1);
 }
 
 function end_test() {
   cleanUp();
 }
 
 // Callback function used by the custom XMLHttpRequest implementation to
 // call the nsIDOMEventListener's handleEvent method for onload.
--- a/toolkit/mozapps/update/test/unit/test_0063_manager.js
+++ b/toolkit/mozapps/update/test/unit/test_0063_manager.js
@@ -37,18 +37,18 @@
  */
 
 /* General Update Manager Tests */
 
 function run_test() {
   do_test_pending();
   do_register_cleanup(end_test);
 
-  dump("Testing: removing an active update for a channel that is not valid " +
-       "due to switching channels (bug 486275)");
+  logTestInfo("testing removing an active update for a channel that is not" +
+              "valid due to switching channels (bug 486275)");
   removeUpdateDirsAndFiles();
   setUpdateChannel("original_channel");
 
   var patches, update, update;
 
   patches = getLocalPatchString(null, null, null, null, null, null,
                                 STATE_DOWNLOADING);
   updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0");
--- a/toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js
+++ b/toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js
@@ -72,17 +72,17 @@ function run_test() {
   do_check_eq(readFile(log), "Last Update Log");
 
   log = dir.clone();
   log.append(FILE_BACKUP_LOG);
   logTestInfo("testing " + log.path + " shouldn't exist");
   do_check_false(log.exists());
 
   dir.append("0");
-  dump("testing " + dir.path + " should exists (bug 512994)");
+  logTestInfo("testing " + dir.path + " should exist (bug 512994)");
   do_check_true(dir.exists());
 
   do_test_finished();
 }
 
 function end_test() {
   cleanUp();
 }
--- a/toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js
+++ b/toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js
@@ -3,18 +3,16 @@
  */
 
 /**
  * Test that nsIUpdatePrompt doesn't display UI for showUpdateInstalled,
  * showUpdateAvailable, and showUpdateError when the app.update.silent
  * preference is true.
  */
 
-var gCheckFunc;
-
 function run_test() {
   do_test_pending();
   do_register_cleanup(end_test);
 
   logTestInfo("testing nsIUpdatePrompt notifications should not be seen " +
               "when the " + PREF_APP_UPDATE_SILENT + " preference is true");
 
   removeUpdateDirsAndFiles();
--- a/toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js
+++ b/toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js
@@ -2,18 +2,16 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test that nsIUpdatePrompt doesn't display UI for showUpdateInstalled and
  * showUpdateAvailable when there is already an application update window open.
  */
 
-var gCheckFunc;
-
 function run_test() {
   do_test_pending();
   do_register_cleanup(end_test);
 
   logTestInfo("testing nsIUpdatePrompt notifications should not be seen when " +
               "there is already an application update window open");
 
   removeUpdateDirsAndFiles();
--- a/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js
+++ b/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js
@@ -143,19 +143,18 @@ function run_test() {
   writeStatusFile(STATE_PENDING);
 
   // This is the directory where the update files will be located
   let updateTestDir = getUpdateTestDir();
   try {
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
-    dump("Unable to remove directory\n" +
-         "path: " + updateTestDir.path + "\n" +
-         "Exception: " + e + "\n");
+    logTestInfo("unable to remove directory - path: " + updateTestDir.path +
+                ", exception: " + e);
   }
 
   // Add the directory where the update files will be added and add files that
   // will be removed.
   if (!updateTestDir.exists()) {
     updateTestDir.create(AUS_Ci.nsIFile.DIRECTORY_TYPE, PERMS_DIRECTORY);
   }
   logTestInfo("update test directory path: " + updateTestDir.path);
@@ -246,19 +245,18 @@ function end_test() {
 
   // Remove the files added by the update.
   let updateTestDir = getUpdateTestDir();
   try {
     logTestInfo("removing update test directory " + updateTestDir.path);
     removeDirRecursive(updateTestDir);
   }
   catch (e) {
-    dump("Unable to remove directory\n" +
-         "path: " + updateTestDir.path + "\n" +
-         "Exception: " + e + "\n");
+    logTestInfo("unable to remove directory - path: " + updateTestDir.path +
+                ", exception: " + e);
   }
 
   // This will delete the app console log file if it exists.
   getAppConsoleLogPath();
 
   if (IS_UNIX) {
     // This will delete the launch script if it exists.
     getLaunchScript();
--- a/toolkit/mozapps/update/test/unit/test_bug595059.js
+++ b/toolkit/mozapps/update/test/unit/test_bug595059.js
@@ -55,18 +55,18 @@ function end_test() {
 var WindowWatcher = {
   getNewPrompter: function(aParent) {
     do_check_eq(aParent, null);
     return {
       alert: function(aTitle, aText) {
         let title = getString("updaterIOErrorTitle");
         do_check_eq(aTitle, title);
         let text = gUpdateBundle.formatStringFromName("updaterIOErrorMsg",
-                                                    [Services.appinfo.name,
-                                                     Services.appinfo.name], 2);
+                                                      [Services.appinfo.name,
+                                                       Services.appinfo.name], 2);
         do_check_eq(aText, text);
         do_test_finished();
       }
     }; 
   },
 
   QueryInterface: function(iid) {
     if (iid.equals(AUS_Ci.nsIWindowWatcher) ||