Merge f-t to m-c, a=merge
authorPhil Ringnalda <philringnalda@gmail.com>
Sat, 18 Apr 2015 16:46:44 -0700
changeset 239818 a32e3b93c8d8
parent 239809 a120cb5aeee9 (current diff)
parent 239817 0c3f0143bed5 (diff)
child 239837 6661f7bf6800
child 239878 edd7087c081f
child 239883 38b966bf348f
push id28612
push userphilringnalda@gmail.com
push dateSat, 18 Apr 2015 23:47:01 +0000
treeherdermozilla-central@a32e3b93c8d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone40.0a1
first release with
nightly linux32
a32e3b93c8d8 / 40.0a1 / 20150419030206 / files
nightly linux64
a32e3b93c8d8 / 40.0a1 / 20150419030206 / files
nightly mac
a32e3b93c8d8 / 40.0a1 / 20150419030206 / files
nightly win32
a32e3b93c8d8 / 40.0a1 / 20150419030206 / files
nightly win64
a32e3b93c8d8 / 40.0a1 / 20150419030206 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge f-t to m-c, a=merge
mobile/android/base/BrowserApp.java
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -193,16 +193,19 @@ const gXPInstallObserver = {
               Services.telemetry
                       .getHistogramById("SECURITY_UI")
                       .add(Ci.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL_CLICK_THROUGH);
             };
             break;
         }
       };
 
+      options.learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") +
+                             "find-and-install-add-ons";
+
       messageString = gNavigatorBundle.getString("addonConfirmInstall.message");
       messageString = PluralForm.get(installInfo.installs.length, messageString);
       messageString = messageString.replace("#1", brandShortName);
       messageString = messageString.replace("#2", installInfo.installs.length);
 
       let cancelButton = document.getElementById("addon-install-confirmation-cancel");
       cancelButton.label = gNavigatorBundle.getString("addonInstall.cancelButton.label");
       cancelButton.accessKey = gNavigatorBundle.getString("addonInstall.cancelButton.accesskey");
--- a/browser/components/preferences/in-content/subdialogs.js
+++ b/browser/components/preferences/in-content/subdialogs.js
@@ -175,51 +175,75 @@ let gSubDialog = {
     // Do this on load to wait for the CSS to load and apply before calculating the size.
     let docEl = this._frame.contentDocument.documentElement;
 
     let groupBoxTitle = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-title");
     let groupBoxTitleHeight = groupBoxTitle.clientHeight +
                               parseFloat(getComputedStyle(groupBoxTitle).borderBottomWidth);
 
     let groupBoxBody = document.getAnonymousElementByAttribute(this._box, "class", "groupbox-body");
+    // These are deduced from styles which we don't change, so it's safe to get them now:
     let boxVerticalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingTop);
     let boxHorizontalPadding = 2 * parseFloat(getComputedStyle(groupBoxBody).paddingLeft);
+    let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
+    let boxVerticalBorder = 2 * parseFloat(getComputedStyle(this._box).borderTopWidth);
+
+    // The difference between the frame and box shouldn't change, either:
+    let boxRect = this._box.getBoundingClientRect();
+    let frameRect = this._frame.getBoundingClientRect();
+    let frameSizeDifference = (frameRect.top - boxRect.top) + (boxRect.bottom - frameRect.bottom);
+
+    // Then determine and set a bunch of width stuff:
     let frameMinWidth = docEl.style.width || docEl.scrollWidth + "px";
     let frameWidth = docEl.getAttribute("width") ? docEl.getAttribute("width") + "px" :
                      frameMinWidth;
+    this._frame.style.width = frameWidth;
+    this._box.style.minWidth = "calc(" +
+                               (boxHorizontalBorder + boxHorizontalPadding) +
+                               "px + " + frameMinWidth + ")";
+
+    // Now do the same but for the height. We need to do this afterwards because otherwise
+    // XUL assumes we'll optimize for height and gives us "wrong" values which then are no
+    // longer correct after we set the width:
     let frameMinHeight = docEl.style.height || docEl.scrollHeight + "px";
     let frameHeight = docEl.getAttribute("height") ? docEl.getAttribute("height") + "px" :
-                      frameMinHeight;
-    let boxVerticalBorder = 2 * parseFloat(getComputedStyle(this._box).borderTopWidth);
-    let boxHorizontalBorder = 2 * parseFloat(getComputedStyle(this._box).borderLeftWidth);
-
-    let frameRect = this._frame.getBoundingClientRect();
-    let boxRect = this._box.getBoundingClientRect();
-    let frameSizeDifference = (frameRect.top - boxRect.top) + (boxRect.bottom - frameRect.bottom);
+                                                     frameMinHeight;
 
     // Now check if the frame height we calculated is possible at this window size,
     // accounting for titlebar, padding/border and some spacing.
     let maxHeight = window.innerHeight - frameSizeDifference - 30;
-    if (frameHeight > maxHeight) {
-      // If not, we should probably let the dialog scroll:
-      frameHeight = maxHeight;
+    // Do this with a frame height in pixels...
+    let comparisonFrameHeight;
+    if (frameHeight.endsWith("em")) {
+      let fontSize = parseFloat(getComputedStyle(this._frame).fontSize);
+      comparisonFrameHeight = parseFloat(frameHeight, 10) * fontSize;
+    } else if (frameHeight.endsWith("px")) {
+      comparisonFrameHeight = parseFloat(frameHeight, 10);
+    } else {
+      Cu.reportError("This dialog (" + this._frame.contentWindow.location.href + ") " +
+                     "set a height in non-px-non-em units ('" + frameHeight + "'), " +
+                     "which is likely to lead to bad sizing in in-content preferences. " +
+                     "Please consider changing this.");
+      comparisonFrameHeight = parseFloat(frameHeight);
+    }
+
+    if (comparisonFrameHeight > maxHeight) {
+      // If the height is bigger than that of the window, we should let the contents scroll:
+      frameHeight = maxHeight + "px";
+      frameMinHeight = maxHeight + "px";
       let containers = this._frame.contentDocument.querySelectorAll('.largeDialogContainer');
       for (let container of containers) {
         container.classList.add("doScroll");
       }
     }
 
-    this._frame.style.width = frameWidth;
     this._frame.style.height = frameHeight;
     this._box.style.minHeight = "calc(" +
                                 (boxVerticalBorder + groupBoxTitleHeight + boxVerticalPadding) +
                                 "px + " + frameMinHeight + ")";
-    this._box.style.minWidth = "calc(" +
-                               (boxHorizontalBorder + boxHorizontalPadding) +
-                               "px + " + frameMinWidth + ")";
 
     this._overlay.style.visibility = "visible";
     this._overlay.style.opacity = ""; // XXX: focus hack continued from _onContentLoaded
 
     this._resizeObserver = new MutationObserver(this._onResize);
     this._resizeObserver.observe(this._box, {attributes: true});
 
     this._trapFocus();
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -153,41 +153,103 @@ let gTests = [{
   desc: "Check that width and height from the sub-dialog are used to size the <browser>",
   run: function* () {
     let deferredClose = Promise.defer();
     let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
                                              (aEvent) => dialogClosingCallback(deferredClose, aEvent));
     let dialog = yield dialogPromise;
 
     ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
-    ise(content.gSubDialog._frame.style.height, "40em", "Height should be set on the frame from the dialog");
+    ise(content.gSubDialog._frame.style.height, "5em", "Height should be set on the frame from the dialog");
 
     content.gSubDialog.close();
     yield deferredClose.promise;
   },
 },
 {
+  desc: "Check that a set width and content causing wrapping still lead to correct scrollHeight-implied height",
+  run: function* () {
+    let deferredClose = Promise.defer();
+    let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
+                                             (aEvent) => dialogClosingCallback(deferredClose, aEvent));
+
+    let oldHeight;
+    content.addEventListener("DOMFrameContentLoaded", function frame2Loaded() {
+      content.removeEventListener("DOMFrameContentLoaded", frame2Loaded);
+      let doc = content.gSubDialog._frame.contentDocument;
+      oldHeight = doc.documentElement.scrollHeight;
+      doc.documentElement.style.removeProperty("height");
+      doc.getElementById("desc").textContent = `
+        Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
+        laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
+        architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
+        sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
+        laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
+        architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
+        sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
+        laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
+        architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
+        sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
+        voluptatem sequi nesciunt.`
+      doc = null;
+    });
+
+    let dialog = yield dialogPromise;
+
+    ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
+    let docEl = content.gSubDialog._frame.contentDocument.documentElement;
+    ok(docEl.scrollHeight > oldHeight, "Content height increased (from " + oldHeight + " to " + docEl.scrollHeight + ").");
+    ise(content.gSubDialog._frame.style.height, docEl.scrollHeight + "px", "Height on the frame should be higher now");
+
+    content.gSubDialog.close();
+    yield deferredClose.promise;
+  },
+},
+{
+  desc: "Check that a dialog that is too high gets cut down to size",
+  run: function* () {
+    let deferredClose = Promise.defer();
+    let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
+                                             (aEvent) => dialogClosingCallback(deferredClose, aEvent));
+
+    content.addEventListener("DOMFrameContentLoaded", function frame3Loaded() {
+      content.removeEventListener("DOMFrameContentLoaded", frame3Loaded);
+      content.gSubDialog._frame.contentDocument.documentElement.style.height = '100000px';
+    });
+
+    let dialog = yield dialogPromise;
+
+    ise(content.gSubDialog._frame.style.width, "32em", "Width should be set on the frame from the dialog");
+    let newHeight = content.gSubDialog._frame.contentDocument.documentElement.scrollHeight;
+    ok(parseInt(content.gSubDialog._frame.style.height) < window.innerHeight,
+       "Height on the frame should be smaller than window's innerHeight");
+
+    content.gSubDialog.close();
+    yield deferredClose.promise;
+  }
+},
+{
   desc: "Check that scrollWidth and scrollHeight from the sub-dialog are used to size the <browser>",
   run: function* () {
     let deferredClose = Promise.defer();
     let dialogPromise = openAndLoadSubDialog(gDialogURL, null, null,
                                              (aEvent) => dialogClosingCallback(deferredClose, aEvent));
 
     content.addEventListener("DOMFrameContentLoaded", function frameLoaded() {
       content.removeEventListener("DOMFrameContentLoaded", frameLoaded);
-      content.gSubDialog._frame.contentDocument.documentElement.style.height = "";
-      content.gSubDialog._frame.contentDocument.documentElement.style.width = "";
+      content.gSubDialog._frame.contentDocument.documentElement.style.removeProperty("height");
+      content.gSubDialog._frame.contentDocument.documentElement.style.removeProperty("width");
     });
 
     let dialog = yield dialogPromise;
 
     ok(content.gSubDialog._frame.style.width.endsWith("px"),
-       "Width should be set to a px value of the scrollWidth from the dialog");
+       "Width (" + content.gSubDialog._frame.style.width + ") should be set to a px value of the scrollWidth from the dialog");
     ok(content.gSubDialog._frame.style.height.endsWith("px"),
-       "Height should be set to a px value of the scrollHeight from the dialog");
+       "Height (" + content.gSubDialog._frame.style.height + ") should be set to a px value of the scrollHeight from the dialog");
 
     gTeardownAfterClose = true;
     content.gSubDialog.close();
     yield deferredClose.promise;
   },
 }];
 
 function promiseDialogClosing(dialog) {
--- a/browser/components/preferences/in-content/tests/subdialog.xul
+++ b/browser/components/preferences/in-content/tests/subdialog.xul
@@ -2,26 +2,26 @@
 
 <!-- Any copyright is dedicated to the Public Domain.
    - http://creativecommons.org/publicdomain/zero/1.0/ -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
 <dialog id="subDialog"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        title="Sample sub-dialog" style="width: 32em; height: 40em;"
+        title="Sample sub-dialog" style="width: 32em; height: 5em;"
         onload="document.getElementById('textbox').focus();"
         ondialogaccept="acceptSubdialog();">
   <script>
     function acceptSubdialog() {
       window.arguments[0].acceptCount++;
     }
   </script>
 
-  <description>A sample sub-dialog for testing</description>
+  <description id="desc">A sample sub-dialog for testing</description>
 
   <textbox id="textbox" value="Default text" />
 
   <separator class="thin"/>
 
   <button oncommand="close();" icon="close" label="Close" />
 
 </dialog>
--- a/browser/devtools/inspector/inspector-panel.js
+++ b/browser/devtools/inspector/inspector-panel.js
@@ -668,29 +668,37 @@ InspectorPanel.prototype = {
     // Disable delete item if needed
     let deleteNode = this.panelDoc.getElementById("node-menu-delete");
     if (isEditableElement) {
       deleteNode.removeAttribute("disabled");
     } else {
       deleteNode.setAttribute("disabled", "true");
     }
 
-    // Disable / enable "Copy Unique Selector", "Copy inner HTML" &
-    // "Copy outer HTML" as appropriate
+    // Disable / enable "Copy Unique Selector", "Copy inner HTML",
+    // "Copy outer HTML" & "Scroll Into View" as appropriate
     let unique = this.panelDoc.getElementById("node-menu-copyuniqueselector");
     let copyInnerHTML = this.panelDoc.getElementById("node-menu-copyinner");
     let copyOuterHTML = this.panelDoc.getElementById("node-menu-copyouter");
+    let scrollIntoView = this.panelDoc.getElementById("node-menu-scrollnodeintoview");
+
+    this._target.actorHasMethod("domnode", "scrollIntoView").then(value => {
+      scrollIntoView.hidden = !value;
+    });
+
     if (isSelectionElement) {
       unique.removeAttribute("disabled");
       copyInnerHTML.removeAttribute("disabled");
       copyOuterHTML.removeAttribute("disabled");
+      scrollIntoView.removeAttribute("disabled");
     } else {
       unique.setAttribute("disabled", "true");
       copyInnerHTML.setAttribute("disabled", "true");
       copyOuterHTML.setAttribute("disabled", "true");
+      scrollIntoView.setAttribute("disabled", "true");
     }
     if (!this.canGetUniqueSelector) {
       unique.hidden = true;
     }
 
     // Enable the "edit HTML" item if the selection is an element and the root
     // actor has the appropriate trait (isOuterHTMLEditable)
     let editHTML = this.panelDoc.getElementById("node-menu-edithtml");
@@ -995,16 +1003,28 @@ InspectorPanel.prototype = {
     }
 
     this.selection.nodeFront.getUniqueSelector().then((selector) => {
       clipboardHelper.copyString(selector);
     }).then(null, console.error);
   },
 
   /**
+   * Scroll the node into view.
+   */
+  scrollNodeIntoView: function InspectorPanel_scrollNodeIntoView()
+  {
+    if (!this.selection.isNode()) {
+      return;
+    }
+
+    this.selection.nodeFront.scrollIntoView();
+  },
+
+  /**
    * Delete the selected node.
    */
   deleteNode: function IUI_deleteNode() {
     if (!this.selection.isNode() ||
          this.selection.isRoot()) {
       return;
     }
 
--- a/browser/devtools/inspector/inspector.xul
+++ b/browser/devtools/inspector/inspector.xul
@@ -85,16 +85,21 @@
             oncommand="inspector.pasteAdjacentHTML('afterBegin')"/>
           <menuitem id="node-menu-pastelastchild"
             label="&inspectorHTMLPasteLastChild.label;"
             accesskey="&inspectorHTMLPasteLastChild.accesskey;"
             oncommand="inspector.pasteAdjacentHTML('beforeEnd')"/>
         </menupopup>
       </menu>
       <menuseparator/>
+      <menuitem id="node-menu-scrollnodeintoview"
+        label="&inspectorScrollNodeIntoView.label;"
+        accesskey="&inspectorScrollNodeIntoView.accesskey;"
+        oncommand="inspector.scrollNodeIntoView()"/>
+      <menuseparator/>
       <menuitem id="node-menu-delete"
         label="&inspectorHTMLDelete.label;"
         accesskey="&inspectorHTMLDelete.accesskey;"
         oncommand="inspector.deleteNode()"/>
       <menuseparator/>
       <menuitem id="node-menu-pseudo-hover"
         label=":hover" type="checkbox"
         oncommand="inspector.togglePseudoClass(':hover')"/>
--- a/browser/devtools/inspector/test/browser_inspector_menu-01-sensitivity.js
+++ b/browser/devtools/inspector/test/browser_inspector_menu-01-sensitivity.js
@@ -21,17 +21,18 @@ const ALL_MENU_ITEMS = [
   "node-menu-copyinner",
   "node-menu-copyouter",
   "node-menu-copyuniqueselector",
   "node-menu-copyimagedatauri",
   "node-menu-showdomproperties",
   "node-menu-delete",
   "node-menu-pseudo-hover",
   "node-menu-pseudo-active",
-  "node-menu-pseudo-focus"
+  "node-menu-pseudo-focus",
+  "node-menu-scrollnodeintoview"
 ].concat(PASTE_MENU_ITEMS);
 
 const ITEMS_WITHOUT_SHOWDOMPROPS =
   ALL_MENU_ITEMS.filter(item => item != "node-menu-showdomproperties");
 
 const TEST_CASES = [
   {
     desc: "doctype node with empty clipboard",
--- a/browser/devtools/inspector/test/browser_inspector_menu-04-other.js
+++ b/browser/devtools/inspector/test/browser_inspector_menu-04-other.js
@@ -8,16 +8,17 @@ http://creativecommons.org/publicdomain/
 const TEST_URL = TEST_URL_ROOT + "doc_inspector_menu.html";
 
 add_task(function* () {
   let { inspector, toolbox } = yield openInspectorForURL(TEST_URL);
 
   yield testShowDOMProperties();
   yield testDeleteNode();
   yield testDeleteRootNode();
+  yield testScrollIntoView();
 
   function* testShowDOMProperties() {
     info("Testing 'Show DOM Properties' menu item.");
     let showDOMPropertiesNode = inspector.panelDoc.getElementById("node-menu-showdomproperties");
     ok(showDOMPropertiesNode, "the popup menu has a show dom properties item");
 
     let consoleOpened = toolbox.once("webconsole-ready");
 
@@ -58,16 +59,21 @@ add_task(function* () {
     let deleteNode = inspector.panelDoc.getElementById("node-menu-delete");
     dispatchCommandEvent(deleteNode);
 
     executeSoon(() => {
       ok(content.document.documentElement, "Document element still alive.");
     });
   }
 
+  function* testScrollIntoView() {
+    // Follow up bug to add this test - https://bugzilla.mozilla.org/show_bug.cgi?id=1154107
+    todo(false, "Verify that node is scrolled into the viewport.");
+  }
+
   function dispatchCommandEvent(node) {
     info("Dispatching command event on " + node);
     let commandEvent = document.createEvent("XULCommandEvent");
     commandEvent.initCommandEvent("command", true, true, window, 0, false, false,
                                   false, false, null);
     node.dispatchEvent(commandEvent);
   }
 });
--- a/browser/locales/en-US/chrome/browser/devtools/inspector.dtd
+++ b/browser/locales/en-US/chrome/browser/devtools/inspector.dtd
@@ -63,16 +63,21 @@
 <!ENTITY inspectorHTMLPasteFirstChild.accesskey  "F">
 
 <!-- LOCALIZATION NOTE (inspectorHTMLPasteLastChild.label): This is the label
      shown in the inspector contextual-menu for the item that lets users paste
      the HTML as the last child the current node -->
 <!ENTITY inspectorHTMLPasteLastChild.label       "As Last Child">
 <!ENTITY inspectorHTMLPasteLastChild.accesskey   "L">
 
+<!-- LOCALIZATION NOTE (inspectorScrollNodeIntoView.label): This is the label
+     shown in the inspector contextual-menu for the item that lets users scroll
+     the current node into view -->
+<!ENTITY inspectorScrollNodeIntoView.label       "Scroll Into View">
+<!ENTITY inspectorScrollNodeIntoView.accesskey   "S">
 
 <!-- LOCALIZATION NOTE (inspectorHTMLDelete.label): This is the label shown in
      the inspector contextual-menu for the item that lets users delete the
      current node -->
 <!ENTITY inspectorHTMLDelete.label          "Delete Node">
 <!ENTITY inspectorHTMLDelete.accesskey      "D">
 
 <!ENTITY inspector.selectButton.tooltip     "Select element with mouse">
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1425,17 +1425,22 @@ public class BrowserApp extends GeckoApp
         final View browserChrome = mBrowserChrome;
         final ToolbarProgressView progressView = mProgressView;
         final int marginTop = Math.round(aMetrics.marginTop);
         ThreadUtils.postToUiThread(new Runnable() {
             @Override
             public void run() {
                 final float translationY = marginTop - browserChrome.getHeight();
                 ViewHelper.setTranslationY(browserChrome, translationY);
-                ViewHelper.setTranslationY(progressView, translationY);
+
+                // Stop the progressView from moving all the way up so that we can still see a good chunk of it
+                // when the chrome is offscreen.
+                final float offset = getResources().getDimensionPixelOffset(R.dimen.progress_bar_scroll_offset);
+                final float progressTranslationY = Math.max(marginTop - browserChrome.getHeight(), offset - browserChrome.getHeight());
+                ViewHelper.setTranslationY(progressView, progressTranslationY);
 
                 if (mDoorHangerPopup.isShowing()) {
                     mDoorHangerPopup.updatePopup();
                 }
             }
         });
 
         if (mFormAssistPopup != null)
--- a/mobile/android/base/MediaPlayerManager.java
+++ b/mobile/android/base/MediaPlayerManager.java
@@ -1,58 +1,51 @@
 /* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
  * 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/. */
 
 package org.mozilla.gecko;
 
-import android.app.Presentation;
-import android.content.Context;
-import android.os.Build;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v7.media.MediaControlIntent;
 import android.support.v7.media.MediaRouteSelector;
 import android.support.v7.media.MediaRouter;
 import android.support.v7.media.MediaRouter.RouteInfo;
 import android.util.Log;
-import android.view.Display;
-import android.view.Surface;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.ViewGroup;
-import android.view.ViewGroup.LayoutParams;
-import android.view.WindowManager;
 
 import com.google.android.gms.cast.CastMediaControlIntent;
 
-import org.json.JSONArray;
-import org.json.JSONException;
 import org.json.JSONObject;
+import org.mozilla.gecko.AppConstants.Versions;
 import org.mozilla.gecko.mozglue.JNITarget;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.NativeEventListener;
 import org.mozilla.gecko.util.NativeJSObject;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
-/* Manages a list of GeckoMediaPlayers methods (i.e. Chromecast/Miracast). Routes messages
+/**
+ * Manages a list of GeckoMediaPlayers methods (i.e. Chromecast/Miracast). Routes messages
  * from Gecko to the correct caster based on the id of the display
  */
 public class MediaPlayerManager extends Fragment implements NativeEventListener {
     /**
      * Create a new instance of DetailsFragment, initialized to
      * show the text at 'index'.
      */
     @JNITarget
     public static MediaPlayerManager newInstance() {
-        return new MediaPlayerManager();
+        if (Versions.feature17Plus) {
+            return new PresentationMediaPlayerManager();
+        } else {
+            return new MediaPlayerManager();
+        }
     }
 
     private static final String LOGTAG = "GeckoMediaPlayerManager";
 
     @JNITarget
     public static final String MEDIA_PLAYER_TAG = "MPManagerFragment";
 
     private static final boolean SHOW_DEBUG = false;
@@ -64,19 +57,18 @@ public class MediaPlayerManager extends 
     }
 
     private static void debug(String msg) {
         if (SHOW_DEBUG) {
             Log.d(LOGTAG, msg);
         }
     }
 
-    private MediaRouter mediaRouter = null;
-    private final Map<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
-    private GeckoPresentation presentation = null;
+    protected MediaRouter mediaRouter = null;
+    protected final Map<String, GeckoMediaPlayer> displays = new HashMap<String, GeckoMediaPlayer>();
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         EventDispatcher.getInstance().registerGeckoThreadListener(this,
                 "MediaPlayer:Load",
                 "MediaPlayer:Start",
                 "MediaPlayer:Stop",
@@ -234,90 +226,10 @@ public class MediaPlayerManager extends 
         final MediaRouteSelector selectorBuilder = new MediaRouteSelector.Builder()
             .addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO)
             .addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)
             .addControlCategory(CastMediaControlIntent.categoryForCast(ChromeCast.MIRROR_RECEIVER_APP_ID))
             .build();
         mediaRouter.addCallback(selectorBuilder, callback, MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
     }
 
-    @Override
-    public void onStop() {
-        super.onStop();
-        if (presentation != null) {
-            presentation.dismiss();
-            presentation = null;
-        }
-    }
-
-    private void updatePresentation() {
-        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1) {
-            return;
-        }
-
-        if (mediaRouter == null) {
-            return;
-        }
-
-        MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
-        Display display = route != null ? route.getPresentationDisplay() : null;
-
-        if (display != null) {
-            if ((presentation != null) && (presentation.getDisplay() != display)) {
-                presentation.dismiss();
-                presentation = null;
-            }
-
-            if (presentation == null) {
-                presentation = new GeckoPresentation(getActivity(), display);
-
-                try {
-                    presentation.show();
-                } catch (WindowManager.InvalidDisplayException ex) {
-                    Log.w(LOGTAG, "Couldn't show presentation!  Display was removed in "
-                            + "the meantime.", ex);
-                    presentation = null;
-                }
-            }
-        } else if (presentation != null) {
-            presentation.dismiss();
-            presentation = null;
-        }
-    }
-
-    private static class SurfaceListener implements SurfaceHolder.Callback {
-        @Override
-        public void surfaceChanged(SurfaceHolder holder, int format, int width,
-                                                int height) {
-            // Surface changed so force a composite
-            GeckoAppShell.scheduleComposite();
-        }
-
-        @Override
-        public void surfaceCreated(SurfaceHolder holder) {
-            GeckoAppShell.addPresentationSurface(holder.getSurface());
-            GeckoAppShell.scheduleComposite();
-        }
-
-        @Override
-        public void surfaceDestroyed(SurfaceHolder holder) {
-            GeckoAppShell.removePresentationSurface(holder.getSurface());
-        }
-    }
-
-    private final static class GeckoPresentation extends Presentation {
-        private SurfaceView mView;
-        public GeckoPresentation(Context context, Display display) {
-            super(context, display);
-        }
-
-        @Override
-        protected void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
-
-            mView = new SurfaceView(getContext());
-            setContentView(mView, new ViewGroup.LayoutParams(
-                ViewGroup.LayoutParams.MATCH_PARENT,
-                ViewGroup.LayoutParams.MATCH_PARENT));
-            mView.getHolder().addCallback(new SurfaceListener());
-        }
-    }
+    protected void updatePresentation() { /* Overridden in sub-classes. */ }
 }
new file mode 100644
--- /dev/null
+++ b/mobile/android/base/PresentationMediaPlayerManager.java
@@ -0,0 +1,117 @@
+/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
+ * 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/. */
+
+package org.mozilla.gecko;
+
+import android.annotation.TargetApi;
+import android.app.Presentation;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v7.media.MediaRouter;
+import android.util.Log;
+import android.view.Display;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+
+import org.mozilla.gecko.AppConstants.Versions;
+
+/**
+ * A MediaPlayerManager with API 17+ Presentation support.
+ */
+@TargetApi(17)
+public class PresentationMediaPlayerManager extends MediaPlayerManager {
+
+    private static final String LOGTAG = "Gecko" + PresentationMediaPlayerManager.class.getSimpleName();
+
+    private GeckoPresentation presentation;
+
+    public PresentationMediaPlayerManager() {
+        if (!Versions.feature17Plus) {
+            throw new IllegalStateException(PresentationMediaPlayerManager.class.getSimpleName() +
+                    " does not support < API 17");
+        }
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        if (presentation != null) {
+            presentation.dismiss();
+            presentation = null;
+        }
+    }
+
+    @Override
+    protected void updatePresentation() {
+        if (mediaRouter == null) {
+            return;
+        }
+
+        MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
+        Display display = route != null ? route.getPresentationDisplay() : null;
+
+        if (display != null) {
+            if ((presentation != null) && (presentation.getDisplay() != display)) {
+                presentation.dismiss();
+                presentation = null;
+            }
+
+            if (presentation == null) {
+                presentation = new GeckoPresentation(getActivity(), display);
+
+                try {
+                    presentation.show();
+                } catch (WindowManager.InvalidDisplayException ex) {
+                    Log.w(LOGTAG, "Couldn't show presentation!  Display was removed in "
+                            + "the meantime.", ex);
+                    presentation = null;
+                }
+            }
+        } else if (presentation != null) {
+            presentation.dismiss();
+            presentation = null;
+        }
+    }
+
+    private final static class GeckoPresentation extends Presentation {
+        private SurfaceView mView;
+        public GeckoPresentation(Context context, Display display) {
+            super(context, display);
+        }
+
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            mView = new SurfaceView(getContext());
+            setContentView(mView, new ViewGroup.LayoutParams(
+                    ViewGroup.LayoutParams.MATCH_PARENT,
+                    ViewGroup.LayoutParams.MATCH_PARENT));
+            mView.getHolder().addCallback(new SurfaceListener());
+        }
+    }
+
+    private static class SurfaceListener implements SurfaceHolder.Callback {
+        @Override
+        public void surfaceChanged(SurfaceHolder holder, int format, int width,
+                                   int height) {
+            // Surface changed so force a composite
+            GeckoAppShell.scheduleComposite();
+        }
+
+        @Override
+        public void surfaceCreated(SurfaceHolder holder) {
+            GeckoAppShell.addPresentationSurface(holder.getSurface());
+            GeckoAppShell.scheduleComposite();
+        }
+
+        @Override
+        public void surfaceDestroyed(SurfaceHolder holder) {
+            GeckoAppShell.removePresentationSurface(holder.getSurface());
+        }
+    }
+}
--- a/mobile/android/base/firstrun/FirstrunPager.java
+++ b/mobile/android/base/firstrun/FirstrunPager.java
@@ -67,24 +67,24 @@ public class FirstrunPager extends ViewP
 
         public ViewPagerAdapter(FragmentManager fm, List<FirstrunPagerConfig.FirstrunPanel> panels) {
             super(fm);
             this.panels = panels;
         }
 
         @Override
         public Fragment getItem(int i) {
-            final Fragment fragment = Fragment.instantiate(context, panels.get(i).getResource());
+            final Fragment fragment = Fragment.instantiate(context, panels.get(i).getClassname());
             ((FirstrunPanel) fragment).setOnFinishListener(listener);
             return fragment;
         }
 
         @Override
         public int getCount() {
             return panels.size();
         }
 
         @Override
         public CharSequence getPageTitle(int i) {
-            return panels.get(i).getTitle().toUpperCase();
+            return context.getString(panels.get(i).getTitleRes()).toUpperCase();
         }
     }
 }
--- a/mobile/android/base/firstrun/FirstrunPagerConfig.java
+++ b/mobile/android/base/firstrun/FirstrunPagerConfig.java
@@ -6,31 +6,31 @@
 package org.mozilla.gecko.firstrun;
 
 import java.util.LinkedList;
 import java.util.List;
 
 public class FirstrunPagerConfig {
     public static List<FirstrunPanel> getDefault() {
         final List<FirstrunPanel> panels = new LinkedList<>();
-        panels.add(new FirstrunPanel(WelcomePanel.class.getName(), "Welcome"));
+        panels.add(new FirstrunPanel(WelcomePanel.class.getName(), WelcomePanel.TITLE_RES));
         return panels;
     }
 
     public static class FirstrunPanel {
-        private String resource;
-        private String title;
+        private String classname;
+        private int titleRes;
 
-        public FirstrunPanel(String resource, String title) {
-            this.resource = resource;
-            this.title = title;
+        public FirstrunPanel(String resource, int titleRes) {
+            this.classname= resource;
+            this.titleRes = titleRes;
         }
 
-        public String getResource() {
-            return this.resource;
+        public String getClassname() {
+            return this.classname;
         }
 
-        public String getTitle() {
-            return this.title;
+        public int getTitleRes() {
+            return this.titleRes;
         }
 
     }
 }
--- a/mobile/android/base/firstrun/FirstrunPanel.java
+++ b/mobile/android/base/firstrun/FirstrunPanel.java
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.firstrun;
 
 import android.support.v4.app.Fragment;
 
 public class FirstrunPanel extends Fragment {
 
+    public static final int TITLE_RES = -1;
     protected FirstrunPane.OnFinishListener onFinishListener;
 
     public void setOnFinishListener(FirstrunPane.OnFinishListener listener) {
         this.onFinishListener = listener;
     }
 
     protected void close() {
         if (onFinishListener != null) {
--- a/mobile/android/base/firstrun/WelcomePanel.java
+++ b/mobile/android/base/firstrun/WelcomePanel.java
@@ -11,16 +11,18 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity;
 
 public class WelcomePanel extends FirstrunPanel {
+    public static final int TITLE_RES = R.string.firstrun_panel_title_welcome;
+
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
         final ViewGroup root = (ViewGroup) inflater.inflate(R.layout.firstrun_welcome_fragment, container, false);
         root.findViewById(R.id.welcome_account).setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.BUTTON, "firstrun-sync");
 
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -443,16 +443,18 @@ size. -->
 <!ENTITY button_cancel "Cancel">
 <!ENTITY button_yes "Yes">
 <!ENTITY button_no "No">
 <!ENTITY button_clear_data "Clear data">
 <!ENTITY button_set "Set">
 <!ENTITY button_clear "Clear">
 <!ENTITY button_remember "Remember">
 
+<!ENTITY firstrun_panel_title_welcome "Welcome">
+
 <!ENTITY home_top_sites_title "Top Sites">
 <!-- Localization note (home_top_sites_add): This string is used as placeholder
      text underneath empty thumbnails in the Top Sites page on about:home. -->
 <!ENTITY home_top_sites_add "Add a site">
 
 <!-- Localization note (home_title): This string should be kept in sync
      with the page title defined in aboutHome.dtd -->
 <!ENTITY home_title "&brandShortName; Home">
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -590,16 +590,17 @@ moz_native_devices_jars = [
     CONFIG['ANDROID_APPCOMPAT_LIB'],
     CONFIG['ANDROID_MEDIAROUTER_LIB'],
     CONFIG['GOOGLE_PLAY_SERVICES_LIB'],
 ]
 moz_native_devices_sources = [
     'ChromeCast.java',
     'GeckoMediaPlayer.java',
     'MediaPlayerManager.java',
+    'PresentationMediaPlayerManager.java',
 ]
 if CONFIG['MOZ_NATIVE_DEVICES']:
     gbjar.extra_jars += moz_native_devices_jars
     gbjar.sources += moz_native_devices_sources
 
 gbjar.javac_flags += ['-Xlint:all,-deprecation,-fallthrough', '-J-Xmx512m', '-J-Xms128m']
 
 # gecko-thirdparty is a good place to put small independent libraries
--- a/mobile/android/base/resources/values/dimens.xml
+++ b/mobile/android/base/resources/values/dimens.xml
@@ -213,16 +213,18 @@
     <dimen name="find_in_page_status_margin_right">10dip</dimen>
     <dimen name="find_in_page_matchcase_padding">10dip</dimen>
     <dimen name="find_in_page_control_margin_top">2dip</dimen>
 
     <!-- The share icon asset has no padding while the other action bar items do
          so we dynamically add padding to compensate. To be removed in bug 1122752. -->
     <dimen name="ab_share_padding">12dp</dimen>
 
+    <dimen name="progress_bar_scroll_offset">1.5dp</dimen>
+
     <!-- This is a 4:7 ratio (as per UX decision). -->
     <item name="thumbnail_aspect_ratio" format="float" type="dimen">0.571</item>
 
     <!-- http://blog.danlew.net/2015/01/06/handling-android-resources-with-non-standard-formats/ -->
     <item name="match_parent" type="dimen">-1</item>
     <item name="wrap_content" type="dimen">-2</item>
 
 </resources>
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -375,16 +375,18 @@
   <string name="button_cancel">&button_cancel;</string>
   <string name="button_clear_data">&button_clear_data;</string>
   <string name="button_set">&button_set;</string>
   <string name="button_clear">&button_clear;</string>
   <string name="button_yes">&button_yes;</string>
   <string name="button_no">&button_no;</string>
   <string name="button_remember">&button_remember;</string>
 
+  <string name="firstrun_panel_title_welcome">&firstrun_panel_title_welcome;</string>
+
   <string name="home_title">&home_title;</string>
   <string name="home_top_sites_title">&home_top_sites_title;</string>
   <string name="home_top_sites_add">&home_top_sites_add;</string>
   <string name="home_history_title">&home_history_title;</string>
   <string name="home_clear_history_button">&home_clear_history_button;</string>
   <string name="home_clear_history_confirm">&home_clear_history_confirm;</string>
   <string name="home_bookmarks_empty">&home_bookmarks_empty;</string>
   <string name="home_closed_tabs_title">&home_closed_tabs_title;</string>
--- a/toolkit/devtools/server/actors/inspector.js
+++ b/toolkit/devtools/server/actors/inspector.js
@@ -577,16 +577,26 @@ var NodeActor = exports.NodeActor = prot
   }, {
     request: {},
     response: {
       value: RetVal("string")
     }
   }),
 
   /**
+   * Scroll the selected node into view.
+   */
+  scrollIntoView: method(function() {
+    this.rawNode.scrollIntoView(true);
+  }, {
+    request: {},
+    response: {}
+  }),
+
+  /**
    * Get the node's image data if any (for canvas and img nodes).
    * Returns an imageData object with the actual data being a LongStringActor
    * and a size json object.
    * The image data is transmitted as a base64 encoded png data-uri.
    * The method rejects if the node isn't an image or if the image is missing
    *
    * Accepts a maxDim request parameter to resize images that are larger. This
    * is important as the resizing occurs server-side so that image-data being
--- a/toolkit/devtools/server/tests/mochitest/chrome.ini
+++ b/toolkit/devtools/server/tests/mochitest/chrome.ini
@@ -48,16 +48,17 @@ skip-if = buildapp == 'mulet'
 [test_inspector-mutations-childlist.html]
 [test_inspector-mutations-frameload.html]
 [test_inspector-mutations-value.html]
 [test_inspector-pseudoclass-lock.html]
 [test_inspector-release.html]
 [test_inspector-reload.html]
 [test_inspector-remove.html]
 [test_inspector-retain.html]
+[test_inspector-scroll-into-view.html]
 [test_inspector-traversal.html]
 [test_makeGlobalObjectReference.html]
 [test_styles-applied.html]
 [test_styles-computed.html]
 [test_styles-matched.html]
 [test_styles-modify.html]
 [test_styles-svg.html]
 [test_unsafeDereference.html]
--- a/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html
+++ b/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html
@@ -81,10 +81,11 @@
   <div id="pseudo"><span>middle</span></div>
   <div id="pseudo-empty"></div>
 
   <div id="shadow">light dom</div>
 
   <object>
       <div id="1"></div>
   </object>
+  <div id="scroll-into-view" style="margin-top: 1000px;">scroll</div>
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/server/tests/mochitest/test_inspector-scroll-into-view.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=901250
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 901250</title>
+
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+  <script type="application/javascript;version=1.8" src="inspector-helpers.js"></script>
+  <script type="application/javascript;version=1.8">
+Components.utils.import("resource://gre/modules/devtools/Loader.jsm");
+const {Promise: promise} = Components.utils.import("resource://gre/modules/Promise.jsm", {});
+const Ci = Components.interfaces;
+const inspector = devtools.require("devtools/server/actors/inspector");
+
+window.onload = function() {
+  SimpleTest.waitForExplicitFinish();
+  runNextTest();
+}
+
+var gInspectee = null;
+var gClient = null;
+var gWalker = null;
+
+function assertOwnership() {
+  assertOwnershipTrees(gWalker);
+}
+
+addTest(function setup() {
+  let url = document.getElementById("inspectorContent").href;
+  attachURL(url, function(err, client, tab, doc) {
+    gInspectee = doc;
+    let {InspectorFront} = devtools.require("devtools/server/actors/inspector");
+    let inspector = InspectorFront(client, tab);
+    promiseDone(inspector.getWalker().then(walker => {
+      ok(walker, "getWalker() should return an actor.");
+      gClient = client;
+      gWalker = walker;
+    }).then(runNextTest));
+  });
+});
+
+addTest(Task.async(function* testScrollIntoView() {
+  let id = "#scroll-into-view";
+  let rect = gInspectee.querySelector(id).getBoundingClientRect();
+  let nodeFront = yield gWalker.querySelector(gWalker.rootNode, id);
+  let inViewport = rect.x >= 0 &&
+                   rect.y >= 0 &&
+                   rect.y <= gInspectee.defaultView.innerHeight &&
+                   rect.x <= gInspectee.defaultView.innerWidth;
+
+  ok(!inViewport, "Element is not in viewport.");
+
+  yield nodeFront.scrollIntoView();
+
+  SimpleTest.executeSoon(() => {
+    rect = gInspectee.querySelector(id).getBoundingClientRect();
+    inViewport = rect.x >= 0 &&
+                 rect.y >= 0 &&
+                 rect.y <= gInspectee.defaultView.innerHeight &&
+                 rect.x <= gInspectee.defaultView.innerWidth;
+
+    ok(inViewport, "Element is in viewport.");
+
+    runNextTest();
+  });
+}));
+
+addTest(function cleanup() {
+  delete gWalker;
+  delete gInspectee;
+  delete gClient;
+  runNextTest();
+});
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=901250">Mozilla Bug 901250</a>
+<a id="inspectorContent" target="_blank" href="inspector-traversal-data.html">Test Document</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
--- a/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
+++ b/toolkit/mozapps/update/tests/data/xpcshellUtilsAUS.js
@@ -72,16 +72,21 @@ const LOG_SWITCH_SUCCESS = "rename_file:
                            "calling QuitProgressUI";
 
 const ERR_RENAME_FILE = "rename_file: failed to rename file";
 const ERR_UNABLE_OPEN_DEST = "unable to open destination file";
 const ERR_BACKUP_DISCARD = "backup_discard: unable to remove";
 
 const LOG_SVC_SUCCESSFUL_LAUNCH = "Process was started... waiting on result.";
 
+// Typical end of a message when calling assert
+const MSG_SHOULD_EQUAL = " should equal the expected value";
+const MSG_SHOULD_EXIST = "the file or directory should exist";
+const MSG_SHOULD_NOT_EXIST = "the file or directory should not exist";
+
 // All we care about is that the last modified time has changed so that Mac OS
 // X Launch Services invalidates its cache so the test allows up to one minute
 // difference in the last modified time.
 const MAC_MAX_TIME_DIFFERENCE = 60000;
 
 // Time to wait for the test helper process before continuing the test
 const TEST_HELPER_TIMEOUT = 100;
 
@@ -752,35 +757,36 @@ if (MOZ_APP_NAME == "xulrunner") {
 /**
  * Helper function for setting up the test environment.
  */
 function setupTestCommon() {
   debugDump("start - general test setup");
 
   do_test_pending();
 
-  Assert.strictEqual(gTestID, undefined, "gTestID should be 'undefined' (" +
-                     "setupTestCommon should only be called once)");
+  Assert.strictEqual(gTestID, undefined,
+                     "gTestID should be 'undefined' (setupTestCommon should " +
+                     "only be called once)");
 
   let caller = Components.stack.caller;
   gTestID = caller.filename.toString().split("/").pop().split(".")[0];
 
   if (DEBUG_TEST_LOG) {
     let logFile = do_get_file(gTestID + ".log", true);
     if (logFile.exists()) {
       gPassed = false;
       logTestInfo("start - dumping previous test run log");
       logTestInfo("\n" + readFile(logFile) + "\n");
       logTestInfo("finish - dumping previous test run log");
       if (gDeleteLogFile) {
         logFile.remove(false);
       }
       do_throw("The parallel run of this test failed. Failing non-parallel " +
                "test so the log from the parallel run can be displayed in " +
-               "non-parallel log.")
+               "non-parallel log.");
     } else {
       gRealDump = dump;
       dump = dumpOverride;
     }
   }
 
   // Don't attempt to show a prompt when an update finishes.
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, true);
@@ -1040,16 +1046,66 @@ function preventDistributionFiles() {
     return aTestFile.relPathDir.indexOf("distribution/") == -1;
   });
 
   gTestDirs = gTestDirs.filter(function(aTestDir) {
     return aTestDir.relPathDir.indexOf("distribution/") == -1;
   });
 }
 
+/**
+ * On Mac OS X this sets the last modified time for the app bundle directory to
+ * a date in the past to test that the last modified time is updated when an
+ * update has been successfully applied (bug 600098).
+ */
+function setAppBundleModTime() {
+  if (!IS_MACOSX) {
+    return;
+  }
+  let now = Date.now();
+  let yesterday = now - (1000 * 60 * 60 * 24);
+  let applyToDir = getApplyDirFile();
+  applyToDir.lastModifiedTime = yesterday;
+}
+
+/**
+ * On Mac OS X this checks that the last modified time for the app bundle
+ * directory has been updated when an update has been successfully applied
+ * (bug 600098).
+ */
+function checkAppBundleModTime() {
+  if (!IS_MACOSX) {
+    return;
+  }
+  let now = Date.now();
+  let applyToDir = getApplyDirFile();
+  let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
+  Assert.ok(timeDiff < MAC_MAX_TIME_DIFFERENCE,
+            "the last modified time on the apply to directory should " +
+            "change after a successful update");
+}
+
+/**
+ * On Mac OS X and Windows this checks if the post update '.running' file exists
+ * to determine if the post update binary was launched.
+ *
+ * @param   aShouldExist
+ *          Whether the post update '.running' file should exist.
+ */
+function checkPostUpdateRunningFile(aShouldExist) {
+  if (!IS_WIN && !IS_MACOSX) {
+    return;
+  }
+  let postUpdateRunningFile = getPostUpdateFile(".running");
+  if (aShouldExist) {
+    Assert.ok(postUpdateRunningFile.exists(), MSG_SHOULD_EXIST);
+  } else {
+    Assert.ok(!postUpdateRunningFile.exists(), MSG_SHOULD_NOT_EXIST);
+  }
+}
 
 /**
  * Initializes the most commonly used settings and creates an instance of the
  * update service stub.
  */
 function standardInit() {
   createAppInfo("xpcshell@tests.mozilla.org", APP_INFO_NAME, "1.0", "2.0");
   setDefaultPrefs();
@@ -1081,17 +1137,17 @@ function pathHandler(aMetadata, aRespons
 function getAppVersion() {
   // Read the application.ini and use its application version.
   let iniFile = gGREDirOrig.clone();
   iniFile.append(FILE_APPLICATION_INI);
   if (!iniFile.exists()) {
     iniFile = gGREBinDirOrig.clone();
     iniFile.append(FILE_APPLICATION_INI);
   }
-  Assert.ok(iniFile.exists(), "the application.ini file should exist");
+  Assert.ok(iniFile.exists(), MSG_SHOULD_EXIST);
   let iniParser = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
                   getService(Ci.nsIINIParserFactory).
                   createINIParser(iniFile);
   return iniParser.getString("App", "Version");
 }
 
 /**
  * Helper function for getting the relative path to the directory where the
@@ -1166,17 +1222,17 @@ function getStageDirFile(aRelPath, aAllo
       let pathParts = aRelPath.split("/");
       for (let i = 0; i < pathParts.length; i++) {
         if (pathParts[i]) {
           file.append(pathParts[i]);
         }
       }
     }
     if (!aAllowNonexistent) {
-      Assert.ok(file.exists(), file.path + " should exist");
+      Assert.ok(file.exists(), MSG_SHOULD_EXIST);
     }
     return file;
   }
 
   let relpath = getApplyDirPath() + DIR_UPDATED + "/" + (aRelPath ? aRelPath : "");
   return do_get_file(relpath, aAllowNonexistent);
 }
 
@@ -1420,38 +1476,37 @@ function lockDirectory(aDir) {
   }
 
   let file = aDir.clone();
   file.append(kLockFileName);
   file.create(file.NORMAL_FILE_TYPE, 0o444);
   file.QueryInterface(Ci.nsILocalFileWin);
   file.fileAttributesWin |= file.WFA_READONLY;
   file.fileAttributesWin &= ~file.WFA_READWRITE;
-  debugDump("testing the successful creation of the lock file");
-  do_check_true(file.exists());
-  do_check_false(file.isWritable());
+  Assert.ok(file.exists(), MSG_SHOULD_EXIST);
+  Assert.ok(!file.isWritable(),
+            "the lock file should not be writeable");
 }
 /**
  * Helper function for unlocking a directory on Windows.
  *
  * @param   aDir
  *          The nsIFile for the directory to unlock.
  */
 function unlockDirectory(aDir) {
   if (!IS_WIN) {
     do_throw("Windows only function called by a different platform!");
   }
   let file = aDir.clone();
   file.append(kLockFileName);
   file.QueryInterface(Ci.nsILocalFileWin);
   file.fileAttributesWin |= file.WFA_READWRITE;
   file.fileAttributesWin &= ~file.WFA_READONLY;
-  debugDump("removing and testing the successful removal of the lock file");
   file.remove(false);
-  do_check_false(file.exists());
+  Assert.ok(!file.exists(), MSG_SHOULD_NOT_EXIST);
 }
 
 /**
  * Helper function for updater tests for launching the updater binary to apply
  * a mar file.
  *
  * @param   aExpectedExitValue
  *          The expected exit value from the updater binary.
@@ -1465,30 +1520,30 @@ function unlockDirectory(aDir) {
  */
 function runUpdate(aExpectedExitValue, aExpectedStatus, aCallback) {
   // Copy the updater binary to the updates directory.
   let binDir = gGREBinDirOrig.clone();
   let updater = getTestDirFile("updater.app", true);
   if (!updater.exists()) {
     updater = getTestDirFile(FILE_UPDATER_BIN);
     if (!updater.exists()) {
-      do_throw("Unable to find updater binary!");
+      do_throw("Unable to find the updater binary!");
     }
   }
-  Assert.ok(updater.exists(), "updater or updater.app should exist");
+  Assert.ok(updater.exists(), MSG_SHOULD_EXIST);
 
   let updatesDir = getUpdatesPatchDir();
   updater.copyToFollowingLinks(updatesDir, updater.leafName);
   let updateBin = updatesDir.clone();
   updateBin.append(updater.leafName);
   if (updateBin.leafName == "updater.app") {
     updateBin.append("Contents");
     updateBin.append("MacOS");
     updateBin.append("updater");
-    Assert.ok(updateBin.exists(), updateBin.path + " should exist");
+    Assert.ok(updateBin.exists(), MSG_SHOULD_EXIST);
   }
 
   let applyToDir = getApplyDirFile(null, true);
   let applyToDirPath = applyToDir.path;
 
   let stageDir = getStageDirFile(null, true);
   let stageDirPath = stageDir.path;
 
@@ -1548,21 +1603,20 @@ function runUpdate(aExpectedExitValue, a
     // xpcshell tests won't display the entire contents so log each line.
     let contents = readFileBytes(updateLog).replace(/\r\n/g, "\n");
     let aryLogContents = contents.split("\n");
     logTestInfo("contents of " + updateLog.path + ":");
     aryLogContents.forEach(function RU_LC_FE(aLine) {
       logTestInfo(aLine);
     });
   }
-  debugDump("testing updater binary process exitValue against expected " +
-            "exit value");
-  do_check_eq(process.exitValue, aExpectedExitValue);
-  debugDump("testing update status against expected status");
-  do_check_eq(status, aExpectedStatus);
+  Assert.equal(process.exitValue, aExpectedExitValue,
+               "the process exit value" + MSG_SHOULD_EQUAL);
+  Assert.equal(status, aExpectedStatus,
+               "the update status" + MSG_SHOULD_EQUAL);
 
   if (aCallback !== null) {
     if (typeof(aCallback) == typeof(Function)) {
       aCallback();
     } else {
       checkUpdateApplied();
     }
   }
@@ -1592,17 +1646,17 @@ function stageUpdate() {
  * @param  aFirstTest
  *         Whether this is the first test within the test.
  * @return true if the test should run and false if it shouldn't.
  */
 function shouldRunServiceTest(aFirstTest) {
   let binDir = getGREBinDir();
   let updaterBin = binDir.clone();
   updaterBin.append(FILE_UPDATER_BIN);
-  Assert.ok(updaterBin.exists(), updaterBin.path + " should exist");
+  Assert.ok(updaterBin.exists(), MSG_SHOULD_EXIST);
 
   let updaterBinPath = updaterBin.path;
   if (/ /.test(updaterBinPath)) {
     updaterBinPath = '"' + updaterBinPath + '"';
   }
 
   let isBinSigned = isBinarySigned(updaterBinPath);
 
@@ -1613,51 +1667,52 @@ function shouldRunServiceTest(aFirstTest
   try {
     key.open(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE, REG_PATH,
              Ci.nsIWindowsRegKey.ACCESS_READ | key.WOW64_64);
   } catch (e) {
     // The build system could sign the files and not have the test registry key
     // in which case we should fail the test if the updater binary is signed so
     // the build system can be fixed by adding the registry key.
     if (IS_AUTHENTICODE_CHECK_ENABLED) {
-      Assert.ok(!isBinSigned, "the updater.exe binary should not be signed " +
-                "when the test registry key doesn't exist (if it is, build " +
-                "system configuration bug?)");
+      Assert.ok(!isBinSigned,
+                "the updater.exe binary should not be signed when the test " +
+                "registry key doesn't exist (if it is, build system " +
+                "configuration bug?)");
     }
 
     logTestInfo("this test can only run on the buildbot build system at this " +
                 "time");
     return false;
   }
 
   // Check to make sure the service is installed
   let helperBin = getTestDirFile(FILE_HELPER_BIN);
   let args = ["wait-for-service-stop", "MozillaMaintenance", "10"];
   let process = Cc["@mozilla.org/process/util;1"].
                 createInstance(Ci.nsIProcess);
   process.init(helperBin);
-  debugDump("checking if the service exists on this machine.");
   process.run(true, args, args.length);
   Assert.notEqual(process.exitValue, 0xEE, "the maintenance service should " +
                   "be installed (if not, build system configuration bug?)");
 
   // If this is the first test in the series, then there is no reason the
   // service should be anything but stopped, so be strict here and fail the
   // test.
   if (aFirstTest) {
-    Assert.equal(process.exitValue, 0, "service should not be running for " +
-                 "the first test");
+    Assert.equal(process.exitValue, 0,
+                 "the service should not be running for the first test");
   }
 
   if (IS_AUTHENTICODE_CHECK_ENABLED) {
     // The test registry key exists and IS_AUTHENTICODE_CHECK_ENABLED is true
     // so the binaries should be signed. To run the test locally
     // DISABLE_UPDATER_AUTHENTICODE_CHECK can be defined.
-    Assert.ok(isBinSigned, "the updater.exe binary should be signed (if not, " +
-              "build system configuration bug?)");
+    Assert.ok(isBinSigned,
+              "the updater.exe binary should be signed (if not, build system " +
+              "configuration bug?)");
   }
 
   // In case the machine is running an old maintenance service or if it
   // is not installed, and permissions exist to install it. Then install
   // the newer bin that we have since all of the other checks passed.
   return attemptServiceInstall();
 }
 
@@ -1763,20 +1818,20 @@ function setupAppFiles() {
     copyFileToTestAppDir(aAppFile.relPath, aAppFile.inGreDir);
   });
 
   // Copy the xpcshell updater binary
   let updater = getTestDirFile("updater.app", true);
   if (!updater.exists()) {
     updater = getTestDirFile(FILE_UPDATER_BIN);
     if (!updater.exists()) {
-      do_throw("Unable to find updater binary!");
+      do_throw("Unable to find the updater binary!");
     }
   }
-  let testBinDir = getGREBinDir()
+  let testBinDir = getGREBinDir();
   updater.copyToFollowingLinks(testBinDir, updater.leafName);
 
   debugDump("finish - copying or creating symlinks to application files " +
             "for the test");
 }
 
 /**
  * Copies the specified files from the dist/bin directory into the test's
@@ -1817,17 +1872,17 @@ function copyFileToTestAppDir(aFileRelPa
       if (pathParts[i]) {
         srcFile.append(pathParts[i] + (pathParts.length - 1 == i ? ".app" : ""));
         destFile.append(pathParts[i] + (pathParts.length - 1 == i ? ".app" : ""));
       }
     }
     fileRelPath = fileRelPath + ".app";
   }
 
-  Assert.ok(srcFile.exists(), srcFile.path + " should exist");
+  Assert.ok(srcFile.exists(), MSG_SHOULD_EXIST);
 
   // Symlink libraries. Note that the XUL library on Mac OS X doesn't have a
   // file extension and shouldSymlink will always be false on Windows.
   let shouldSymlink = (pathParts[pathParts.length - 1] == "XUL" ||
                        fileRelPath.substr(fileRelPath.length - 3) == ".so" ||
                        fileRelPath.substr(fileRelPath.length - 6) == ".dylib");
   if (!shouldSymlink) {
     if (!destFile.exists()) {
@@ -1853,18 +1908,18 @@ function copyFileToTestAppDir(aFileRelPa
         destFile.remove(false);
       }
       let ln = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
       ln.initWithPath("/bin/ln");
       let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
       process.init(ln);
       let args = ["-s", srcFile.path, destFile.path];
       process.run(true, args, args.length);
-      debugDump("verifying symlink. Path: " + destFile.path);
-      do_check_true(destFile.isSymlink());
+      Assert.ok(destFile.isSymlink(),
+                "the file should be a symlink");
     } catch (e) {
       do_throw("Unable to create symlink for file! Path: " + srcFile.path +
                ", Exception: " + e);
     }
   }
 }
 
 /**
@@ -1886,24 +1941,23 @@ function attemptServiceInstall() {
   if (!maintSvcDir || !maintSvcDir.exists()) {
     maintSvcDir = getSpecialFolderDir(CSIDL_PROGRAM_FILES);
     if (maintSvcDir) {
       maintSvcDir.append("Mozilla Maintenance Service");
       debugDump("using CSIDL_PROGRAM_FILES - maintenance service install " +
                 "directory path: " + maintSvcDir.path);
     }
   }
-  Assert.ok(!!maintSvcDir, "maintenance service install directory should " +
-            "exist");
-  Assert.ok(maintSvcDir.exists(), "maintenance service install directory " +
-            "should exist");
+  if (!maintSvcDir) {
+    do_throw("Unable to find the maintenance service install directory");
+  }
+  Assert.ok(maintSvcDir.exists(), MSG_SHOULD_EXIST);
   let oldMaintSvcBin = maintSvcDir.clone();
   oldMaintSvcBin.append(FILE_MAINTENANCE_SERVICE_BIN);
-  Assert.ok(oldMaintSvcBin.exists(), "maintenance service install directory " +
-            "binary should exist. Path: " + oldMaintSvcBin.path);
+  Assert.ok(oldMaintSvcBin.exists(), MSG_SHOULD_EXIST);
   let buildMaintSvcBin = getGREBinDir();
   buildMaintSvcBin.append(FILE_MAINTENANCE_SERVICE_BIN);
   if (readFileBytes(oldMaintSvcBin) == readFileBytes(buildMaintSvcBin)) {
     debugDump("installed maintenance service binary is the same as the " +
               "build's maintenance service binary");
     return true;
   }
   let backupMaintSvcBin = maintSvcDir.clone();
@@ -1921,17 +1975,17 @@ function attemptServiceInstall() {
       oldMaintSvcBin = maintSvcDir.clone();
       oldMaintSvcBin.append(FILE_MAINTENANCE_SERVICE_BIN);
       if (!oldMaintSvcBin.exists()) {
         backupMaintSvcBin.moveTo(maintSvcDir, FILE_MAINTENANCE_SERVICE_BIN);
       }
     }
     Assert.ok(false, "should be able copy the test maintenance service to " +
               "the maintenance service directory (if not, build system " +
-              "configuration bug?). Path: " + maintSvcDir.path);
+              "configuration bug?), path: " + maintSvcDir.path);
   }
 
   return true;
 }
 
 /**
  * Helper function for updater tests for launching the updater using the
  * maintenance service to apply a mar file.
@@ -1942,19 +1996,22 @@ function attemptServiceInstall() {
  *        The expected value of update.status when the test finishes.
  * @param aCheckSvcLog (optional)
  *        Whether the service log should be checked.
  */
 function runUpdateUsingService(aInitialStatus, aExpectedStatus, aCheckSvcLog) {
   // Check the service logs for a successful update
   function checkServiceLogs(aOriginalContents) {
     let contents = readServiceLogFile();
-    debugDump("the contents of maintenanceservice.log:\n" + contents + "\n");
-    do_check_neq(contents, aOriginalContents);
-    do_check_neq(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1);
+    Assert.notEqual(contents, aOriginalContents,
+                    "the contents of the maintenanceservice.log should not " +
+                    "be the same as the original contents");
+    Assert.notEqual(contents.indexOf(LOG_SVC_SUCCESSFUL_LAUNCH), -1,
+                    "the contents of the maintenanceservice.log should " +
+                    "contain the successful launch string");
   }
   function readServiceLogFile() {
     let file = Cc["@mozilla.org/file/directory_service;1"].
                getService(Ci.nsIProperties).
                get("CmAppData", Ci.nsIFile);
     file.append("Mozilla");
     file.append("logs");
     file.append("maintenanceservice.log");
@@ -1977,27 +2034,27 @@ function runUpdateUsingService(aInitialS
     let helperBinArgs = ["wait-for-service-stop",
                          "MozillaMaintenance",
                          "120"];
     let helperBinProcess = Cc["@mozilla.org/process/util;1"].
                            createInstance(Ci.nsIProcess);
     helperBinProcess.init(helperBin);
     debugDump("stopping service...");
     helperBinProcess.run(true, helperBinArgs, helperBinArgs.length);
-    Assert.notEqual(helperBinProcess.exitValue, 0xEE, "the maintenance " +
-                    "service should exist");
+    Assert.notEqual(helperBinProcess.exitValue, 0xEE,
+                    "the maintenance service should exist");
 
     if (helperBinProcess.exitValue != 0) {
       if (aFailTest) {
-        Assert.ok(false, "maintenance service should stop! Process " +
-                  "exitValue: " + helperBinProcess.exitValue);
+        Assert.ok(false, "the maintenance service should stop, process exit " +
+                  "value: " + helperBinProcess.exitValue);
       }
 
       logTestInfo("maintenance service did not stop which may cause test " +
-                  "failures later. Process exitValue: " +
+                  "failures later, process exit value: " +
                   helperBinProcess.exitValue);
     } else {
       debugDump("service stopped");
     }
     waitServiceApps();
   }
   function waitForApplicationStop(aApplication) {
     debugDump("waiting for " + aApplication + " to stop if necessary");
@@ -2006,18 +2063,19 @@ function runUpdateUsingService(aInitialS
     let helperBin = getTestDirFile(FILE_HELPER_BIN);
     let helperBinArgs = ["wait-for-application-exit",
                          aApplication,
                          "120"];
     let helperBinProcess = Cc["@mozilla.org/process/util;1"].
                            createInstance(Ci.nsIProcess);
     helperBinProcess.init(helperBin);
     helperBinProcess.run(true, helperBinArgs, helperBinArgs.length);
-    Assert.equal(helperBinProcess.exitValue, 0, "the process for " +
-                 aApplication + " should stop");
+    Assert.equal(helperBinProcess.exitValue, 0,
+                 "the process should have stopped, process name: " +
+                 aApplication);
   }
 
   // Make sure the service from the previous test is already stopped.
   waitForServiceStop(true);
 
   // Prevent the cleanup function from begin run more than once
   if (gRegisteredServiceCleanup === undefined) {
     gRegisteredServiceCleanup = true;
@@ -2042,17 +2100,18 @@ function runUpdateUsingService(aInitialS
 
   let appArgsLogPath = getAppArgsLogPath();
   gServiceLaunchedCallbackLog = appArgsLogPath.replace(/^"|"$/g, "");
 
   let updatesDir = getUpdatesPatchDir();
   writeStatusFile(aInitialStatus);
 
   // sanity check
-  do_check_eq(readStatusState(), aInitialStatus);
+  Assert.equal(readStatusState(), aInitialStatus,
+               "the update status state" + MSG_SHOULD_EQUAL);
 
   writeVersionFile(DEFAULT_UPDATE_VERSION);
 
   gServiceLaunchedCallbackArgs = [
     "-no-remote",
     "-process-updates",
     "-dump-args",
     appArgsLogPath
@@ -2062,19 +2121,19 @@ function runUpdateUsingService(aInitialS
     // We want to set the env vars again
     gShouldResetEnv = undefined;
   }
 
   setEnvironment();
 
   let updater = getTestDirFile(FILE_UPDATER_BIN);
   if (!updater.exists()) {
-    do_throw("Unable to find updater binary!");
+    do_throw("Unable to find the updater binary!");
   }
-  let testBinDir = getGREBinDir()
+  let testBinDir = getGREBinDir();
   updater.copyToFollowingLinks(testBinDir, updater.leafName);
   updater.copyToFollowingLinks(updatesDir, updater.leafName);
 
   // The service will execute maintenanceservice_installer.exe and
   // will copy maintenanceservice.exe out of the same directory from
   // the installation directory.  So we need to make sure both of those
   // bins always exist in the installation directory.
   copyFileToTestAppDir(FILE_MAINTENANCE_SERVICE_BIN, false);
@@ -2124,18 +2183,18 @@ function runUpdateUsingService(aInitialS
       // xpcshell tests won't display the entire contents so log each line.
       let contents = readFileBytes(updateLog).replace(/\r\n/g, "\n");
       let aryLogContents = contents.split("\n");
       logTestInfo("contents of " + updateLog.path + ":");
       aryLogContents.forEach(function RUUS_TC_LC_FE(aLine) {
         logTestInfo(aLine);
       });
     }
-    debugDump("testing update status against expected status");
-    do_check_eq(status, aExpectedStatus);
+    Assert.equal(status, aExpectedStatus,
+                 "the update status" + MSG_SHOULD_EQUAL);
 
     if (aCheckSvcLog) {
       checkServiceLogs(svcOriginalLog);
     }
 
     checkUpdateFinished();
   }
 
@@ -2157,17 +2216,17 @@ function getLaunchBin() {
     launchBin = Services.dirsvc.get("WinD", Ci.nsIFile);
     launchBin.append("System32");
     launchBin.append("cmd.exe");
   } else {
     launchBin = Cc["@mozilla.org/file/local;1"].
                 createInstance(Ci.nsILocalFile);
     launchBin.initWithPath("/bin/sh");
   }
-  Assert.ok(launchBin.exists(), launchBin.path + " should exist");
+  Assert.ok(launchBin.exists(), MSG_SHOULD_EXIST);
 
   return launchBin;
 }
 
 /**
  * Helper function that waits until the helper has completed its operations and
  * is in a sleep state before performing an update by calling doUpdate.
  */
@@ -2284,18 +2343,18 @@ function setupUpdaterTest(aMarFile) {
         testFile.copyToFollowingLinks(testDir, aTestFile.fileName);
         testFile = getApplyDirFile(aTestFile.relPathDir + aTestFile.fileName);
       } else {
         testFile = getApplyDirFile(aTestFile.relPathDir + aTestFile.fileName,
                                    true);
         writeFile(testFile, aTestFile.originalContents);
       }
 
-      // Skip these tests on Windows and OS/2 since their
-      // implementaions of chmod doesn't really set permissions.
+      // Skip these tests on Windows since chmod doesn't really set permissions
+      // on Windows.
       if (!IS_WIN && aTestFile.originalPerms) {
         testFile.permissions = aTestFile.originalPerms;
         // Store the actual permissions on the file for reference later after
         // setting the permissions.
         if (!aTestFile.comparePerms) {
           aTestFile.comparePerms = testFile.permissions;
         }
       }
@@ -2485,56 +2544,53 @@ function checkUpdateLogContents(aCompare
   // Remove leading and trailing newlines
   compareLogContents = compareLogContents.replace(/\n+/g, "\n");
   // Remove leading and trailing newlines
   compareLogContents = compareLogContents.replace(/^\n|\n$/g, "");
 
   // Don't write the contents of the file to the log to reduce log spam
   // unless there is a failure.
   if (compareLogContents == updateLogContents) {
-    debugDump("log contents are correct");
-    do_check_true(true);
+    Assert.ok(true, "the update log contents" + MSG_SHOULD_EQUAL);
   } else {
-    logTestInfo("log contents are not correct");
+    logTestInfo("the update log contents are not correct");
     let aryLog = updateLogContents.split("\n");
     let aryCompare = compareLogContents.split("\n");
     // Pushing an empty string to both arrays makes it so either array's length
     // can be used in the for loop below without going out of bounds.
     aryLog.push("");
     aryCompare.push("");
     // xpcshell tests won't display the entire contents so log the incorrect
     // line.
     for (let i = 0; i < aryLog.length; ++i) {
-      if (aryCompare[i] != aryLog[i]) {
-        logTestInfo("the first incorrect line in the log is: " + aryLog[i]);
-        do_check_eq(aryCompare[i], aryLog[i]);
+      if (aryLog[i] != aryCompare[i]) {
+        logTestInfo("the first incorrect line in the update log is: " +
+                    aryLog[i]);
+        Assert.equal(aryLog[i], aryCompare[i],
+                     "the update log contents" + MSG_SHOULD_EQUAL);
       }
     }
     // This should never happen!
-    do_throw("Unable to find incorrect log contents!");
+    do_throw("Unable to find incorrect update log contents!");
   }
 }
 
 /**
  * Helper function to check if the update log contains a string.
  *
  * @param   aCheckString
  *          The string to check if the update log contains.
  */
 function checkUpdateLogContains(aCheckString) {
   let updateLog = getUpdatesPatchDir();
   updateLog.append(FILE_UPDATE_LOG);
   let updateLogContents = readFileBytes(updateLog);
-  if (updateLogContents.indexOf(aCheckString) != -1) {
-    debugDump("log file does contain: " + aCheckString);
-    do_check_true(true);
-  } else {
-    logTestInfo("log file does not contain: " + aCheckString);
-    do_check_true(false);
-  }
+  Assert.notEqual(updateLogContents.indexOf(aCheckString), -1,
+                  "the update log contents" + MSG_SHOULD_EQUAL + ", value: " +
+                  aCheckString);
 }
 
 /**
  * Helper function for updater binary tests for verifying the state of files and
  * directories after a successful update.
  *
  * @param  aGetFileFunc
  *         The function used to get the files in the directory to be checked.
@@ -2549,84 +2605,74 @@ function checkUpdateLogContains(aCheckSt
  */
 function checkFilesAfterUpdateSuccess(aGetFileFunc, aStageDirExists,
                                       aToBeDeletedDirExists) {
   debugDump("testing contents of files after a successful update");
   gTestFiles.forEach(function CFAUS_TF_FE(aTestFile) {
     let testFile = aGetFileFunc(aTestFile.relPathDir + aTestFile.fileName, true);
     debugDump("testing file: " + testFile.path);
     if (aTestFile.compareFile || aTestFile.compareContents) {
-      do_check_true(testFile.exists());
-
-      // Skip these tests on Windows and OS/2 since their
-      // implementaions of chmod doesn't really set permissions.
+      Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
+
+      // Skip these tests on Windows since chmod doesn't really set permissions
+      // on Windows.
       if (!IS_WIN && aTestFile.comparePerms) {
         // Check if the permssions as set in the complete mar file are correct.
-        let logPerms = "testing file permissions - ";
-        if (aTestFile.originalPerms) {
-          logPerms += "original permissions: " +
-                      aTestFile.originalPerms.toString(8) + ", ";
-        }
-        debugDump("compare permissions : " +
-                  aTestFile.comparePerms.toString(8) + ", " +
-                  "updated permissions : " + testFile.permissions.toString(8));
-        do_check_eq(testFile.permissions & 0xfff, aTestFile.comparePerms & 0xfff);
+        Assert.equal(testFile.permissions & 0xfff,
+                     aTestFile.comparePerms & 0xfff,
+                     "the file permissions" + MSG_SHOULD_EQUAL);
       }
 
       let fileContents1 = readFileBytes(testFile);
       let fileContents2 = aTestFile.compareFile ?
                           readFileBytes(getTestDirFile(aTestFile.compareFile)) :
                           aTestFile.compareContents;
       // Don't write the contents of the file to the log to reduce log spam
       // unless there is a failure.
       if (fileContents1 == fileContents2) {
-        debugDump("file contents are correct");
-        do_check_true(true);
+        Assert.ok(true, "the file contents" + MSG_SHOULD_EQUAL);
       } else {
-        logTestInfo("file contents are not correct");
-        do_check_eq(fileContents1, fileContents2);
+        Assert.equal(fileContents1, fileContents2,
+                     "the file contents" + MSG_SHOULD_EQUAL);
       }
     } else {
-      do_check_false(testFile.exists());
+      Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
     }
   });
 
   debugDump("testing operations specified in removed-files were performed " +
             "after a successful update");
   gTestDirs.forEach(function CFAUS_TD_FE(aTestDir) {
     let testDir = aGetFileFunc(aTestDir.relPathDir, true);
     debugDump("testing directory: " + testDir.path);
     if (aTestDir.dirRemoved) {
-      do_check_false(testDir.exists());
+      Assert.ok(!testDir.exists(), MSG_SHOULD_NOT_EXIST);
     } else {
-      do_check_true(testDir.exists());
+      Assert.ok(testDir.exists(), MSG_SHOULD_EXIST);
 
       if (aTestDir.files) {
         aTestDir.files.forEach(function CFAUS_TD_F_FE(aTestFile) {
           let testFile = aGetFileFunc(aTestDir.relPathDir + aTestFile, true);
-          debugDump("testing directory file: " + testFile.path);
           if (aTestDir.filesRemoved) {
-            do_check_false(testFile.exists());
+            Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
           } else {
-            do_check_true(testFile.exists());
+            Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
           }
         });
       }
 
       if (aTestDir.subDirs) {
         aTestDir.subDirs.forEach(function CFAUS_TD_SD_FE(aSubDir) {
           let testSubDir = aGetFileFunc(aTestDir.relPathDir + aSubDir, true);
-          debugDump("testing sub-directory: " + testSubDir.path);
-          do_check_true(testSubDir.exists());
+          Assert.ok(testSubDir.exists(), MSG_SHOULD_EXIST);
           if (aTestDir.subDirFiles) {
             aTestDir.subDirFiles.forEach(function CFAUS_TD_SDF_FE(aTestFile) {
               let testFile = aGetFileFunc(aTestDir.relPathDir +
                                           aSubDir + aTestFile, true);
-              debugDump("testing sub-directory file: " + testFile.path);
-              do_check_true(testFile.exists());
+              Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
             });
           }
         });
       }
     }
   });
 
   checkFilesAfterUpdateCommon(aGetFileFunc, aStageDirExists,
@@ -2650,77 +2696,66 @@ function checkFilesAfterUpdateSuccess(aG
  */
 function checkFilesAfterUpdateFailure(aGetFileFunc, aStageDirExists,
                                       aToBeDeletedDirExists) {
   debugDump("testing contents of files after a failed update");
   gTestFiles.forEach(function CFAUF_TF_FE(aTestFile) {
     let testFile = aGetFileFunc(aTestFile.relPathDir + aTestFile.fileName, true);
     debugDump("testing file: " + testFile.path);
     if (aTestFile.compareFile || aTestFile.compareContents) {
-      do_check_true(testFile.exists());
-
-      // Skip these tests on Windows and OS/2 since their
-      // implementaions of chmod doesn't really set permissions.
+      Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
+
+      // Skip these tests on Windows since chmod doesn't really set permissions
+      // on Windows.
       if (!IS_WIN && aTestFile.comparePerms) {
         // Check the original permssions are retained on the file.
-        let logPerms = "testing file permissions - ";
-        if (aTestFile.originalPerms) {
-          logPerms += "original permissions: " +
-                      aTestFile.originalPerms.toString(8) + ", ";
-        }
-        debugDump("compare permissions : " +
-                  aTestFile.comparePerms.toString(8) + ", " +
-                  "updated permissions : " + testFile.permissions.toString(8));
-        do_check_eq(testFile.permissions & 0xfff, aTestFile.comparePerms & 0xfff);
+        Assert.equal(testFile.permissions & 0xfff,
+                     aTestFile.comparePerms & 0xfff,
+                     "the file permissions" + MSG_SHOULD_EQUAL);
       }
 
       let fileContents1 = readFileBytes(testFile);
       let fileContents2 = aTestFile.compareFile ?
                           readFileBytes(getTestDirFile(aTestFile.compareFile)) :
                           aTestFile.compareContents;
       // Don't write the contents of the file to the log to reduce log spam
       // unless there is a failure.
       if (fileContents1 == fileContents2) {
-        debugDump("file contents are correct");
-        do_check_true(true);
+        Assert.ok(true, "the file contents" + MSG_SHOULD_EQUAL);
       } else {
-        logTestInfo("file contents are not correct");
-        do_check_eq(fileContents1, fileContents2);
+        Assert.equal(fileContents1, fileContents2,
+                     "the file contents" + MSG_SHOULD_EQUAL);
       }
     } else {
-      do_check_false(testFile.exists());
+      Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
     }
   });
 
   debugDump("testing operations specified in removed-files were not " +
             "performed after a failed update");
   gTestDirs.forEach(function CFAUF_TD_FE(aTestDir) {
     let testDir = aGetFileFunc(aTestDir.relPathDir, true);
-    debugDump("testing directory: " + testDir.path);
-    do_check_true(testDir.exists());
+    Assert.ok(testDir.exists(), MSG_SHOULD_EXIST);
 
     if (aTestDir.files) {
       aTestDir.files.forEach(function CFAUS_TD_F_FE(aTestFile) {
         let testFile = aGetFileFunc(aTestDir.relPathDir + aTestFile, true);
-        debugDump("testing directory file: " + testFile.path);
-        do_check_true(testFile.exists());
+        Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
       });
     }
 
     if (aTestDir.subDirs) {
       aTestDir.subDirs.forEach(function CFAUS_TD_SD_FE(aSubDir) {
         let testSubDir = aGetFileFunc(aTestDir.relPathDir + aSubDir, true);
-        debugDump("testing sub-directory: " + testSubDir.path);
-        do_check_true(testSubDir.exists());
+        Assert.ok(testSubDir.exists(), MSG_SHOULD_EXIST);
         if (aTestDir.subDirFiles) {
           aTestDir.subDirFiles.forEach(function CFAUS_TD_SDF_FE(aTestFile) {
             let testFile = aGetFileFunc(aTestDir.relPathDir +
                                         aSubDir + aTestFile, true);
-            debugDump("testing sub-directory file: " + testFile.path);
-            do_check_true(testFile.exists());
+            Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
           });
         }
       });
     }
   });
 
   checkFilesAfterUpdateCommon(aGetFileFunc, aStageDirExists,
                               aToBeDeletedDirExists);
@@ -2739,41 +2774,38 @@ function checkFilesAfterUpdateFailure(aG
  *         On Windows, if true the tobedeleted directory will be tested for
  *         existence and if false the tobedeleted directory will be tested for
  *         non-existence. On all othere platforms it will be tested for
  *         non-existence.
  */
 function checkFilesAfterUpdateCommon(aGetFileFunc, aStageDirExists,
                                      aToBeDeletedDirExists) {
   debugDump("testing extra directories");
-
   let stageDir = getStageDirFile(null, true);
-  debugDump("testing directory should " +
-            (aStageDirExists ? "" : "not ") +
-            "exist: " + stageDir.path);
-  do_check_eq(stageDir.exists(), aStageDirExists);
+  if (aStageDirExists) {
+    Assert.ok(stageDir.exists(), MSG_SHOULD_EXIST);
+  } else {
+    Assert.ok(!stageDir.exists(), MSG_SHOULD_NOT_EXIST);
+  }
 
   let toBeDeletedDirExists = IS_WIN ? aToBeDeletedDirExists : false;
   let toBeDeletedDir = getApplyDirFile(DIR_TOBEDELETED, true);
-  debugDump("testing directory should " +
-            (toBeDeletedDirExists ? "" : "not ") +
-            "exist: " + toBeDeletedDir.path);
-  do_check_eq(toBeDeletedDir.exists(), toBeDeletedDirExists);
-
-  debugDump("testing updating directory doesn't exist in the application " +
-            "directory");
+  if (toBeDeletedDirExists) {
+    Assert.ok(toBeDeletedDir.exists(), MSG_SHOULD_EXIST);
+  } else {
+    Assert.ok(!toBeDeletedDir.exists(), MSG_SHOULD_NOT_EXIST);
+  }
+
   let updatingDir = getApplyDirFile("updating", true);
-  do_check_false(updatingDir.exists());
+  Assert.ok(!updatingDir.exists(), MSG_SHOULD_NOT_EXIST);
 
   if (stageDir.exists()) {
-    debugDump("testing updating directory doesn't exist in the staging " +
-              "directory");
     updatingDir = stageDir.clone();
     updatingDir.append("updating");
-    do_check_false(updatingDir.exists());
+    Assert.ok(!updatingDir.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   debugDump("testing backup files should not be left behind in the " +
             "application directory");
   let applyToDir = getApplyDirFile(null, true);
   checkFilesInDirRecursive(applyToDir, checkForBackupFiles);
 
   if (stageDir.exists()) {
@@ -2783,17 +2815,18 @@ function checkFilesAfterUpdateCommon(aGe
     checkFilesInDirRecursive(stageDir, checkForBackupFiles);
   }
 
   debugDump("testing patch files should not be left behind");
   let updatesDir = getUpdatesPatchDir();
   let entries = updatesDir.QueryInterface(Ci.nsIFile).directoryEntries;
   while (entries.hasMoreElements()) {
     let entry = entries.getNext().QueryInterface(Ci.nsIFile);
-    do_check_neq(getFileExtension(entry), "patch");
+    Assert.notEqual(getFileExtension(entry), "patch",
+                    "the file's extension should not equal patch");
   }
 }
 
 /**
  * Helper function for updater binary tests for verifying the contents of the
  * updater callback application log which should contain the arguments passed to
  * the callback application.
  */
@@ -2804,29 +2837,45 @@ function checkCallbackAppLog() {
     return;
   }
 
   let expectedLogContents = gCallbackArgs.join("\n") + "\n";
   let logContents = readFile(appLaunchLog);
   // 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.
+  // fail by timing out after gTimeoutRuns is greater than MAX_TIMEOUT_RUNS or
+  // the test harness times out the test.
   if (logContents != expectedLogContents) {
+    gTimeoutRuns++;
+    if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
+      logTestInfo("callback log contents are not correct");
+      let aryLog = logContents.split("\n");
+      let aryCompare = expectedLogContents.split("\n");
+      // Pushing an empty string to both arrays makes it so either array's length
+      // can be used in the for loop below without going out of bounds.
+      aryLog.push("");
+      aryCompare.push("");
+      // xpcshell tests won't display the entire contents so log the incorrect
+      // line.
+      for (let i = 0; i < aryLog.length; ++i) {
+        if (aryLog[i] != aryCompare[i]) {
+          logTestInfo("the first incorrect line in the callback log is: " +
+                      aryLog[i]);
+          Assert.equal(aryLog[i], aryCompare[i],
+                       "the callback log contents" + MSG_SHOULD_EQUAL);
+        }
+      }
+      // This should never happen!
+      do_throw("Unable to find incorrect callback log contents!");
+    }
     do_timeout(TEST_HELPER_TIMEOUT, checkCallbackAppLog);
     return;
   }
-
-  if (logContents == expectedLogContents) {
-    debugDump("callback log file contents are correct");
-    do_check_true(true);
-  } else {
-    debugDump("callback log file contents are not correct");
-    do_check_eq(logContents, expectedLogContents);
-  }
+  Assert.ok(true, "the callback log contents" + MSG_SHOULD_EQUAL);
 
   waitForFilesInUse();
 }
 
 /**
  * Helper function for updater binary tests for getting the log and running
  * files created by the test helper binary file when called with the post-update
  * command line argument.
@@ -2855,58 +2904,77 @@ function checkPostUpdateAppLog() {
     do_timeout(TEST_HELPER_TIMEOUT, checkPostUpdateAppLog);
     return;
   }
 
   let logContents = readFile(postUpdateLog);
   // 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.
+  // fail by timing out after gTimeoutRuns is greater than MAX_TIMEOUT_RUNS or
+  // the test harness times out the test.
   if (logContents != "post-update\n") {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the post update " +
                "process to create the expected contents in the post update log. Path: " +
                postUpdateLog.path);
     }
     do_timeout(TEST_HELPER_TIMEOUT, checkPostUpdateAppLog);
     return;
   }
-
-  debugDump("post update app log file contents are correct");
-  do_check_true(true);
+  Assert.ok(true, "the post update log contents" + MSG_SHOULD_EQUAL);
 
   gCheckFunc();
 }
 
 /**
  * Helper function for updater service tests for verifying the contents of the
  * updater callback application log which should contain the arguments passed to
  * the callback application.
  */
 function checkCallbackServiceLog() {
-  do_check_neq(gServiceLaunchedCallbackLog, null);
+  Assert.ok(!!gServiceLaunchedCallbackLog,
+            "gServiceLaunchedCallbackLog should be defined");
 
   let expectedLogContents = gServiceLaunchedCallbackArgs.join("\n") + "\n";
   let logFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
   logFile.initWithPath(gServiceLaunchedCallbackLog);
   let logContents = readFile(logFile);
   // 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.
+  // fail by timing out after gTimeoutRuns is greater than MAX_TIMEOUT_RUNS or
+  // the test harness times out the test.
   if (logContents != expectedLogContents) {
-    debugDump("callback service log not expected value, waiting longer");
+    gTimeoutRuns++;
+    if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
+      logTestInfo("callback service log contents are not correct");
+      let aryLog = logContents.split("\n");
+      let aryCompare = expectedLogContents.split("\n");
+      // Pushing an empty string to both arrays makes it so either array's length
+      // can be used in the for loop below without going out of bounds.
+      aryLog.push("");
+      aryCompare.push("");
+      // xpcshell tests won't display the entire contents so log the incorrect
+      // line.
+      for (let i = 0; i < aryLog.length; ++i) {
+        if (aryLog[i] != aryCompare[i]) {
+          logTestInfo("the first incorrect line in the service callback log " +
+                      "is: " + aryLog[i]);
+          Assert.equal(aryLog[i], aryCompare[i],
+                       "the service callback log contents" + MSG_SHOULD_EQUAL);
+        }
+      }
+      // This should never happen!
+      do_throw("Unable to find incorrect service callback log contents!");
+    }
     do_timeout(TEST_HELPER_TIMEOUT, checkCallbackServiceLog);
     return;
   }
-
-  debugDump("testing that the callback application successfully launched " +
-            "and the expected command line arguments were passed to it");
-  do_check_eq(logContents, expectedLogContents);
+  Assert.ok(true, "the callback service log contents" + MSG_SHOULD_EQUAL);
 
   waitForFilesInUse();
 }
 
 // Waits until files that are in use that break tests are no longer in use and
 // then calls do_test_finished.
 function waitForFilesInUse() {
   if (IS_WIN) {
@@ -2956,17 +3024,18 @@ function waitForFilesInUse() {
 /**
  * Helper function for updater binary tests for verifying there are no update
  * backup files left behind after an update.
  *
  * @param   aFile
  *          An nsIFile to check if it has moz-backup for its extension.
  */
 function checkForBackupFiles(aFile) {
-  do_check_neq(getFileExtension(aFile), "moz-backup");
+  Assert.notEqual(getFileExtension(aFile), "moz-backup",
+                  "the file's extension should not equal moz-backup");
 }
 
 /**
  * Helper function for updater binary tests for recursively enumerating a
  * directory and calling a callback function with the file as a parameter for
  * each file found.
  *
  * @param   aDir
@@ -3190,17 +3259,17 @@ function start_httpserver() {
 
 /**
  * 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) {
-  do_check_true(!!aCallback);
+  Assert.ok(!!aCallback, "the aCallback parameter should be defined");
   gTestserver.stop(aCallback);
 }
 
 /**
  * Creates an nsIXULAppInfo
  *
  * @param   aID
  *          The ID of the test application
@@ -3459,36 +3528,37 @@ function launchAppToApplyUpdate() {
 const gProcessObserver = {
   observe: function PO_observe(aSubject, aTopic, aData) {
     debugDump("topic: " + aTopic + ", process exitValue: " +
               gProcess.exitValue);
     if (gAppTimer) {
       gAppTimer.cancel();
       gAppTimer = null;
     }
-    Assert.equal(gProcess.exitValue, 0, "the exitValue for the application " +
-                 "process should be '0'");
-    Assert.equal(aTopic, "process-finished", "the application process " +
-                 "observer topic should be 'process-finished'");
+    Assert.equal(gProcess.exitValue, 0,
+                 "the application process exit value should be 0");
+    Assert.equal(aTopic, "process-finished",
+                 "the application process observer topic should be " +
+                 "process-finished");
     do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
   },
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver])
 };
 
 /**
  * The timer callback to kill the process if it takes too long.
  */
 const gTimerCallback = {
   notify: function TC_notify(aTimer) {
     gAppTimer = null;
     if (gProcess.isRunning) {
-      logTestInfo("attempt to kill process");
+      logTestInfo("attempting to kill process");
       gProcess.kill();
     }
-    Assert.ok(false, "Launch application timer expired")
+    Assert.ok(false, "launch application timer expired");
   },
   QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback])
 };
 
 /**
  * The update-staged observer for the call to nsIUpdateProcessor:processUpdate.
  */
 const gUpdateStagedObserver = {
--- a/toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js
@@ -6,61 +6,55 @@
 function run_test() {
   setupTestCommon();
 
   // Verify write access to the custom app dir
   debugDump("testing write access to the application directory");
   let testFile = getCurrentProcessDir();
   testFile.append("update_write_access_test");
   testFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE);
-  do_check_true(testFile.exists());
+  Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
   testFile.remove(false);
-  do_check_false(testFile.exists());
+  Assert.ok(!testFile.exists(), MSG_SHOULD_NOT_EXIST);
 
   standardInit();
 
   if (IS_WIN) {
     // Create a mutex to prevent being able to check for or apply updates.
     debugDump("attempting to create mutex");
     let handle = createMutex(getPerInstallationMutexName());
-
-    debugDump("testing that the mutex was successfully created");
-    do_check_true(!!handle);
+    Assert.ok(!!handle, "the update mutex should have been created");
 
     // Check if available updates cannot be checked for when there is a mutex
     // for this installation.
-    debugDump("testing nsIApplicationUpdateService:canCheckForUpdates is " +
-              "false when there is a mutex");
-    do_check_false(gAUS.canCheckForUpdates);
+    Assert.ok(!gAUS.canCheckForUpdates, "should not be able to check for " +
+              "updates when there is an update mutex");
 
     // Check if updates cannot be applied when there is a mutex for this
     // installation.
-    debugDump("testing nsIApplicationUpdateService:canApplyUpdates is " +
-                "false when there is a mutex");
-    do_check_false(gAUS.canApplyUpdates);
+    Assert.ok(!gAUS.canApplyUpdates, "should not be able to apply updates " +
+              "when there is an update mutex");
 
     debugDump("destroying mutex");
-    closeHandle(handle)
+    closeHandle(handle);
   }
 
   // Check if available updates can be checked for
-  debugDump("testing nsIApplicationUpdateService:canCheckForUpdates is true");
-  do_check_true(gAUS.canCheckForUpdates);
+  Assert.ok(gAUS.canCheckForUpdates, "should be able to check for updates");
   // Check if updates can be applied
-  debugDump("testing nsIApplicationUpdateService:canApplyUpdates is true");
-  do_check_true(gAUS.canApplyUpdates);
+  Assert.ok(gAUS.canApplyUpdates, "should be able to apply updates");
 
   if (IS_WIN) {
     // Attempt to create a mutex when application update has already created one
     // with the same name.
     debugDump("attempting to create mutex");
     let handle = createMutex(getPerInstallationMutexName());
 
-    debugDump("testing that the mutex was not successfully created");
-    do_check_eq(handle, null);
+    Assert.ok(!handle, "should not be able to create the update mutex when " +
+              "the application has created the update mutex");
   }
 
   doTestFinish();
 }
 
 /**
  * Determines a unique mutex name for the installation.
  *
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js
@@ -23,21 +23,24 @@ function run_test() {
                                  "3.0", "3.0", null, null, null, null, null,
                                  getString("patchApplyFailure"));
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false);
 
   setUpdateChannel("original_channel");
 
   standardInit();
 
-  do_check_eq(gUpdateManager.updateCount, 1);
+  Assert.equal(gUpdateManager.updateCount, 1,
+               "the update manager update count" + MSG_SHOULD_EQUAL);
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.name, "Existing");
+  Assert.equal(update.name, "Existing",
+               "the update's name" + MSG_SHOULD_EQUAL);
 
-  do_check_eq(gUpdateManager.activeUpdate, null);
+  Assert.ok(!gUpdateManager.activeUpdate,
+            "there should not be an active update");
   // Verify that the active-update.xml file has had the update from the old
   // channel removed.
   let file = getUpdatesXMLFile(true);
-  debugDump("verifying contents of " + FILE_UPDATE_ACTIVE);
-  do_check_eq(readFile(file), getLocalUpdatesXMLString(""));
+  Assert.equal(readFile(file), getLocalUpdatesXMLString(""),
+               "the contents of active-update.xml" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js
@@ -19,16 +19,19 @@ function run_test() {
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
 
   standardInit();
 
   if (IS_TOOLKIT_GONK) {
     // Gonk doesn't resume downloads at boot time, so the update
     // will remain active until the user chooses a new one, at
     // which point, the old update will be removed.
-    do_check_neq(gUpdateManager.activeUpdate, null);
+    Assert.ok(!!gUpdateManager.activeUpdate,
+              "there should be an active update");
   } else {
-    do_check_eq(gUpdateManager.activeUpdate, null);
+    Assert.ok(!gUpdateManager.activeUpdate,
+              "there should not be an active update");
   }
-  do_check_eq(gUpdateManager.updateCount, 0);
+  Assert.equal(gUpdateManager.updateCount, 0,
+               "the update manager update count" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js
@@ -20,16 +20,19 @@ function run_test() {
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
 
   standardInit();
 
   if (IS_TOOLKIT_GONK) {
     // Gonk doesn't resume downloads at boot time, so the update
     // will remain active until the user chooses a new one, at
     // which point, the old update will be removed.
-    do_check_neq(gUpdateManager.activeUpdate, null);
+    Assert.ok(!!gUpdateManager.activeUpdate,
+              "there should be an active update");
   } else {
-    do_check_eq(gUpdateManager.activeUpdate, null);
+    Assert.ok(!gUpdateManager.activeUpdate,
+              "there should not be an active update");
   }
-  do_check_eq(gUpdateManager.updateCount, 0);
+  Assert.equal(gUpdateManager.updateCount, 0,
+               "the update manager update count" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js
@@ -14,24 +14,22 @@ function run_test() {
                                     STATE_DOWNLOADING);
   let updates = getLocalUpdateString(patches);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeStatusFile(STATE_NONE);
 
   standardInit();
 
   let dir = getUpdatesDir();
-  dir.append("0");
-  debugDump("testing " + dir.path + " should exist");
-  do_check_true(dir.exists());
+  dir.append(DIR_PATCH);
+  Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
 
   let statusFile = dir.clone();
   statusFile.append(FILE_UPDATE_STATUS);
-  debugDump("testing " + statusFile.path + " should not exist");
-  do_check_false(statusFile.exists());
+  Assert.ok(!statusFile.exists(), MSG_SHOULD_NOT_EXIST);
 
-  debugDump("testing activeUpdate == null");
-  do_check_eq(gUpdateManager.activeUpdate, null);
-  debugDump("testing updateCount == 0");
-  do_check_eq(gUpdateManager.updateCount, 0);
+  Assert.ok(!gUpdateManager.activeUpdate,
+            "there should not be an active update");
+  Assert.equal(gUpdateManager.updateCount, 0,
+               "the update manager update count" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js
@@ -15,25 +15,23 @@ function run_test() {
   let updates = getLocalUpdateString(patches);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile("99.9");
 
   standardInit();
 
   // Check that there is no activeUpdate first so the updates directory is
   // cleaned up by the UpdateManager before the remaining tests.
-  debugDump("testing activeUpdate == null");
-  do_check_eq(gUpdateManager.activeUpdate, null);
-  debugDump("testing updateCount == 0");
-  do_check_eq(gUpdateManager.updateCount, 0);
+  Assert.ok(!gUpdateManager.activeUpdate,
+            "there should not be an active update");
+  Assert.equal(gUpdateManager.updateCount, 0,
+               "the update manager update count" + MSG_SHOULD_EQUAL);
 
   let dir = getUpdatesDir();
-  dir.append("0");
-  debugDump("testing " + dir.path + " should exist");
-  do_check_true(dir.exists());
+  dir.append(DIR_PATCH);
+  Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
 
   let versionFile = dir.clone();
   versionFile.append(FILE_UPDATE_VERSION);
-  debugDump("testing " + versionFile.path + " should not exist");
-  do_check_false(versionFile.exists());
+  Assert.ok(!versionFile.exists(), MSG_SHOULD_NOT_EXIST);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js
@@ -12,36 +12,31 @@ function run_test() {
   let patches = getLocalPatchString(null, null, null, null, null, null,
                                     STATE_PENDING);
   let updates = getLocalUpdateString(patches);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeStatusFile(STATE_SUCCEEDED);
 
   let dir = getUpdatesDir();
   let log = dir.clone();
-  log.append("0");
+  log.append(DIR_PATCH);
   log.append(FILE_UPDATE_LOG);
   writeFile(log, "Last Update Log");
 
   standardInit();
 
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = dir.clone();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
-
-  debugDump("testing " + log.path + " contents");
-  do_check_eq(readFile(log), "Last Update Log");
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
+  Assert.equal(readFile(log), "Last Update Log",
+               "the last update log contents" + MSG_SHOULD_EQUAL);
 
   log = dir.clone();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
-  dir.append("0");
-  debugDump("testing " + dir.path + " should exist (bug 512994)");
-  do_check_true(dir.exists());
+  dir.append(DIR_PATCH);
+  Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js
@@ -20,39 +20,33 @@ function run_test() {
   log.append(FILE_LAST_LOG);
   writeFile(log, "Backup Update Log");
 
   log = dir.clone();
   log.append(FILE_BACKUP_LOG);
   writeFile(log, "To Be Deleted Backup Update Log");
 
   log = dir.clone();
-  log.append("0");
+  log.append(DIR_PATCH);
   log.append(FILE_UPDATE_LOG);
   writeFile(log, "Last Update Log");
 
   standardInit();
 
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = dir.clone();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
-
-  debugDump("testing " + log.path + " contents");
-  do_check_eq(readFile(log), "Last Update Log");
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
+  Assert.equal(readFile(log), "Last Update Log",
+               "the last update log contents" + MSG_SHOULD_EQUAL);
 
   log = dir.clone();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
+  Assert.equal(readFile(log), "Backup Update Log",
+               "the backup update log contents" + MSG_SHOULD_EQUAL);
 
-  debugDump("testing " + log.path + " contents (bug 470979)");
-  do_check_eq(readFile(log), "Backup Update Log");
-
-  dir.append("0");
-  debugDump("testing " + dir.path + " should exist (bug 512994)");
-  do_check_true(dir.exists());
+  dir.append(DIR_PATCH);
+  Assert.ok(dir.exists(), MSG_SHOULD_EXIST);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadAndHashCheckMar.js
@@ -55,28 +55,30 @@ function run_test_helper_pt1(aMsg, aExpe
   gCheckFunc = check_test_helper_pt1_1;
   gNextRunFunc = aNextRunFunc;
   gExpectedStatusResult = aExpectedStatusResult;
   debugDump(aMsg, Components.stack.caller);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_helper_pt1_1() {
-  do_check_eq(gUpdateCount, 1);
+  Assert.equal(gUpdateCount, 1,
+               "the update count" + MSG_SHOULD_EQUAL);
   gCheckFunc = check_test_helper_pt1_2;
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
   let state = gAUS.downloadUpdate(bestUpdate, false);
   if (state == STATE_NONE || state == STATE_FAILED) {
     do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
   }
   gAUS.addDownloadListener(downloadListener);
 }
 
 function check_test_helper_pt1_2() {
-  do_check_eq(gStatusResult, gExpectedStatusResult);
+  Assert.equal(gStatusResult, gExpectedStatusResult,
+               "the download status result" + MSG_SHOULD_EQUAL);
   gAUS.removeDownloadListener(downloadListener);
   gNextRunFunc();
 }
 
 // The following 3 functions are a workaround for GONK due to Bug 828858 and
 // can be removed after it is fixed and the callers are changed to use the
 // regular helper functions.
 function run_test_helper_bug828858_pt1(aMsg, aExpectedStatusResult, aNextRunFunc) {
@@ -86,31 +88,34 @@ function run_test_helper_bug828858_pt1(a
   gCheckFunc = check_test_helper_bug828858_pt1_1;
   gNextRunFunc = aNextRunFunc;
   gExpectedStatusResult = aExpectedStatusResult;
   debugDump(aMsg, Components.stack.caller);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_helper_bug828858_pt1_1() {
-  do_check_eq(gUpdateCount, 1);
+  Assert.equal(gUpdateCount, 1,
+               "the update count" + MSG_SHOULD_EQUAL);
   gCheckFunc = check_test_helper_bug828858_pt1_2;
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
   let state = gAUS.downloadUpdate(bestUpdate, false);
   if (state == STATE_NONE || state == STATE_FAILED) {
     do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
   }
   gAUS.addDownloadListener(downloadListener);
 }
 
 function check_test_helper_bug828858_pt1_2() {
   if (gStatusResult == Cr.NS_ERROR_CONTENT_CORRUPTED) {
-    do_check_eq(gStatusResult, Cr.NS_ERROR_CONTENT_CORRUPTED);
+    Assert.ok(true,
+              "the status result should equal NS_ERROR_CONTENT_CORRUPTED");
   } else {
-    do_check_eq(gStatusResult, gExpectedStatusResult);
+    Assert.equal(gStatusResult, gExpectedStatusResult,
+                 "the download status result" + MSG_SHOULD_EQUAL);
   }
   gAUS.removeDownloadListener(downloadListener);
   gNextRunFunc();
 }
 
 function setResponseBody(aHashFunction, aHashValue, aSize) {
   let patches = getRemotePatchString(null, null,
                                      aHashFunction, aHashValue, aSize);
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js
@@ -38,26 +38,29 @@ function run_test() {
   let update = gUpdateManager.activeUpdate;
   update.errorCode = WRITE_ERROR;
   let prompter = Cc["@mozilla.org/updates/update-prompt;1"].
                  createInstance(Ci.nsIUpdatePrompt);
   prompter.showUpdateError(update);
 }
 
 const WindowWatcher = {
-  getNewPrompter: function(aParent) {
-    do_check_eq(aParent, null);
+  getNewPrompter: function WW_getNewPrompter(aParent) {
+    Assert.ok(!aParent,
+              "the aParent parameter should not be defined");
     return {
-      alert: function(aTitle, aText) {
+      alert: function WW_GNP_alert(aTitle, aText) {
         let title = getString("updaterIOErrorTitle");
-        do_check_eq(aTitle, title);
+        Assert.equal(aTitle, title,
+                     "the ui string for title" + MSG_SHOULD_EQUAL);
         let text = gUpdateBundle.formatStringFromName("updaterIOErrorMsg",
                                                       [Services.appinfo.name,
                                                        Services.appinfo.name], 2);
-        do_check_eq(aText, text);
+        Assert.equal(aText, text,
+                     "the ui string for message" + MSG_SHOULD_EQUAL);
 
         doTestFinish();
       }
     }; 
   },
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowWatcher])
 };
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js
@@ -65,41 +65,45 @@ function run_test_pt1() {
 
   let patches = getRemotePatchString();
   let updates = getRemoteUpdateString(patches);
   gResponseBody = getRemoteUpdatesXMLString(updates);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt1() {
-  do_check_eq(gUpdateCount, 1);
+  Assert.equal(gUpdateCount, 1,
+               "the update count" + MSG_SHOULD_EQUAL);
 
   gActiveUpdate = gUpdates[0];
-  do_check_neq(gActiveUpdate, null);
+  Assert.ok(!!gActiveUpdate,
+            "there should be an active update");
 
   let state = gAUS.downloadUpdate(gActiveUpdate, true);
-  do_check_eq(state, "null");
-  do_check_eq(gActiveUpdate.errorCode >>> 0 , Cr.NS_ERROR_FILE_TOO_BIG);
+  Assert.equal(state, STATE_NONE,
+               "the update state" + MSG_SHOULD_EQUAL);
+  Assert.equal(gActiveUpdate.errorCode >>> 0 , Cr.NS_ERROR_FILE_TOO_BIG,
+               "the update error code" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
 
 function end_test() {
   gDirService.unregisterProvider(gDirProvider);
   gOldProviders.forEach(function(p) {
     gDirService.registerProvider(p);
   });
   gActiveUpdate = null;
   gDirService = null;
   gDirProvider = null;
 }
 
 function FakeDirProvider() {}
 FakeDirProvider.prototype = {
-  getFile: function(prop, persistent) {
+  getFile: function FP_getFile(prop, persistent) {
     if (prop == KEY_UPDATE_ARCHIVE_DIR) {
       if (gActiveUpdate) {
         gActiveUpdate.errorCode = Cr.NS_ERROR_FILE_TOO_BIG;
       }
     }
     return null;
   },
   classID: Components.ID("{f30b43a7-2bfa-4e5f-8c4f-abc7dd4ac486}"),
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js
@@ -30,18 +30,20 @@ function run_test_pt1() {
 }
 
 function xhr_pt1(aXHR) {
   aXHR.status = Cr.NS_ERROR_OFFLINE;
   aXHR.onerror({ target: aXHR });
 }
 
 function check_test_pt1(request, update) {
-  do_check_eq(gStatusCode, Cr.NS_ERROR_OFFLINE);
-  do_check_eq(update.errorCode, NETWORK_ERROR_OFFLINE);
+  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");
 }
@@ -65,13 +67,14 @@ function xhr_pt2(aXHR) {
     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.
-  do_check_neq(update, null);
-  do_check_eq(update.name, "App Update Test");
+  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
@@ -60,28 +60,30 @@ function run_test_helper_pt1(aMsg, aExpe
   gCheckFunc = check_test_helper_pt1_1;
   gNextRunFunc = aNextRunFunc;
   gExpectedStatusResult = aExpectedStatusResult;
   debugDump(aMsg, Components.stack.caller);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_helper_pt1_1() {
-  do_check_eq(gUpdateCount, 1);
+  Assert.equal(gUpdateCount, 1,
+               "the update count" + MSG_SHOULD_EQUAL);
   gCheckFunc = check_test_helper_pt1_2;
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
   let state = gAUS.downloadUpdate(bestUpdate, false);
   if (state == STATE_NONE || state == STATE_FAILED) {
     do_throw("nsIApplicationUpdateService:downloadUpdate returned " + state);
   }
   gAUS.addDownloadListener(downloadListener);
 }
 
 function check_test_helper_pt1_2() {
-  do_check_eq(gStatusResult, gExpectedStatusResult);
+  Assert.equal(gStatusResult, gExpectedStatusResult,
+               "the download status result" + MSG_SHOULD_EQUAL);
   gAUS.removeDownloadListener(downloadListener);
   gNextRunFunc();
 }
 
 function setResponseBody(aHashFunction, aHashValue, aSize) {
   let patches = getRemotePatchString(null, null,
                                      aHashFunction, aHashValue, aSize);
   let updates = getRemoteUpdateString(patches);
--- a/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js
@@ -17,21 +17,25 @@ function run_test() {
 
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
 
   standardInit();
 
   if (IS_TOOLKIT_GONK) {
     // GONK doesn't resume downloads at boot time, so the updateCount will
     // always be zero.
-    do_check_eq(gUpdateManager.updateCount, 0);
+    Assert.equal(gUpdateManager.updateCount, 0,
+                 "the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
   } else {
-    do_check_eq(gUpdateManager.updateCount, 1);
+    Assert.equal(gUpdateManager.updateCount, 1,
+                 "the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
   }
-  do_check_eq(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING);
+  Assert.equal(gUpdateManager.activeUpdate.state, STATE_DOWNLOADING,
+               "the update manager activeUpdate state attribute" +
+               MSG_SHOULD_EQUAL);
 
   // Pause the download and reload the Update Manager with an empty update so
   // the Application Update Service doesn't write the update xml files during
   // xpcom-shutdown which will leave behind the test directory.
   gAUS.pauseDownload();
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   reloadUpdateManagerData();
--- a/toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js
@@ -26,17 +26,18 @@ function run_test_helper_pt1(aMsg, aExpe
   gCheckFunc = check_test_helper_pt1;
   gNextRunFunc = aNextRunFunc;
   gExpectedCount = aExpectedCount;
   debugDump(aMsg, Components.stack.caller);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_helper_pt1() {
-  do_check_eq(gUpdateCount, gExpectedCount);
+  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;
@@ -95,70 +96,110 @@ function check_test_pt02() {
     // if the update XML does not supply one.
 //    let formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
 //                    getService(Ci.nsIURLFormatter);
 //    defaultDetailsURL = formatter.formatURLPref(PREF_APP_UPDATE_URL_DETAILS);
 //  } catch (e) {
 //    defaultDetailsURL = "";
 //  }
 
-  do_check_eq(gUpdateCount, 1);
+  Assert.equal(gUpdateCount, 1,
+               "the update count" + MSG_SHOULD_EQUAL);
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount).QueryInterface(Ci.nsIPropertyBag);
-  do_check_eq(bestUpdate.type, "minor");
-  do_check_eq(bestUpdate.name, "Minor Test");
-  do_check_eq(bestUpdate.displayVersion, "version 2.1a1pre");
-  do_check_eq(bestUpdate.appVersion, "2.1a1pre");
-  do_check_eq(bestUpdate.platformVersion, "3.1a1pre");
-  do_check_eq(bestUpdate.buildID, "20080811053724");
-  do_check_eq(bestUpdate.detailsURL, "http://details/");
-  do_check_eq(bestUpdate.billboardURL, "http://billboard/");
-  do_check_eq(bestUpdate.licenseURL, "http://license/");
-  do_check_true(bestUpdate.showPrompt);
-  do_check_true(bestUpdate.showNeverForVersion);
-  do_check_eq(bestUpdate.promptWaitTime, "345600");
-  do_check_eq(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1");
-  do_check_eq(bestUpdate.channel, "test_channel");
-  do_check_false(bestUpdate.isCompleteUpdate);
-  do_check_false(bestUpdate.isSecurityUpdate);
+  Assert.equal(bestUpdate.type, "minor",
+               "the update type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.name, "Minor Test",
+               "the update name attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.displayVersion, "version 2.1a1pre",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.appVersion, "2.1a1pre",
+               "the update appVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.platformVersion, "3.1a1pre",
+               "the update platformVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.buildID, "20080811053724",
+               "the update buildID attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.detailsURL, "http://details/",
+               "the update detailsURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.billboardURL, "http://billboard/",
+               "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.licenseURL, "http://license/",
+               "the update licenseURL 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",
+               "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.
-  do_check_true((Date.now() - bestUpdate.installDate) < 10000);
-  do_check_eq(bestUpdate.statusText, null);
+  Assert.ok((Date.now() - bestUpdate.installDate) < 10000,
+            "the update installDate attribute should be within 10 seconds of " +
+            "the current time");
+  Assert.ok(!bestUpdate.statusText,
+            "the update statusText attribute" + MSG_SHOULD_EQUAL);
   // nsIUpdate:state returns an empty string when no action has been performed
   // on an available update
-  do_check_eq(bestUpdate.state, "");
-  do_check_eq(bestUpdate.errorCode, 0);
-  do_check_eq(bestUpdate.patchCount, 2);
+  Assert.equal(bestUpdate.state, "",
+               "the update state attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.errorCode, 0,
+               "the update errorCode attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.patchCount, 2,
+               "the update patchCount attribute" + MSG_SHOULD_EQUAL);
   //XXX TODO - test nsIUpdate:serialize
 
-  do_check_eq(bestUpdate.getProperty("custom1_attr"), "custom1 value");
-  do_check_eq(bestUpdate.getProperty("custom2_attr"), "custom2 value");
+  Assert.equal(bestUpdate.getProperty("custom1_attr"), "custom1 value",
+               "the update custom1_attr property" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.getProperty("custom2_attr"), "custom2 value",
+               "the update custom2_attr property" + MSG_SHOULD_EQUAL);
 
   let patch = bestUpdate.getPatchAt(0);
-  do_check_eq(patch.type, "complete");
-  do_check_eq(patch.URL, "http://complete/");
-  do_check_eq(patch.hashFunction, "SHA1");
-  do_check_eq(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059");
-  do_check_eq(patch.size, 9856459);
+  Assert.equal(patch.type, "complete",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, "http://complete/",
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "SHA1",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059",
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, 9856459,
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
   // The value for patch.state can be the string 'null' as a valid value. This
   // is confusing if it returns null which is an invalid value since the test
   // failure output will show a failure for null == null. To lessen the
   // confusion first check that the typeof for patch.state is string.
-  do_check_eq(typeof(patch.state), "string");
-  do_check_eq(patch.state, STATE_NONE);
-  do_check_false(patch.selected);
+  Assert.equal(typeof(patch.state), "string",
+               "the update patch state typeof value should equal |string|");
+  Assert.equal(patch.state, STATE_NONE,
+               "the update patch state attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
   //XXX TODO - test nsIUpdatePatch:serialize
 
   patch = bestUpdate.getPatchAt(1);
-  do_check_eq(patch.type, "partial");
-  do_check_eq(patch.URL, "http://partial/");
-  do_check_eq(patch.hashFunction, "SHA1");
-  do_check_eq(patch.hashValue, "e6678ca40ae7582316acdeddf3c133c9c8577de4");
-  do_check_eq(patch.size, 1316138);
-  do_check_eq(patch.state, STATE_NONE);
-  do_check_false(patch.selected);
+  Assert.equal(patch.type, "partial",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, "http://partial/",
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "SHA1",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, "e6678ca40ae7582316acdeddf3c133c9c8577de4",
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, 1316138,
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.state, STATE_NONE,
+               "the update patch state attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
   //XXX TODO - test nsIUpdatePatch:serialize
 
   run_test_pt03();
 }
 
 // one update available and the update's property default values
 function run_test_pt03() {
   debugDump("testing one update available and the update's property values " +
@@ -175,57 +216,88 @@ function run_test_pt03() {
                                       "http://details/",
                                       null, null, null, null, "691200",
                                       null, "version 4.1a1pre", "4.1a1pre");
   gResponseBody = getRemoteUpdatesXMLString(updates);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt03() {
-  do_check_eq(gUpdateCount, 1);
+  Assert.equal(gUpdateCount, 1,
+               "the update count" + MSG_SHOULD_EQUAL);
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
-  do_check_eq(bestUpdate.type, "major");
-  do_check_eq(bestUpdate.name, "Major Test");
-  do_check_eq(bestUpdate.displayVersion, "version 4.1a1pre");
-  do_check_eq(bestUpdate.appVersion, "4.1a1pre");
-  do_check_eq(bestUpdate.platformVersion, "5.1a1pre");
-  do_check_eq(bestUpdate.buildID, "20080811053724");
-  do_check_eq(bestUpdate.detailsURL, "http://details/");
-  do_check_eq(bestUpdate.billboardURL, "http://details/");
-  do_check_eq(bestUpdate.licenseURL, null);
-  do_check_true(bestUpdate.showPrompt);
-  do_check_true(bestUpdate.showNeverForVersion);
-  do_check_eq(bestUpdate.promptWaitTime, "691200");
-  do_check_eq(bestUpdate.serviceURL, URL_HOST + "/update.xml?force=1");
-  do_check_eq(bestUpdate.channel, "test_channel");
-  do_check_false(bestUpdate.isCompleteUpdate);
-  do_check_false(bestUpdate.isSecurityUpdate);
+  Assert.equal(bestUpdate.type, "major",
+               "the update type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.name, "Major Test",
+               "the update name attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.displayVersion, "version 4.1a1pre",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.appVersion, "4.1a1pre",
+               "the update appVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.platformVersion, "5.1a1pre",
+               "the update platformVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.buildID, "20080811053724",
+               "the update buildID attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.detailsURL, "http://details/",
+               "the update detailsURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.billboardURL, "http://details/",
+               "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!bestUpdate.licenseURL,
+            "the update licenseURL 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",
+               "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.
-  do_check_true((Date.now() - bestUpdate.installDate) < 10000);
-  do_check_eq(bestUpdate.statusText, null);
+  Assert.ok((Date.now() - bestUpdate.installDate) < 10000,
+            "the update installDate attribute should be within 10 seconds of " +
+            "the current time");
+  Assert.ok(!bestUpdate.statusText,
+            "the update statusText attribute" + MSG_SHOULD_EQUAL);
   // nsIUpdate:state returns an empty string when no action has been performed
   // on an available update
-  do_check_eq(bestUpdate.state, "");
-  do_check_eq(bestUpdate.errorCode, 0);
-  do_check_eq(bestUpdate.patchCount, 1);
+  Assert.equal(bestUpdate.state, "",
+               "the update state attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.errorCode, 0,
+               "the update errorCode attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(bestUpdate.patchCount, 1,
+               "the update patchCount attribute" + MSG_SHOULD_EQUAL);
   //XXX TODO - test nsIUpdate:serialize
 
   let patch = bestUpdate.getPatchAt(0);
-  do_check_eq(patch.type, "complete");
-  do_check_eq(patch.URL, "http://complete/");
-  do_check_eq(patch.hashFunction, "SHA1");
-  do_check_eq(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059");
-  do_check_eq(patch.size, 9856459);
+  Assert.equal(patch.type, "complete",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, "http://complete/",
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "SHA1",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, "98db9dad8e1d80eda7e1170d0187d6f53e477059",
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, 9856459,
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
   // The value for patch.state can be the string 'null' as a valid value. This
   // is confusing if it returns null which is an invalid value since the test
   // failure output will show a failure for null == null. To lessen the
   // confusion first check that the typeof for patch.state is string.
-  do_check_eq(typeof(patch.state), "string");
-  do_check_eq(patch.state, STATE_NONE);
-  do_check_false(patch.selected);
+  Assert.equal(typeof(patch.state), "string",
+               "the update patch state typeof value should equal |string|");
+  Assert.equal(patch.state, STATE_NONE,
+               "the update patch state attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
   //XXX TODO - test nsIUpdatePatch:serialize
 
   run_test_pt04();
 }
 
 // Empty update xml (an empty xml file returns a root node name of parsererror)
 function run_test_pt04() {
   gResponseBody = "<parsererror/>";
@@ -299,29 +371,30 @@ function run_test_pt11() {
   updates += getRemoteUpdateString(patches, "minor", null, null, "1.0a");
   gResponseBody = getRemoteUpdatesXMLString(updates);
   run_test_helper_pt1("testing two updates older than the current version",
                       2, check_test_pt11);
 }
 
 function check_test_pt11() {
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
-  do_check_eq(bestUpdate, null);
+  Assert.ok(!bestUpdate);
   run_test_pt12();
 }
 
 // check that updates for the current version of the application are selected
 function run_test_pt12() {
   let patches = getRemotePatchString("complete");
   patches += getRemotePatchString("partial");
   let updates = getRemoteUpdateString(patches, "minor", null, "version 1.0");
   gResponseBody = getRemoteUpdatesXMLString(updates);
   run_test_helper_pt1("testing one update equal to the current version",
                       1, check_test_pt12);
 }
 
 function check_test_pt12() {
   let bestUpdate = gAUS.selectUpdate(gUpdates, gUpdateCount);
-  do_check_neq(bestUpdate, null);
-  do_check_eq(bestUpdate.displayVersion, "version 1.0");
+  Assert.ok(!!bestUpdate);
+  Assert.equal(bestUpdate.displayVersion, "version 1.0",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiAutoPref.js
@@ -36,17 +36,17 @@ function run_test() {
   let updates = getRemoteUpdateString(patches, "minor", null, null, "1.0");
   gResponseBody = getRemoteUpdatesXMLString(updates);
   gAUS.notify(null);
 }
 
 function check_status() {
   let status = readStatusFile();
   Assert.notEqual(status, STATE_DOWNLOADING,
-                  "the update should not be downloading");
+                  "the update state" + MSG_SHOULD_EQUAL);
 
   // Pause the download and reload the Update Manager with an empty update so
   // the Application Update Service doesn't write the update xml files during
   // xpcom-shutdown which will leave behind the test directory.
   gAUS.pauseDownload();
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), true);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   reloadUpdateManagerData();
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js
@@ -32,33 +32,35 @@ function run_test() {
 
   debugDump("testing showUpdateInstalled should not call openWindow");
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
 
   gCheckFunc = check_showUpdateInstalled;
   gUP.showUpdateInstalled();
   // Report a successful check after the call to showUpdateInstalled since it
   // didn't throw and otherwise it would report no tests run.
-  do_check_true(true);
+  Assert.ok(true,
+            "calling showUpdateInstalled should not attempt to open a window");
 
   debugDump("testing showUpdateAvailable should not call openWindow");
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   let patches = getLocalPatchString(null, null, null, null, null, null,
                                     STATE_FAILED);
   let updates = getLocalUpdateString(patches);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeStatusFile(STATE_FAILED);
   reloadUpdateManagerData();
 
   gCheckFunc = check_showUpdateAvailable;
   let update = gUpdateManager.activeUpdate;
   gUP.showUpdateAvailable(update);
   // Report a successful check after the call to showUpdateAvailable since it
   // didn't throw and otherwise it would report no tests run.
-  do_check_true(true);
+  Assert.ok(true,
+            "calling showUpdateAvailable should not attempt to open a window");
 
   doTestFinish();
 }
 
 function check_showUpdateInstalled() {
   do_throw("showUpdateInstalled should not have called openWindow!");
 }
 
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js
@@ -29,41 +29,44 @@ function run_test() {
 
   debugDump("testing showUpdateInstalled should not call openWindow");
   Services.prefs.setBoolPref(PREF_APP_UPDATE_SHOW_INSTALLED_UI, true);
 
   gCheckFunc = check_showUpdateInstalled;
   gUP.showUpdateInstalled();
   // Report a successful check after the call to showUpdateInstalled since it
   // didn't throw and otherwise it would report no tests run.
-  do_check_true(true);
+  Assert.ok(true,
+            "calling showUpdateInstalled should not attempt to open a window");
 
   debugDump("testing showUpdateAvailable should not call openWindow");
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false);
   let patches = getLocalPatchString(null, null, null, null, null, null,
                                     STATE_FAILED);
   let updates = getLocalUpdateString(patches);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeStatusFile(STATE_FAILED);
   reloadUpdateManagerData();
 
   gCheckFunc = check_showUpdateAvailable;
   let update = gUpdateManager.activeUpdate;
   gUP.showUpdateAvailable(update);
   // Report a successful check after the call to showUpdateAvailable since it
   // didn't throw and otherwise it would report no tests run.
-  do_check_true(true);
+  Assert.ok(true,
+            "calling showUpdateAvailable should not attempt to open a window");
 
   debugDump("testing showUpdateError should not call getNewPrompter");
   gCheckFunc = check_showUpdateError;
   update.errorCode = WRITE_ERROR;
   gUP.showUpdateError(update);
   // Report a successful check after the call to showUpdateError since it
   // didn't throw and otherwise it would report no tests run.
-  do_check_true(true);
+  Assert.ok(true,
+            "calling showUpdateError should not attempt to open a window");
 
   doTestFinish();
 }
 
 function check_showUpdateInstalled() {
   do_throw("showUpdateInstalled should not have called openWindow!");
 }
 
--- a/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js
@@ -43,17 +43,18 @@ function run_test() {
   do_execute_soon(check_test);
 }
 
 function check_test() {
   if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS)) {
     do_execute_soon(check_test);
     return;
   }
-  do_check_true(true);
+  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;
--- a/toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js
@@ -24,35 +24,37 @@ function run_test() {
   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;
-  var e = { target: aXHR };
+  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() {
-  do_check_eq(gStatusCode, gExpectedStatusCode);
+  Assert.equal(gStatusCode, gExpectedStatusCode,
+               "the download status code" + MSG_SHOULD_EQUAL);
   let expectedStatusText = getStatusText(gExpectedStatusCode);
-  do_check_eq(gStatusText, expectedStatusText);
+  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)
@@ -61,19 +63,21 @@ function run_test_pt1() {
   gStatusText = null;
   gCheckFunc = check_test_pt1;
   gExpectedStatusCode = 399;
   debugDump("testing default onerror error message");
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt1() {
-  do_check_eq(gStatusCode, gExpectedStatusCode);
+  Assert.equal(gStatusCode, gExpectedStatusCode,
+               "the download status code" + MSG_SHOULD_EQUAL);
   let expectedStatusText = getStatusText(404);
-  do_check_eq(gStatusText, expectedStatusText);
+  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");
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js
@@ -40,85 +40,143 @@ function run_test() {
                                  "test_channel", "false", null, null, "691200",
                                  null, "version 3", "3.0", null,
                                  "custom3_attr=\"custom3 value\"",
                                  "custom4_attr=\"custom4 value\"");
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false);
 
   standardInit();
 
-  do_check_eq(gUpdateManager.activeUpdate, null);
-  do_check_eq(gUpdateManager.updateCount, 2);
+  Assert.ok(!gUpdateManager.activeUpdate,
+            "the update manager activeUpdate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(gUpdateManager.updateCount, 2,
+               "the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
 
   let update = gUpdateManager.getUpdateAt(0).QueryInterface(Ci.nsIPropertyBag);
-  do_check_eq(update.state, STATE_SUCCEEDED);
-  do_check_eq(update.type, "major");
-  do_check_eq(update.name, "New");
-  do_check_eq(update.displayVersion, "version 4");
-  do_check_eq(update.appVersion, "4.0");
-  do_check_eq(update.platformVersion, "4.0");
-  do_check_eq(update.buildID, "20070811053724");
-  do_check_eq(update.detailsURL, "http://details1/");
-  do_check_eq(update.billboardURL, "http://billboard1/");
-  do_check_eq(update.licenseURL, "http://license1/");
-  do_check_eq(update.serviceURL, "http://service1/");
-  do_check_eq(update.installDate, "1238441300314");
+  Assert.equal(update.state, STATE_SUCCEEDED,
+               "the update state attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.type, "major",
+               "the update type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.name, "New",
+               "the update name attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.displayVersion, "version 4",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.appVersion, "4.0",
+               "the update appVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.platformVersion, "4.0",
+               "the update platformVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.buildID, "20070811053724",
+               "the update buildID attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.detailsURL, "http://details1/",
+               "the update detailsURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.billboardURL, "http://billboard1/",
+               "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.licenseURL, "http://license1/",
+               "the update licenseURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.serviceURL, "http://service1/",
+               "the update serviceURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.installDate, "1238441300314",
+               "the update installDate attribute" + MSG_SHOULD_EQUAL);
   // statusText is updated
-  do_check_eq(update.statusText, getString("installSuccess"));
-  do_check_false(update.isCompleteUpdate);
-  do_check_eq(update.channel, "test_channel");
-  do_check_true(update.showPrompt);
-  do_check_true(update.showNeverForVersion);
-  do_check_eq(update.promptWaitTime, "345600");
-  do_check_eq(update.previousAppVersion, "3.0");
+  Assert.equal(update.statusText, getString("installSuccess"),
+               "the update statusText attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.isCompleteUpdate,
+            "the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.channel, "test_channel",
+               "the update channel attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.showPrompt,
+            "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.showNeverForVersion,
+            "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.promptWaitTime, "345600",
+               "the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.previousAppVersion, "3.0",
+               "the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
   // Custom attributes
-  do_check_eq(update.getProperty("custom1_attr"), "custom1 value");
-  do_check_eq(update.getProperty("custom2_attr"), "custom2 value");
+  Assert.equal(update.getProperty("custom1_attr"), "custom1 value",
+               "the update custom1_attr property" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.getProperty("custom2_attr"), "custom2 value",
+               "the update custom2_attr property" + MSG_SHOULD_EQUAL);
 
   let patch = update.selectedPatch;
-  do_check_eq(patch.type, "partial");
-  do_check_eq(patch.URL, "http://partial/");
-  do_check_eq(patch.hashFunction, "SHA256");
-  do_check_eq(patch.hashValue, "cd43");
-  do_check_eq(patch.size, "86");
-  do_check_true(patch.selected);
-  do_check_eq(patch.state, STATE_SUCCEEDED);
+  Assert.equal(patch.type, "partial",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, "http://partial/",
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "SHA256",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, "cd43",
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, "86",
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.state, STATE_SUCCEEDED,
+               "the update patch state attribute" + MSG_SHOULD_EQUAL);
 
   update = gUpdateManager.getUpdateAt(1).QueryInterface(Ci.nsIPropertyBag);
-  do_check_eq(update.state, STATE_FAILED);
-  do_check_eq(update.name, "Existing");
-  do_check_eq(update.type, "major");
-  do_check_eq(update.displayVersion, "version 3");
-  do_check_eq(update.appVersion, "3.0");
-  do_check_eq(update.platformVersion, "3.0");
-  do_check_eq(update.detailsURL, "http://details2/");
-  do_check_eq(update.billboardURL, "http://details2/");
-  do_check_eq(update.licenseURL, null);
-  do_check_eq(update.serviceURL, "http://service2/");
-  do_check_eq(update.installDate, "1238441400314");
-  do_check_eq(update.statusText, getString("patchApplyFailure"));
-  do_check_eq(update.buildID, "20080811053724");
-  do_check_true(update.isCompleteUpdate);
-  do_check_eq(update.channel, "test_channel");
-  do_check_true(update.showPrompt);
-  do_check_true(update.showNeverForVersion);
-  do_check_eq(update.promptWaitTime, "691200");
-  do_check_eq(update.previousAppVersion, null);
+  Assert.equal(update.state, STATE_FAILED,
+               "the update state attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.name, "Existing",
+               "the update name attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.type, "major",
+               "the update type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.displayVersion, "version 3",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.appVersion, "3.0",
+               "the update appVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.platformVersion, "3.0",
+               "the update platformVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.detailsURL, "http://details2/",
+               "the update detailsURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.billboardURL, "http://details2/",
+               "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.licenseURL,
+            "the update licenseURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.serviceURL, "http://service2/",
+               "the update serviceURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.installDate, "1238441400314",
+               "the update installDate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.statusText, getString("patchApplyFailure"),
+               "the update statusText attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.buildID, "20080811053724",
+               "the update buildID attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.isCompleteUpdate,
+            "the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.channel, "test_channel",
+               "the update channel attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.showPrompt,
+            "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.showNeverForVersion,
+            "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.promptWaitTime, "691200",
+               "the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.previousAppVersion, null,
+               "the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
   // Custom attributes
-  do_check_eq(update.getProperty("custom3_attr"), "custom3 value");
-  do_check_eq(update.getProperty("custom4_attr"), "custom4 value");
+  Assert.equal(update.getProperty("custom3_attr"), "custom3 value",
+               "the update custom3_attr property" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.getProperty("custom4_attr"), "custom4 value",
+               "the update custom4_attr property" + MSG_SHOULD_EQUAL);
 
   patch = update.selectedPatch;
-  do_check_eq(patch.type, "complete");
-  do_check_eq(patch.URL, "http://complete/");
-  do_check_eq(patch.hashFunction, "SHA1");
-  do_check_eq(patch.hashValue, "6232");
-  do_check_eq(patch.size, "75");
-  do_check_true(patch.selected);
-  do_check_eq(patch.state, STATE_FAILED);
+  Assert.equal(patch.type, "complete",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, "http://complete/",
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "SHA1",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, "6232",
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, "75",
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.state, STATE_FAILED,
+               "the update patch state attribute" + MSG_SHOULD_EQUAL);
 
   removeUpdateDirsAndFiles();
 
   // XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244
   // and until this is fixed this will not test the value for detailsURL when it
   // isn't specified in the update xml.
   patches = getLocalPatchString(null, null, null, null, null, null,
                                 STATE_PENDING);
@@ -140,73 +198,127 @@ function run_test() {
                                  getString("patchApplyFailure"), null,
                                  "test_channel", "false", null, null, "200",
                                  null, "version 3", null, null);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), false);
 
   reloadUpdateManagerData();
   initUpdateServiceStub();
 
-  do_check_eq(gUpdateManager.activeUpdate, null);
-  do_check_eq(gUpdateManager.updateCount, 2);
+  Assert.ok(!gUpdateManager.activeUpdate,
+            "the update manager activeUpdate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(gUpdateManager.updateCount, 2,
+               "the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
 
   update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
-  do_check_eq(update.type, "major");
-  do_check_eq(update.name, "New");
-  do_check_eq(update.displayVersion, "version 4.0");
-  do_check_eq(update.appVersion, "4.0");
-  do_check_eq(update.platformVersion, "4.0");
-  do_check_eq(update.detailsURL, "http://details/");
-  do_check_eq(update.billboardURL, "http://billboard/");
-  do_check_eq(update.licenseURL, "http://license/");
-  do_check_eq(update.serviceURL, "http://service/");
-  do_check_eq(update.installDate, "1238441400314");
-  do_check_eq(update.statusText, getString("installSuccess"));
-  do_check_eq(update.buildID, "20080811053724");
-  do_check_true(update.isCompleteUpdate);
-  do_check_eq(update.channel, "test_channel");
-  do_check_true(update.showPrompt);
-  do_check_true(update.showNeverForVersion);
-  do_check_eq(update.promptWaitTime, "100");
-  do_check_eq(update.previousAppVersion, "3.0");
+  Assert.equal(update.state, STATE_SUCCEEDED,
+               "the update state attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.type, "major",
+               "the update type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.name, "New",
+               "the update name attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.displayVersion, "version 4.0",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.appVersion, "4.0",
+               "the update appVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.platformVersion, "4.0",
+               "the update platformVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.detailsURL, "http://details/",
+               "the update detailsURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.billboardURL, "http://billboard/",
+               "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.licenseURL, "http://license/",
+               "the update licenseURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.serviceURL, "http://service/",
+               "the update serviceURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.installDate, "1238441400314",
+               "the update installDate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.statusText, getString("installSuccess"),
+               "the update statusText attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.buildID, "20080811053724",
+               "the update buildID attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.isCompleteUpdate,
+            "the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.channel, "test_channel",
+               "the update channel attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.showPrompt,
+            "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.showNeverForVersion,
+            "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.promptWaitTime, "100",
+               "the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.previousAppVersion, "3.0",
+               "the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
 
   patch = update.selectedPatch;
-  do_check_eq(patch.type, "complete");
-  do_check_eq(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR);
-  do_check_eq(patch.hashFunction, "MD5");
-  do_check_eq(patch.hashValue, MD5_HASH_SIMPLE_MAR);
-  do_check_eq(patch.size, SIZE_SIMPLE_MAR);
-  do_check_true(patch.selected);
-  do_check_eq(patch.state, STATE_SUCCEEDED);
+  Assert.equal(patch.type, "complete",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR,
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "MD5",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, MD5_HASH_SIMPLE_MAR,
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, SIZE_SIMPLE_MAR,
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.state, STATE_SUCCEEDED,
+            "the update patch state attribute" + MSG_SHOULD_EQUAL);
 
   update = gUpdateManager.getUpdateAt(1);
-  do_check_eq(update.state, STATE_FAILED);
-  do_check_eq(update.name, "Existing");
-  do_check_eq(update.type, "major");
-  do_check_eq(update.displayVersion, "version 3.0");
-  do_check_eq(update.appVersion, "3.0");
-  do_check_eq(update.platformVersion, "3.0");
-  do_check_eq(update.detailsURL, "http://details/");
-  do_check_eq(update.billboardURL, null);
-  do_check_eq(update.licenseURL, null);
-  do_check_eq(update.serviceURL, "http://service/");
-  do_check_eq(update.installDate, "1238441400314");
-  do_check_eq(update.statusText, getString("patchApplyFailure"));
-  do_check_eq(update.buildID, "20080811053724");
-  do_check_true(update.isCompleteUpdate);
-  do_check_eq(update.channel, "test_channel");
-  do_check_false(update.showPrompt);
-  do_check_false(update.showNeverForVersion);
-  do_check_eq(update.promptWaitTime, "200");
-  do_check_eq(update.previousAppVersion, null);
+  Assert.equal(update.state, STATE_FAILED,
+               "the update state attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.name, "Existing",
+               "the update name attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.type, "major",
+               "the update type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.displayVersion, "version 3.0",
+               "the update displayVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.appVersion, "3.0",
+               "the update appVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.platformVersion, "3.0",
+               "the update platformVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.detailsURL, "http://details/",
+               "the update detailsURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.billboardURL,
+            "the update billboardURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.licenseURL,
+            "the update licenseURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.serviceURL, "http://service/",
+               "the update serviceURL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.installDate, "1238441400314",
+               "the update installDate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.statusText, getString("patchApplyFailure"),
+               "the update statusText attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.buildID, "20080811053724",
+               "the update buildID attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!update.isCompleteUpdate,
+            "the update isCompleteUpdate attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.channel, "test_channel",
+               "the update channel attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.showPrompt,
+            "the update showPrompt attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.showNeverForVersion,
+            "the update showNeverForVersion attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(update.promptWaitTime, "200",
+               "the update promptWaitTime attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!update.previousAppVersion,
+            "the update previousAppVersion attribute" + MSG_SHOULD_EQUAL);
 
   patch = update.selectedPatch;
-  do_check_eq(patch.type, "complete");
-  do_check_eq(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR);
-  do_check_eq(patch.hashFunction, "MD5");
-  do_check_eq(patch.hashValue, MD5_HASH_SIMPLE_MAR);
-  do_check_eq(patch.size, SIZE_SIMPLE_MAR);
-  do_check_true(patch.selected);
-  do_check_eq(patch.state, STATE_FAILED);
+  Assert.equal(patch.type, "complete",
+               "the update patch type attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR,
+               "the update patch URL attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashFunction, "MD5",
+               "the update patch hashFunction attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.hashValue, MD5_HASH_SIMPLE_MAR,
+               "the update patch hashValue attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.size, SIZE_SIMPLE_MAR,
+               "the update patch size attribute" + MSG_SHOULD_EQUAL);
+  Assert.ok(!!patch.selected,
+            "the update patch selected attribute" + MSG_SHOULD_EQUAL);
+  Assert.equal(patch.state, STATE_FAILED,
+               "the update patch state attribute" + MSG_SHOULD_EQUAL);
 
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
+++ b/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js
@@ -1,17 +1,15 @@
 /* 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/.
  */
 
 /* General URL Construction Tests */
 
-Cu.import("resource://gre/modules/ctypes.jsm")
-
 const URL_PREFIX = URL_HOST + "/";
 
 var gAppInfo;
 
 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;
@@ -27,17 +25,17 @@ function run_test() {
 }
 
 // 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;
-  var e = { target: aXHR };
+  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];
 }
 
@@ -46,45 +44,48 @@ function run_test_pt1() {
   gCheckFunc = check_test_pt1;
   let url = URL_PREFIX + "%PRODUCT%/";
   debugDump("testing url constructed with %PRODUCT% - " + url);
   setUpdateURLOverride(url);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt1() {
-  do_check_eq(getResult(gRequestURL), gAppInfo.name);
+  Assert.equal(getResult(gRequestURL), gAppInfo.name,
+               "the url param for %PRODUCT%" + MSG_SHOULD_EQUAL);
   run_test_pt2();
 }
 
 // url constructed with %VERSION%
 function run_test_pt2() {
   gCheckFunc = check_test_pt2;
   let url = URL_PREFIX + "%VERSION%/";
   debugDump("testing url constructed with %VERSION% - " + url);
   setUpdateURLOverride(url);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt2() {
-  do_check_eq(getResult(gRequestURL), gAppInfo.version);
+  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);
 }
 
 function check_test_pt3() {
-  do_check_eq(getResult(gRequestURL), gAppInfo.appBuildID);
+  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%/";
@@ -108,17 +109,18 @@ function check_test_pt4() {
     let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
                    getService(Ci.nsIMacUtils);
 
     if (macutils.isUniversalBinary) {
       abi += "-u-" + macutils.architecturesInBinary;
     }
   }
 
-  do_check_eq(getResult(gRequestURL), gAppInfo.OS + "_" + abi);
+  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
@@ -134,62 +136,69 @@ function run_test_pt5() {
   } catch (e) {
     debugDump("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);
+  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);
 }
 
 function check_test_pt6() {
-  do_check_eq(getResult(gRequestURL), "test_channel");
+  Assert.equal(getResult(gRequestURL), "test_channel",
+               "the url param for %CHANNEL%" + MSG_SHOULD_EQUAL);
   run_test_pt7();
 }
 
 // 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(PREF_APP_PARTNER_BRANCH + "test_partner1", "test_partner1");
-  gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner2", "test_partner2");
+  gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner1",
+                                 "test_partner1");
+  gDefaultPrefBranch.setCharPref(PREF_APP_PARTNER_BRANCH + "test_partner2",
+                                 "test_partner2");
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt7() {
-  do_check_eq(getResult(gRequestURL), "test_channel-cck-test_partner1-test_partner2");
+  Assert.equal(getResult(gRequestURL),
+               "test_channel-cck-test_partner1-test_partner2",
+               "the url param for %CHANNEL%" + MSG_SHOULD_EQUAL);
   run_test_pt8();
 }
 
 // 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() {
-  do_check_eq(getResult(gRequestURL), gAppInfo.platformVersion);
+  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);
@@ -327,84 +336,92 @@ function check_test_pt9() {
       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);
   }
 
-  do_check_eq(getResult(gRequestURL), osVersion);
+  Assert.equal(getResult(gRequestURL), osVersion,
+               "the url param for %OS_VERSION%" + MSG_SHOULD_EQUAL);
   run_test_pt10();
 }
 
 // url constructed with %DISTRIBUTION%
 function run_test_pt10() {
   gCheckFunc = check_test_pt10;
   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_pt10() {
-  do_check_eq(getResult(gRequestURL), "test_distro");
+  Assert.equal(getResult(gRequestURL), "test_distro",
+               "the url param for %DISTRIBUTION%" + MSG_SHOULD_EQUAL);
   run_test_pt11();
 }
 
 // url constructed with %DISTRIBUTION_VERSION%
 function run_test_pt11() {
   gCheckFunc = check_test_pt11;
   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_pt11() {
-  do_check_eq(getResult(gRequestURL), "test_distro_version");
+  Assert.equal(getResult(gRequestURL), "test_distro_version",
+               "the url param for %DISTRIBUTION_VERSION%" + MSG_SHOULD_EQUAL);
   run_test_pt12();
 }
 
 // url with force param that doesn't already have a param - bug 454357
 function run_test_pt12() {
   gCheckFunc = check_test_pt12;
   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_pt12() {
-  do_check_eq(getResult(gRequestURL), "?force=1");
+  Assert.equal(getResult(gRequestURL), "?force=1",
+               "the url query string for force" + MSG_SHOULD_EQUAL);
   run_test_pt13();
 }
 
 // url with force param that already has a param - bug 454357
 function run_test_pt13() {
   gCheckFunc = check_test_pt13;
   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_pt13() {
-  do_check_eq(getResult(gRequestURL), "?extra=param&force=1");
+  Assert.equal(getResult(gRequestURL), "?extra=param&force=1",
+               "the url query string for force with an extra string" +
+               MSG_SHOULD_EQUAL);
   run_test_pt14();
 }
 
 function run_test_pt14() {
   Services.prefs.setCharPref("app.update.custom", "custom");
   gCheckFunc = check_test_pt14;
   let url = URL_PREFIX + "?custom=%CUSTOM%";
   debugDump("testing url constructed with %CUSTOM% - " + url);
   setUpdateURLOverride(url);
   gUpdateChecker.checkForUpdates(updateCheckListener, true);
 }
 
 function check_test_pt14() {
-  do_check_eq(getResult(gRequestURL), "?custom=custom&force=1");
+  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_base_updater/marAppApplyDirLockedStageFailure_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyDirLockedStageFailure_win.js
@@ -2,16 +2,19 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
+const START_STATE = STATE_PENDING;
+const END_STATE = STATE_PENDING;
+
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
@@ -22,73 +25,61 @@ function run_test() {
   createUpdaterINI(false);
 
   if (IS_WIN) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
   }
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING);
+  writeStatusFile(START_STATE);
 
   reloadUpdateManagerData();
-  do_check_true(!!gUpdateManager.activeUpdate);
+  Assert.ok(!!gUpdateManager.activeUpdate,
+            "the active update should be defined");
 
   lockDirectory(getAppBaseDir());
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
   stageUpdate();
 }
 
 function end_test() {
   resetEnvironment();
 }
 
 /**
  * Checks if staging the update has failed.
  */
 function checkUpdateApplied() {
   // Don't proceed until the update has failed, and reset to pending.
-  if (gUpdateManager.activeUpdate.state != STATE_PENDING) {
+  if (gUpdateManager.activeUpdate.state != END_STATE) {
     if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
-               STATE_PENDING +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "active update status state to equal: " +
+               END_STATE +
                ", current state: " + gUpdateManager.activeUpdate.state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   do_timeout(TEST_CHECK_TIMEOUT, finishTest);
 }
 
 function finishTest() {
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
-  do_check_eq(readStatusState(), STATE_PENDING);
+  checkPostUpdateRunningFile(false);
+  Assert.equal(readStatusState(), END_STATE,
+               "the status state" + MSG_SHOULD_EQUAL);
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
   unlockDirectory(getAppBaseDir());
   standardInit();
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
-Cu.import("resource://gre/modules/ctypes.jsm");
+const START_STATE = STATE_PENDING;
+const END_STATE = STATE_APPLIED;
 
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   setupTestCommon();
@@ -23,41 +24,33 @@ function run_test() {
   createUpdaterINI(true);
 
   if (IS_WIN) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
   }
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING);
+  writeStatusFile(START_STATE);
 
   reloadUpdateManagerData();
-  do_check_true(!!gUpdateManager.activeUpdate);
+  Assert.ok(!!gUpdateManager.activeUpdate,
+            "the active update should be defined");
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
+  setAppBundleModTime();
   stageUpdate();
 }
 
 function customLaunchAppToApplyUpdate() {
   debugDump("start - locking installation directory");
   const LPCWSTR = ctypes.char16_t.ptr;
   const DWORD = ctypes.uint32_t;
   const LPVOID = ctypes.voidptr_t;
@@ -69,119 +62,101 @@ function customLaunchAppToApplyUpdate() 
   const INVALID_HANDLE_VALUE = LPVOID(0xffffffff);
   let kernel32 = ctypes.open("kernel32");
   let CreateFile = kernel32.declare("CreateFileW", ctypes.default_abi,
                                     LPVOID, LPCWSTR, DWORD, DWORD,
                                     LPVOID, DWORD, DWORD, LPVOID);
   gHandle = CreateFile(getAppBaseDir().path, GENERIC_READ,
                        FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
                        OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
-  do_check_neq(gHandle.toString(), INVALID_HANDLE_VALUE.toString());
+  Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
+                  "the handle should not equal INVALID_HANDLE_VALUE");
   kernel32.close();
   debugDump("finish - locking installation directory");
 }
 
 /**
  * Checks if the update has finished being staged.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the active update's state is the expected value.
-  if (gUpdateManager.activeUpdate.state != STATE_APPLIED) {
+  if (gUpdateManager.activeUpdate.state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
-               STATE_APPLIED +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "active update status state to equal: " +
+               END_STATE +
                ", current state: " + gUpdateManager.activeUpdate.state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
-  if (state != STATE_APPLIED) {
+  if (state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " +
-               STATE_APPLIED +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update" +
+               "status file state to equal: " +
+               END_STATE +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the last update log has been created.
   let log;
   if (IS_WIN || IS_MACOSX) {
     log = getUpdatesDir();
   } else {
     log = getStageDirFile(null, true);
     log.append(DIR_UPDATES);
   }
   log.append(FILE_LAST_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
                "to be created. Path: " + log.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched when staging an
-    // update.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
 
   log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   } else {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
-  let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
-  debugDump("testing " + updatesDir.path + " shouldn't exist");
-  do_check_false(updatesDir.exists());
-
-  log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
+  Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   } else {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   }
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   // Switch the application to the staged application that was updated by
   // launching the application.
   do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
@@ -201,89 +176,76 @@ function checkUpdateFinished() {
  * the test.
  */
 function finishCheckUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
   if (state != STATE_SUCCEEDED) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "update status file state to equal: " +
                STATE_SUCCEEDED +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   // Don't proceed until the application was switched out with the staged update
   // successfully.
   let updatedDir = getStageDirFile(null, true);
   if (updatedDir.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
-               updatedDir.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
+               "directory to not exist. Path: " + updatedDir.path);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   if (IS_WIN) {
     // Don't proceed until the updater binary is no longer in use.
     let updater = getUpdatesPatchDir();
     updater.append(FILE_UPDATER_BIN);
     if (updater.exists()) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-        do_throw("Exceeded while waiting for updater binary to no longer be " +
-                 "in use");
-      } else {
-        try {
-          updater.remove(false);
-        } catch (e) {
-          do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
-          return;
-        }
+        do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+                 "updater binary to no longer be in use");
+      }
+      try {
+        updater.remove(false);
+      } catch (e) {
+        do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+        return;
       }
     }
   }
 
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkPostUpdateRunningFile(true);
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   checkCallbackAppLog();
 
   standardInit();
 
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
+  Assert.equal(update.state, STATE_SUCCEEDED,
+               "the update state" + MSG_SHOULD_EQUAL);
 
   let updatesDir = getUpdatesPatchDir();
-  debugDump("testing " + updatesDir.path + " should exist");
-  do_check_true(updatesDir.exists());
+  Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
 
   let log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js
@@ -2,16 +2,19 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
+const START_STATE = STATE_PENDING;
+const END_STATE = STATE_APPLIED;
+
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
@@ -21,142 +24,115 @@ function run_test() {
   createUpdaterINI(false);
 
   if (IS_WIN) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, false);
   }
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING);
+  writeStatusFile(START_STATE);
 
   reloadUpdateManagerData();
-  do_check_true(!!gUpdateManager.activeUpdate);
+  Assert.ok(!!gUpdateManager.activeUpdate,
+            "the active update should be defined");
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
+  setAppBundleModTime();
   stageUpdate();
 }
 
 /**
  * Checks if the update has finished being staged.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the active update's state is the expected value.
-  if (gUpdateManager.activeUpdate.state != STATE_APPLIED) {
+  if (gUpdateManager.activeUpdate.state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
-               STATE_APPLIED +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "active update status state to equal: " +
+               END_STATE +
                ", current state: " + gUpdateManager.activeUpdate.state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
-  if (state != STATE_APPLIED) {
+  if (state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
                "status state to equal: " +
-               STATE_APPLIED +
+               END_STATE +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the last update log has been created.
   let log;
   if (IS_WIN || IS_MACOSX) {
     log = getUpdatesDir();
   } else {
     log = getStageDirFile(null, true);
     log.append(DIR_UPDATES);
   }
   log.append(FILE_LAST_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
                "to be created. Path: " + log.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched when staging an
-    // update.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
 
   log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   } else {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
-  let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
-  debugDump("testing " + updatesDir.path + " shouldn't exist");
-  do_check_false(updatesDir.exists());
-
-  log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
+  Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   } else {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   }
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   // Switch the application to the staged application that was updated by
   // launching the application.
   do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
@@ -176,95 +152,82 @@ function checkUpdateFinished() {
  * the test.
  */
 function finishCheckUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
   if (state != STATE_SUCCEEDED) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " + STATE_SUCCEEDED +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "update status file state to equal: " +
+               STATE_SUCCEEDED +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   // Don't proceed until the application was switched out with the staged update
   // successfully.
   let updatedDir = getStageDirFile(null, true);
   if (updatedDir.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
-               updatedDir.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
+               "directory to not exist. Path: " + updatedDir.path);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   if (IS_WIN) {
     // Don't proceed until the updater binary is no longer in use.
     let updater = getUpdatesPatchDir();
     updater.append(FILE_UPDATER_BIN);
     if (updater.exists()) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-        do_throw("Exceeded while waiting for updater binary to no longer be " +
-                 "in use");
-      } else {
-        try {
-          updater.remove(false);
-        } catch (e) {
-          do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
-          return;
-        }
+        do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+                 "updater binary to no longer be in use");
+      }
+      try {
+        updater.remove(false);
+      } catch (e) {
+        do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+        return;
       }
     }
   }
 
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkPostUpdateRunningFile(true);
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   gSwitchApp = true;
   checkUpdateLogContents();
   gSwitchApp = false;
   checkCallbackAppLog();
 
   standardInit();
 
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
+  Assert.equal(update.state, STATE_SUCCEEDED,
+               "the update state" + MSG_SHOULD_EQUAL);
 
   let updatesDir = getUpdatesPatchDir();
-  debugDump("testing " + updatesDir.path + " should exist");
-  do_check_true(updatesDir.exists());
+  Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
 
   let log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   } else {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js
@@ -2,48 +2,42 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
+const START_STATE = STATE_PENDING;
+const END_STATE = STATE_SUCCEEDED;
+
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
   setupUpdaterTest(FILE_COMPLETE_MAR);
 
   createUpdaterINI();
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING);
+  writeStatusFile(START_STATE);
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
 }
 
@@ -63,90 +57,77 @@ function checkUpdateFinished() {
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
-  if (state != STATE_SUCCEEDED) {
+  if (state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " + STATE_SUCCEEDED +
+               "status state to equal: " + END_STATE +
                ", current status state: " + state);
     } else {
       do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
     return;
   }
 
   // Don't proceed until the update log has been created.
   let log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
                "to be created. Path: " + log.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   if (IS_WIN) {
     // Don't proceed until the updater binary is no longer in use.
     let updater = getUpdatesPatchDir();
     updater.append(FILE_UPDATER_BIN);
     if (updater.exists()) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
         do_throw("Exceeded while waiting for updater binary to no longer be " +
                  "in use");
-      } else {
-        try {
-          updater.remove(false);
-        } catch (e) {
-          do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
-          return;
-        }
+      }
+      try {
+        updater.remove(false);
+      } catch (e) {
+        do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+        return;
       }
     }
   }
 
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   checkCallbackAppLog();
 
   standardInit();
 
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
+  Assert.equal(update.state, END_STATE,
+               "the update state" + MSG_SHOULD_EQUAL);
 
-  let updatesPatchDir = getUpdatesPatchDir();
-  debugDump("testing " + updatesPatchDir.path + " should exist");
-  do_check_true(updatesPatchDir.exists());
+  let updatesDir = getUpdatesPatchDir();
+  Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js
@@ -1,14 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /* Application in use complete MAR file staged patch apply failure fallback test */
 
+const START_STATE = STATE_APPLIED;
+const END_STATE = STATE_PENDING;
+
 function run_test() {
   gStageUpdate = true;
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
   setTestFilesAndDirsForFailure();
   setupUpdaterTest(FILE_COMPLETE_MAR);
 
@@ -20,22 +23,22 @@ function run_test() {
                            createInstance(Ci.nsIProcess);
   callbackAppProcess.init(callbackApp);
   callbackAppProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(0, STATE_APPLIED, null);
+  runUpdate(0, START_STATE, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, END_STATE, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js
@@ -1,14 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /* Application in use complete MAR file staged patch apply failure test */
 
+const START_STATE = STATE_APPLIED;
+const END_STATE = STATE_FAILED_WRITE_ERROR;
+
 function run_test() {
   gStageUpdate = true;
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
   setTestFilesAndDirsForFailure();
   setupUpdaterTest(FILE_COMPLETE_MAR);
 
@@ -20,23 +23,23 @@ function run_test() {
                            createInstance(Ci.nsIProcess);
   callbackAppProcess.init(callbackApp);
   callbackAppProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(0, STATE_APPLIED, null);
+  runUpdate(0, START_STATE, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, END_STATE, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js
@@ -10,26 +10,17 @@ function run_test() {
   gTestFiles = gTestFilesCompleteSuccess;
   gTestFiles[gTestFiles.length - 1].originalContents = null;
   gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n";
   gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
   gTestDirs = gTestDirsCompleteSuccess;
   setupUpdaterTest(FILE_COMPLETE_MAR);
 
   createUpdaterINI(false);
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   if (IS_UNIX) {
     removeSymlink();
     createSymlink();
     do_register_cleanup(removeSymlink);
     gTestFiles.splice(gTestFiles.length - 3, 0,
     {
       description      : "Readable symlink",
@@ -57,28 +48,23 @@ function run_test() {
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
-
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched when staging an
-    // update.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
+  checkPostUpdateRunningFile(false);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   do_timeout(TEST_CHECK_TIMEOUT, function() {
-    runUpdate(0, STATE_SUCCEEDED);
+    runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
   });
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
 function checkUpdateApplied() {
@@ -90,25 +76,17 @@ function checkUpdateApplied() {
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateApplied() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   setupHelperFinish();
 }
 
 function checkUpdate() {
   if (IS_UNIX) {
     checkSymlink();
   }
@@ -119,17 +97,18 @@ function checkUpdate() {
 
 function runHelperProcess(args) {
   let helperBin = getTestDirFile(FILE_HELPER_BIN);
   let process = Cc["@mozilla.org/process/util;1"].
                 createInstance(Ci.nsIProcess);
   process.init(helperBin);
   debugDump("Running " + helperBin.path + " " + args.join(" "));
   process.run(true, args, args.length);
-  do_check_eq(process.exitValue, 0);
+  Assert.equal(process.exitValue, 0,
+               "the helper process exit value should be 0");
 }
 
 function createSymlink() {
   let args = ["setup-symlink", "moz-foo", "moz-bar", "target",
               getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
   runHelperProcess(args);
   getApplyDirFile(DIR_RESOURCES + "link", false).permissions = 0o666;
   
--- a/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js
@@ -19,40 +19,23 @@ function run_test() {
                            createInstance(Ci.nsIProcess);
   callbackAppProcess.init(callbackApp);
   callbackAppProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let applyToDir = getApplyDirFile();
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
-  runUpdate(0, STATE_SUCCEEDED);
+  setAppBundleModTime();
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js
@@ -13,16 +13,16 @@ function run_test() {
 
   gCallbackBinFile = "exe0.exe";
 
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js
@@ -13,16 +13,16 @@ function run_test() {
 
   gCallbackBinFile = "exe0.exe";
 
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js
@@ -7,16 +7,16 @@
 function run_test() {
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
   setupUpdaterTest(FILE_COMPLETE_MAR);
 
   gCallbackBinFile = "exe0.exe";
 
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js
@@ -7,16 +7,16 @@
 function run_test() {
   setupTestCommon();
   gTestFiles = gTestFilesPartialSuccess;
   gTestDirs = gTestDirsPartialSuccess;
   setupUpdaterTest(FILE_PARTIAL_MAR);
 
   gCallbackBinFile = "exe0.exe";
 
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js
@@ -9,47 +9,27 @@ function run_test() {
   setupTestCommon();
   gTestFiles = gTestFilesPartialSuccess;
   gTestFiles[11].originalFile = "partial.png";
   gTestDirs = gTestDirsPartialSuccess;
   setTestFilesAndDirsForFailure();
   setupUpdaterTest(FILE_PARTIAL_MAR);
 
   createUpdaterINI();
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   // Note that on platforms where we use execv, we cannot trust the return code.
-  runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
+  runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE,
+            checkUpdateFinished);
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
-function checkUpdateApplied() {
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+function checkUpdateFinished() {
+  checkPostUpdateRunningFile(false);
+  checkAppBundleModTime();
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_PARTIAL_FAILURE);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js
@@ -26,17 +26,17 @@ function run_test() {
 }
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js
@@ -26,17 +26,17 @@ function run_test() {
 }
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailureComplete_win.js
@@ -27,17 +27,17 @@ function run_test() {
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageFailurePartial_win.js
@@ -27,17 +27,17 @@ function run_test() {
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js
@@ -19,20 +19,20 @@ function run_test() {
                          createInstance(Ci.nsIProcess);
   fileInUseProcess.init(fileInUseBin);
   fileInUseProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
   checkUpdateLogContains(ERR_BACKUP_DISCARD);
   standardInit();
   checkCallbackAppLog();
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js
@@ -19,20 +19,20 @@ function run_test() {
                          createInstance(Ci.nsIProcess);
   fileInUseProcess.init(fileInUseBin);
   fileInUseProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
   checkUpdateLogContains(ERR_BACKUP_DISCARD);
   standardInit();
   checkCallbackAppLog();
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js
@@ -29,20 +29,20 @@ function run_test() {
                         createInstance(Ci.nsIProcess);
   lockFileProcess.init(helperBin);
   lockFileProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
   checkUpdateLogContains(ERR_RENAME_FILE);
   standardInit();
   checkCallbackAppLog();
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js
@@ -29,20 +29,20 @@ function run_test() {
                         createInstance(Ci.nsIProcess);
   lockFileProcess.init(helperBin);
   lockFileProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(1, STATE_FAILED_READ_ERROR);
+  runUpdate(1, STATE_FAILED_READ_ERROR, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
   checkUpdateLogContains(ERR_UNABLE_OPEN_DEST);
   standardInit();
   checkCallbackAppLog();
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js
@@ -35,17 +35,17 @@ function run_test() {
 }
 
 function doUpdate() {
   runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js
@@ -35,17 +35,17 @@ function run_test() {
 }
 
 function doUpdate() {
   runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js
@@ -36,17 +36,17 @@ function run_test() {
 
 function doUpdate() {
   runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js
@@ -36,17 +36,17 @@ function run_test() {
 
 function doUpdate() {
   runUpdate(1, STATE_FAILED_WRITE_ERROR_FILE_COPY, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js
@@ -37,17 +37,17 @@ function run_test() {
 }
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js
@@ -35,17 +35,17 @@ function run_test() {
 }
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailureComplete_win.js
@@ -38,17 +38,17 @@ function run_test() {
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageFailurePartial_win.js
@@ -36,17 +36,17 @@ function run_test() {
 
 function doUpdate() {
   runUpdate(0, STATE_APPLIED, null);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js
@@ -29,20 +29,20 @@ function run_test() {
                          createInstance(Ci.nsIProcess);
   fileInUseProcess.init(fileInUseBin);
   fileInUseProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
   checkUpdateLogContains(ERR_BACKUP_DISCARD);
   standardInit();
   checkCallbackAppLog();
--- a/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js
@@ -27,20 +27,20 @@ function run_test() {
                          createInstance(Ci.nsIProcess);
   fileInUseProcess.init(fileInUseBin);
   fileInUseProcess.run(false, args, args.length);
 
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, true);
   checkUpdateLogContains(ERR_BACKUP_DISCARD);
   standardInit();
   checkCallbackAppLog();
--- a/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js
@@ -11,36 +11,22 @@ function run_test() {
   gTestFiles = gTestFilesPartialSuccess;
   gTestFiles[11].originalFile = "partial.png";
   gTestDirs = gTestDirsPartialSuccess;
   setTestFilesAndDirsForFailure();
   setupUpdaterTest(FILE_PARTIAL_MAR);
 
   createUpdaterINI(true);
 
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
-  runUpdate(1, STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
+  runUpdate(1, STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE, checkUpdateFinished);
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
-function checkUpdateApplied() {
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
+function checkUpdateFinished() {
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
   checkUpdateLogContents(LOG_PARTIAL_FAILURE);
   standardInit();
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js
@@ -20,26 +20,17 @@ function run_test() {
     // directory in the new location.
     let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
     writeFile(testFile, "test\n");
     testFile = getApplyDirFile(DIR_MACOS + "distribution/test1/testFile", true);
     writeFile(testFile, "test\n");
   }
 
   createUpdaterINI(false);
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   // Don't test symlinks on Mac OS X in this test since it tends to timeout.
   // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js
   if (IS_UNIX && !IS_MACOSX) {
     removeSymlink();
     createSymlink();
     do_register_cleanup(removeSymlink);
     gTestFiles.splice(gTestFiles.length - 3, 0,
@@ -55,28 +46,23 @@ function run_test() {
       comparePerms     : 0o666
     });
   }
 
   runUpdate(0, STATE_APPLIED, null);
 
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
-
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched when staging an
-    // update.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
+  checkPostUpdateRunningFile(false);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   do_timeout(TEST_CHECK_TIMEOUT, function() {
-    runUpdate(0, STATE_SUCCEEDED);
+    runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
   });
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
 function checkUpdateApplied() {
@@ -88,53 +74,43 @@ function checkUpdateApplied() {
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateApplied() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
+  checkPostUpdateRunningFile(true);
 
   if (IS_MACOSX) {
-    debugDump("testing that the distribution directory is removed from the " +
-              "old location when there is a distribution directory in the " +
-              "new location");
     let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
-    debugDump("testing " + distributionDir.path + " shouldn't exist");
-    do_check_false(distributionDir.exists());
-
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
     checkUpdateLogContains("removing old distribution directory");
   }
 
   if (IS_UNIX && !IS_MACOSX) {
     checkSymlink();
   }
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   standardInit();
   checkCallbackAppLog();
 }
 
 function runHelperProcess(args) {
   let helperBin = getTestDirFile(FILE_HELPER_BIN);
   let process = Cc["@mozilla.org/process/util;1"].
                 createInstance(Ci.nsIProcess);
   process.init(helperBin);
   debugDump("Running " + helperBin.path + " " + args.join(" "));
   process.run(true, args, args.length);
-  do_check_eq(process.exitValue, 0);
+  Assert.equal(process.exitValue, 0,
+               "the helper process exit value should be 0");
 }
 
 function createSymlink() {
   let args = ["setup-symlink", "moz-foo", "moz-bar", "target",
               getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
   runHelperProcess(args);
   getApplyDirFile(DIR_RESOURCES + "link", false).permissions = 0o666;
   
--- a/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js
@@ -20,43 +20,29 @@ function run_test() {
     // the directory and its contents are moved to the new location on update.
     let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
     writeFile(testFile, "test\n");
     testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
     writeFile(testFile, "test\n");
   }
 
   createUpdaterINI(false);
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   runUpdate(0, STATE_APPLIED, null);
 
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
   checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
-
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched when staging an
-    // update.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
+  checkPostUpdateRunningFile(false);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   do_timeout(TEST_CHECK_TIMEOUT, function() {
-    runUpdate(0, STATE_SUCCEEDED);
+    runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
   });
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
 function checkUpdateApplied() {
@@ -68,49 +54,36 @@ function checkUpdateApplied() {
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateApplied() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
+  checkPostUpdateRunningFile(true);
 
   let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
   if (IS_MACOSX) {
-    debugDump("testing that the distribution directory is moved from the " +
-              "old location to the new location");
-    debugDump("testing " + distributionDir.path + " should exist");
-    do_check_true(distributionDir.exists());
+    Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
 
     let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
-    debugDump("testing " + testFile.path + " should exist");
-    do_check_true(testFile.exists());
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
 
     testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
-    debugDump("testing " + testFile.path + " should exist");
-    do_check_true(testFile.exists());
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
 
     distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
-    debugDump("testing " + distributionDir.path + " shouldn't exist");
-    do_check_false(distributionDir.exists());
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
 
     checkUpdateLogContains("Moving old distribution directory to new location");
   } else {
     debugDump("testing that files aren't added with an add-if instruction " +
               "when the file's destination directory doesn't exist");
-    debugDump("testing " + distributionDir.path + " shouldn't exist");
-    do_check_false(distributionDir.exists());
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js
@@ -16,81 +16,57 @@ function run_test() {
     // the directory and its contents are moved to the new location on update.
     let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
     writeFile(testFile, "test\n");
     testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
     writeFile(testFile, "test\n");
   }
 
   createUpdaterINI();
+  setAppBundleModTime();
 
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   if (IS_WIN || IS_MACOSX) {
-    gCheckFunc = finishCheckUpdateApplied;
+    gCheckFunc = finishCheckUpdateFinished;
     checkPostUpdateAppLog();
   } else {
-    finishCheckUpdateApplied();
+    finishCheckUpdateFinished();
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
-function finishCheckUpdateApplied() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+function finishCheckUpdateFinished() {
   let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
   if (IS_MACOSX) {
-    debugDump("testing that the distribution directory is moved from the " +
-              "old location to the new location");
-    debugDump("testing " + distributionDir.path + " should exist");
-    do_check_true(distributionDir.exists());
+    Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
 
     let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
-    debugDump("testing " + testFile.path + " should exist");
-    do_check_true(testFile.exists());
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
 
     testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
-    debugDump("testing " + testFile.path + " should exist");
-    do_check_true(testFile.exists());
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
 
     distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
-    debugDump("testing " + distributionDir.path + " shouldn't exist");
-    do_check_false(distributionDir.exists());
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
 
     checkUpdateLogContains("Moving old distribution directory to new location");
   } else {
     debugDump("testing that files aren't added with an add-if instruction " +
               "when the file's destination directory doesn't exist");
-    debugDump("testing " + distributionDir.path + " shouldn't exist");
-    do_check_false(distributionDir.exists());
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js
@@ -22,65 +22,43 @@ function run_test() {
     // directory in the new location.
     let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
     writeFile(testFile, "test\n");
     testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
     writeFile(testFile, "test\n");
   }
 
   createUpdaterINI(true);
+  setAppBundleModTime();
 
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateFinished);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
-function checkUpdateApplied() {
+function checkUpdateFinished() {
   if (IS_WIN || IS_MACOSX) {
-    gCheckFunc = finishCheckUpdateApplied;
+    gCheckFunc = finishCheckUpdateFinished;
     checkPostUpdateAppLog();
   } else {
-    finishCheckUpdateApplied();
+    finishCheckUpdateFinished();
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
-function finishCheckUpdateApplied() {
+function finishCheckUpdateFinished() {
   if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
-  if (IS_MACOSX) {
-    debugDump("testing that the distribution directory is removed from the " +
-              "old location when there is a distribution directory in the " +
-              "new location");
     let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
-    debugDump("testing " + distributionDir.path + " shouldn't exist");
-    do_check_false(distributionDir.exists());
-
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
     checkUpdateLogContains("removing old distribution directory");
   }
 
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js
@@ -18,25 +18,22 @@ function run_test() {
   setupUpdaterTest(FILE_OLD_VERSION_MAR);
 
   createUpdaterINI(true);
 
   // Apply the MAR
   // Note that if execv is used, the updater process will turn into the
   // callback process, so its return code will be that of the callback
   // app.
-  runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_VERSION_DOWNGRADE_ERROR);
+  runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_VERSION_DOWNGRADE_ERROR,
+            checkUpdateApplied);
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function checkUpdateApplied() {
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
+++ b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js
@@ -18,25 +18,22 @@ function run_test() {
   setupUpdaterTest(FILE_WRONG_CHANNEL_MAR);
 
   createUpdaterINI();
 
   // Apply the MAR
   // Note that if execv is used, the updater process will turn into the
   // callback process, so its return code will be that of the callback
   // app.
-  runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_CHANNEL_MISMATCH_ERROR);
+  runUpdate((USE_EXECV ? 0 : 1), STATE_FAILED_CHANNEL_MISMATCH_ERROR,
+            checkUpdateApplied);
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function checkUpdateApplied() {
-  if (IS_WIN || IS_MACOSX) {
-    // Check that the post update process was not launched.
-    do_check_false(getPostUpdateFile(".running").exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   doTestFinish();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/checkUpdaterSigSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/checkUpdaterSigSvc.js
@@ -14,27 +14,28 @@ function run_test() {
 
   let binDir = getGREBinDir();
   let maintenanceServiceBin = binDir.clone();
   maintenanceServiceBin.append(FILE_MAINTENANCE_SERVICE_BIN);
 
   let updaterBin = binDir.clone();
   updaterBin.append(FILE_UPDATER_BIN);
 
-  logTestInfo("Launching maintenance service bin: " +
-              maintenanceServiceBin.path + " to check updater: " +
-              updaterBin.path + " signature.");
+  debugDump("Launching maintenance service bin: " +
+            maintenanceServiceBin.path + " to check updater: " +
+            updaterBin.path + " signature.");
 
   // Bypass the manifest and run as invoker
   let env = Cc["@mozilla.org/process/environment;1"].
             getService(Ci.nsIEnvironment);
   env.set("__COMPAT_LAYER", "RunAsInvoker");
 
   let dummyInstallPath = "---";
   let maintenanceServiceBinArgs = ["check-cert", dummyInstallPath,
                                    updaterBin.path];
   let maintenanceServiceBinProcess = Cc["@mozilla.org/process/util;1"].
                                      createInstance(Ci.nsIProcess);
   maintenanceServiceBinProcess.init(maintenanceServiceBin);
   maintenanceServiceBinProcess.run(true, maintenanceServiceBinArgs,
                                    maintenanceServiceBinArgs.length);
-  do_check_eq(maintenanceServiceBinProcess.exitValue, 0);
+  Assert.equal(maintenanceServiceBinProcess.exitValue, 0,
+               "the maintenance service exit value should be 0");
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyDirLockedStageFailureSvc_win.js
@@ -2,16 +2,19 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
+const START_STATE = STATE_PENDING_SVC;
+const END_STATE = STATE_PENDING;
+
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   if (!shouldRunServiceTest()) {
     return;
@@ -26,75 +29,61 @@ function run_test() {
   createUpdaterINI(false);
 
   if (IS_WIN) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
   }
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING_SVC);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING_SVC);
+  writeStatusFile(START_STATE);
 
   reloadUpdateManagerData();
-  do_check_true(!!gUpdateManager.activeUpdate);
+  Assert.ok(!!gUpdateManager.activeUpdate,
+            "the active update should be defined");
 
   lockDirectory(getAppBaseDir());
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
   stageUpdate();
 }
 
 function end_test() {
   resetEnvironment();
 }
 
 /**
  * Checks if staging the update has failed.
  */
 function checkUpdateApplied() {
   // Don't proceed until the update has failed, and reset to pending.
-  if (gUpdateManager.activeUpdate.state != STATE_PENDING) {
+  if (gUpdateManager.activeUpdate.state != END_STATE) {
     if (++gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
-               STATE_PENDING +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "active update status state to equal: " +
+               END_STATE +
                ", current state: " + gUpdateManager.activeUpdate.state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   do_timeout(TEST_CHECK_TIMEOUT, finishTest);
 }
 
 function finishTest() {
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
-
-  do_check_eq(readStatusState(), STATE_PENDING);
+  checkPostUpdateRunningFile(false);
+  Assert.equal(readStatusState(), END_STATE,
+               "the status state" + MSG_SHOULD_EQUAL);
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
   unlockDirectory(getAppBaseDir());
   standardInit();
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js
@@ -2,17 +2,18 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
-Cu.import("resource://gre/modules/ctypes.jsm");
+const START_STATE = STATE_PENDING_SVC;
+const END_STATE = STATE_APPLIED_SVC;
 
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   if (!shouldRunServiceTest()) {
@@ -27,41 +28,33 @@ function run_test() {
   createUpdaterINI(true);
 
   if (IS_WIN) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
   }
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING_SVC);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING_SVC);
+  writeStatusFile(START_STATE);
 
   reloadUpdateManagerData();
-  do_check_true(!!gUpdateManager.activeUpdate);
+  Assert.ok(!!gUpdateManager.activeUpdate,
+            "the active update should be defined");
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
+  setAppBundleModTime();
   stageUpdate();
 }
 
 function customLaunchAppToApplyUpdate() {
   debugDump("start - locking installation directory");
   const LPCWSTR = ctypes.char16_t.ptr;
   const DWORD = ctypes.uint32_t;
   const LPVOID = ctypes.voidptr_t;
@@ -73,120 +66,101 @@ function customLaunchAppToApplyUpdate() 
   const INVALID_HANDLE_VALUE = LPVOID(0xffffffff);
   let kernel32 = ctypes.open("kernel32");
   let CreateFile = kernel32.declare("CreateFileW", ctypes.default_abi,
                                     LPVOID, LPCWSTR, DWORD, DWORD,
                                     LPVOID, DWORD, DWORD, LPVOID);
   gHandle = CreateFile(getAppBaseDir().path, GENERIC_READ,
                        FILE_SHARE_READ | FILE_SHARE_WRITE, LPVOID(0),
                        OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, LPVOID(0));
-  do_check_neq(gHandle.toString(), INVALID_HANDLE_VALUE.toString());
+  Assert.notEqual(gHandle.toString(), INVALID_HANDLE_VALUE.toString(),
+                  "the handle should not equal INVALID_HANDLE_VALUE");
   kernel32.close();
   debugDump("finish - locking installation directory");
 }
 
 /**
  * Checks if the update has finished being staged.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the active update's state is the expected value.
-  if (gUpdateManager.activeUpdate.state != STATE_APPLIED_SVC) {
+  if (gUpdateManager.activeUpdate.state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
-               STATE_APPLIED_SVC +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "active update status state to equal: " +
+               END_STATE +
                ", current state: " + gUpdateManager.activeUpdate.state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
-  if (state != STATE_APPLIED_SVC) {
+  if (state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " +
-               STATE_APPLIED_SVC +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update" +
+               "status file state to equal: " +
+               END_STATE +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the last update log has been created.
   let log;
   if (IS_WIN || IS_MACOSX) {
     log = getUpdatesDir();
   } else {
     log = getStageDirFile(null, true);
     log.append(DIR_UPDATES);
   }
   log.append(FILE_LAST_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
                "to be created. Path: " + log.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
 
   log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   } else {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
-  let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
-  debugDump("testing " + updatesDir.path + " shouldn't exist");
-  do_check_false(updatesDir.exists());
-
-  log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
+  Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   } else {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   }
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   // Switch the application to the staged application that was updated by
   // launching the application.
   do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
@@ -206,96 +180,76 @@ function checkUpdateFinished() {
  * the test.
  */
 function finishCheckUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
   if (state != STATE_SUCCEEDED) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "update status file state to equal: " +
                STATE_SUCCEEDED +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   // Don't proceed until the application was switched out with the staged update
   // successfully.
   let updatedDir = getStageDirFile(null, true);
   if (updatedDir.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
-               updatedDir.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
+               "directory to not exist. Path: " + updatedDir.path);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   if (IS_WIN) {
     // Don't proceed until the updater binary is no longer in use.
     let updater = getUpdatesPatchDir();
     updater.append(FILE_UPDATER_BIN);
     if (updater.exists()) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-        do_throw("Exceeded while waiting for updater binary to no longer be " +
-                 "in use");
-      } else {
-        try {
-          updater.remove(false);
-        } catch (e) {
-          do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
-          return;
-        }
+        do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+                 "updater binary to no longer be in use");
+      }
+      try {
+        updater.remove(false);
+      } catch (e) {
+        do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+        return;
       }
     }
   }
 
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file exists. " +
-              "Path: " + running.path);
-    do_check_true(running.exists());
-  }
-
+  checkPostUpdateRunningFile(true);
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   checkCallbackAppLog();
 
   standardInit();
 
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
+  Assert.equal(update.state, STATE_SUCCEEDED,
+               "the update state" + MSG_SHOULD_EQUAL);
 
   let updatesDir = getUpdatesPatchDir();
-  debugDump("testing " + updatesDir.path + " should exist");
-  do_check_true(updatesDir.exists());
+  Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
 
   let log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js
@@ -2,16 +2,19 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
+const START_STATE = STATE_PENDING_SVC;
+const END_STATE = STATE_APPLIED_SVC;
+
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   if (!shouldRunServiceTest()) {
     return;
@@ -25,143 +28,115 @@ function run_test() {
   createUpdaterINI(false);
 
   if (IS_WIN) {
     Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true);
   }
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING_SVC);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING_SVC);
+  writeStatusFile(START_STATE);
 
   reloadUpdateManagerData();
-  do_check_true(!!gUpdateManager.activeUpdate);
+  Assert.ok(!!gUpdateManager.activeUpdate,
+            "the active update should be defined");
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
+  setAppBundleModTime();
   stageUpdate();
 }
 
 /**
  * Checks if the update has finished being staged.
  */
 function checkUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the active update's state is the expected value.
-  if (gUpdateManager.activeUpdate.state != STATE_APPLIED_SVC) {
+  if (gUpdateManager.activeUpdate.state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for update to equal: " +
-               STATE_APPLIED_SVC +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "active update status state to equal: " +
+               END_STATE +
                ", current state: " + gUpdateManager.activeUpdate.state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
-  if (state != STATE_APPLIED_SVC) {
+  if (state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
                "status state to equal: " +
-               STATE_APPLIED_SVC +
+               END_STATE +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
   // Don't proceed until the last update log has been created.
   let log;
   if (IS_WIN || IS_MACOSX) {
     log = getUpdatesDir();
   } else {
     log = getStageDirFile(null, true);
     log.append(DIR_UPDATES);
   }
   log.append(FILE_LAST_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
                "to be created. Path: " + log.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateApplied);
     return;
   }
 
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
 
   log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   } else {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
-  let updatesDir = getStageDirFile(DIR_UPDATES + "/0", true);
-  debugDump("testing " + updatesDir.path + " shouldn't exist");
-  do_check_false(updatesDir.exists());
-
-  log = getStageDirFile(DIR_UPDATES + "/0/" + FILE_UPDATE_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  let updatesDir = getStageDirFile(DIR_UPDATES + "/" + DIR_PATCH, true);
+  Assert.ok(!updatesDir.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_LAST_LOG, true);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   } else {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   }
 
   log = getStageDirFile(DIR_UPDATES + "/" + FILE_BACKUP_LOG, true);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   // Switch the application to the staged application that was updated by
   // launching the application.
   do_timeout(TEST_CHECK_TIMEOUT, launchAppToApplyUpdate);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
@@ -181,102 +156,82 @@ function checkUpdateFinished() {
  * the test.
  */
 function finishCheckUpdateApplied() {
   gTimeoutRuns++;
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
   if (state != STATE_SUCCEEDED) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " + STATE_SUCCEEDED +
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+               "update status file state to equal: " +
+               STATE_SUCCEEDED +
                ", current status state: " + state);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   // Don't proceed until the application was switched out with the staged update
   // successfully.
   let updatedDir = getStageDirFile(null, true);
   if (updatedDir.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-      do_throw("Exceeded while waiting for updated dir to not exist. Path: " +
-               updatedDir.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+      do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the updated " +
+               "directory to not exist. Path: " + updatedDir.path);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   if (IS_WIN) {
     // Don't proceed until the updater binary is no longer in use.
     let updater = getUpdatesPatchDir();
     updater.append(FILE_UPDATER_BIN);
     if (updater.exists()) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
-        do_throw("Exceeded while waiting for updater binary to no longer be " +
-                 "in use");
-      } else {
-        try {
-          updater.remove(false);
-        } catch (e) {
-          do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
-          return;
-        }
+        do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the " +
+                 "updater binary to no longer be in use");
+      }
+      try {
+        updater.remove(false);
+      } catch (e) {
+        do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+        return;
       }
     }
   }
 
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file exists. " +
-              "Path: " + running.path);
-    do_check_true(running.exists());
-  }
-
+  checkPostUpdateRunningFile(true);
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   gSwitchApp = true;
   checkUpdateLogContents();
   gSwitchApp = false;
   checkCallbackAppLog();
 
   standardInit();
 
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
+  Assert.equal(update.state, STATE_SUCCEEDED,
+               "the update state" + MSG_SHOULD_EQUAL);
 
   let updatesDir = getUpdatesPatchDir();
-  debugDump("testing " + updatesDir.path + " should exist");
-  do_check_true(updatesDir.exists());
+  Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
 
   let log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
   if (IS_WIN || IS_MACOSX) {
-    debugDump("testing " + log.path + " should exist");
-    do_check_true(log.exists());
+    Assert.ok(log.exists(), MSG_SHOULD_EXIST);
   } else {
-    debugDump("testing " + log.path + " shouldn't exist");
-    do_check_false(log.exists());
+    Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js
@@ -2,58 +2,52 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /**
  * Test applying an update by staging an update and launching an application to
  * apply it.
  */
 
+const START_STATE = STATE_PENDING_SVC;
+const END_STATE = STATE_SUCCEEDED;
+
 function run_test() {
   if (MOZ_APP_NAME == "xulrunner") {
     logTestInfo("Unable to run this test on xulrunner");
     return;
   }
 
   if (!shouldRunServiceTest()) {
     return;
   }
 
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
   setupUpdaterTest(FILE_COMPLETE_MAR);
 
   createUpdaterINI();
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   let channel = Services.prefs.getCharPref(PREF_APP_UPDATE_CHANNEL);
   let patches = getLocalPatchString(null, null, null, null, null, "true",
-                                    STATE_PENDING);
+                                    START_STATE);
   let updates = getLocalUpdateString(patches, null, null, null, null, null,
                                      null, null, null, null, null, null,
                                      null, "true", channel);
   writeUpdatesToXMLFile(getLocalUpdatesXMLString(updates), true);
   writeVersionFile(getAppVersion());
-  writeStatusFile(STATE_PENDING_SVC);
+  writeStatusFile(START_STATE);
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
-  runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
+  runUpdateUsingService(START_STATE, END_STATE);
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
 function checkUpdateFinished() {
   if (IS_WIN || IS_MACOSX) {
@@ -67,90 +61,77 @@ function checkUpdateFinished() {
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateFinished() {
   gTimeoutRuns++;
   // Don't proceed until the update's status state is the expected value.
   let state = readStatusState();
-  if (state != STATE_SUCCEEDED) {
+  if (state != END_STATE) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update " +
-               "status state to equal: " + STATE_SUCCEEDED +
+               "status state to equal: " + END_STATE +
                ", current status state: " + state);
     } else {
       do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
     return;
   }
 
   // Don't proceed until the update log has been created.
   let log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
   if (!log.exists()) {
     if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
       do_throw("Exceeded MAX_TIMEOUT_RUNS while waiting for the update log " +
                "to be created. Path: " + log.path);
-    } else {
-      do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     }
+    do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
     return;
   }
 
   if (IS_WIN) {
     // Don't proceed until the updater binary is no longer in use.
     let updater = getUpdatesPatchDir();
     updater.append(FILE_UPDATER_BIN);
     if (updater.exists()) {
       if (gTimeoutRuns > MAX_TIMEOUT_RUNS) {
         do_throw("Exceeded while waiting for updater binary to no longer be " +
                  "in use");
-      } else {
-        try {
-          updater.remove(false);
-        } catch (e) {
-          do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
-          return;
-        }
+      }
+      try {
+        updater.remove(false);
+      } catch (e) {
+        do_timeout(TEST_CHECK_TIMEOUT, checkUpdateFinished);
+        return;
       }
     }
   }
 
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   checkCallbackAppLog();
 
   standardInit();
 
   let update = gUpdateManager.getUpdateAt(0);
-  do_check_eq(update.state, STATE_SUCCEEDED);
+  Assert.equal(update.state, END_STATE,
+               "the update state" + MSG_SHOULD_EQUAL);
 
-  let updatesPatchDir = getUpdatesPatchDir();
-  debugDump("testing " + updatesPatchDir.path + " should exist");
-  do_check_true(updatesPatchDir.exists());
+  let updatesDir = getUpdatesPatchDir();
+  Assert.ok(updatesDir.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesPatchDir();
   log.append(FILE_UPDATE_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_LAST_LOG);
-  debugDump("testing " + log.path + " should exist");
-  do_check_true(log.exists());
+  Assert.ok(log.exists(), MSG_SHOULD_EXIST);
 
   log = getUpdatesDir();
   log.append(FILE_BACKUP_LOG);
-  debugDump("testing " + log.path + " shouldn't exist");
-  do_check_false(log.exists());
+  Assert.ok(!log.exists(), MSG_SHOULD_NOT_EXIST);
 
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js
@@ -1,14 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /* Application in use complete MAR file staged patch apply failure fallback test */
 
+const START_STATE = STATE_PENDING_SVC;
+const END_STATE = STATE_PENDING;
+
 function run_test() {
   if (!shouldRunServiceTest()) {
     return;
   }
 
   gStageUpdate = true;
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
@@ -28,24 +31,24 @@ function run_test() {
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
+  runUpdateUsingService(START_STATE, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, END_STATE, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js
@@ -1,14 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 /* Application in use complete MAR file staged patch apply failure test */
 
+const START_STATE = STATE_PENDING_SVC;
+const END_STATE = STATE_FAILED_WRITE_ERROR;
+
 function run_test() {
   if (!shouldRunServiceTest()) {
     return;
   }
 
   gStageUpdate = true;
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
@@ -28,25 +31,25 @@ function run_test() {
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
+  runUpdateUsingService(START_STATE, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, END_STATE, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js
@@ -27,40 +27,23 @@ function run_test() {
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   do_timeout(TEST_HELPER_TIMEOUT, waitForHelperSleep);
 }
 
 function doUpdate() {
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let applyToDir = getApplyDirFile();
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
+  setAppBundleModTime();
   runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
 }
 
 function checkUpdateFinished() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   standardInit();
   checkCallbackServiceLog();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js
@@ -23,16 +23,16 @@ function run_test() {
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js
@@ -23,16 +23,16 @@ function run_test() {
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(0, STATE_SUCCEEDED);
+  runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js
@@ -13,53 +13,30 @@ function run_test() {
   setupTestCommon();
   gTestFiles = gTestFilesPartialSuccess;
   gTestFiles[11].originalFile = "partial.png";
   gTestDirs = gTestDirsPartialSuccess;
   setTestFilesAndDirsForFailure();
   setupUpdaterTest(FILE_PARTIAL_MAR);
 
   createUpdaterINI();
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC,
                         STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function checkUpdateFinished() {
-  if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
-
+  checkPostUpdateRunningFile(false);
+  checkAppBundleModTime();
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_PARTIAL_FAILURE);
   standardInit();
   checkCallbackServiceLog();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js
@@ -36,17 +36,17 @@ function setupAppFilesFinished() {
 function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js
@@ -36,17 +36,17 @@ function setupAppFilesFinished() {
 function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailureCompleteSvc_win.js
@@ -37,17 +37,17 @@ function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageFailurePartialSvc_win.js
@@ -37,17 +37,17 @@ function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js
@@ -45,17 +45,17 @@ function setupAppFilesFinished() {
 function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js
@@ -45,17 +45,17 @@ function setupAppFilesFinished() {
 function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js
@@ -46,17 +46,17 @@ function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js
@@ -46,17 +46,17 @@ function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED_WRITE_ERROR_FILE_COPY);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js
@@ -47,17 +47,17 @@ function setupAppFilesFinished() {
 function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js
@@ -45,17 +45,17 @@ function setupAppFilesFinished() {
 function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
-  runUpdate(1, STATE_PENDING);
+  runUpdate(1, STATE_PENDING, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, false, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailureCompleteSvc_win.js
@@ -48,17 +48,17 @@ function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageFailurePartialSvc_win.js
@@ -46,17 +46,17 @@ function doUpdate() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   gDisableReplaceFallback = true;
-  runUpdate(1, STATE_FAILED_WRITE_ERROR);
+  runUpdate(1, STATE_FAILED_WRITE_ERROR, checkUpdateApplied);
 }
 
 function checkUpdateApplied() {
   setupHelperFinish();
 }
 
 function checkUpdate() {
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
--- a/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js
@@ -15,43 +15,27 @@ function run_test() {
   gTestFiles = gTestFilesPartialSuccess;
   gTestFiles[11].originalFile = "partial.png";
   gTestDirs = gTestDirsPartialSuccess;
   setTestFilesAndDirsForFailure();
   setupUpdaterTest(FILE_PARTIAL_MAR);
 
   createUpdaterINI(true);
 
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
-
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC,
                         STATE_FAILED_LOADSOURCE_ERROR_WRONG_SIZE);
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function checkUpdateFinished() {
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
-
+  checkPostUpdateRunningFile(false);
   checkFilesAfterUpdateFailure(getApplyDirFile, true, false);
   checkUpdateLogContents(LOG_PARTIAL_FAILURE);
   standardInit();
   waitForFilesInUse();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js
@@ -13,28 +13,28 @@ function run_test() {
   gStageUpdate = true;
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestFiles[gTestFiles.length - 1].originalContents = null;
   gTestFiles[gTestFiles.length - 1].compareContents = "FromComplete\n";
   gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
   gTestDirs = gTestDirsCompleteSuccess;
   setupUpdaterTest(FILE_COMPLETE_MAR);
+  if (IS_MACOSX) {
+    // Create files in the old distribution directory location to verify that
+    // the directory and its contents are removed when there is a distribution
+    // directory in the new location.
+    let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
+    writeFile(testFile, "test\n");
+    testFile = getApplyDirFile(DIR_MACOS + "distribution/test1/testFile", true);
+    writeFile(testFile, "test\n");
+  }
 
   createUpdaterINI(false);
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   // Don't test symlinks on Mac OS X in this test since it tends to timeout.
   // It is tested on Mac OS X in marAppInUseStageSuccessComplete_unix.js
   if (IS_UNIX && !IS_MACOSX) {
     removeSymlink();
     createSymlink();
     do_register_cleanup(removeSymlink);
     gTestFiles.splice(gTestFiles.length - 3, 0,
@@ -56,29 +56,23 @@ function run_test() {
 
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
-
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
+  checkPostUpdateRunningFile(false);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   do_timeout(TEST_CHECK_TIMEOUT, function() {
-    runUpdate(0, STATE_SUCCEEDED);
+    runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
   });
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
 function checkUpdateApplied() {
@@ -90,49 +84,43 @@ function checkUpdateApplied() {
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateApplied() {
+  checkPostUpdateRunningFile(true);
+
   if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
-  }
-
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file exists. " +
-              "Path: " + running.path);
-    do_check_true(running.exists());
+    let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
+    checkUpdateLogContains("removing old distribution directory");
   }
 
   if (IS_UNIX && !IS_MACOSX) {
     checkSymlink();
   }
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
   standardInit();
   checkCallbackAppLog();
 }
 
 function runHelperProcess(args) {
   let helperBin = getTestDirFile(FILE_HELPER_BIN);
   let process = Cc["@mozilla.org/process/util;1"].
                 createInstance(Ci.nsIProcess);
   process.init(helperBin);
   debugDump("Running " + helperBin.path + " " + args.join(" "));
   process.run(true, args, args.length);
-  do_check_eq(process.exitValue, 0);
+  Assert.equal(process.exitValue, 0,
+               "the helper process exit value should be 0");
 }
 
 function createSymlink() {
   let args = ["setup-symlink", "moz-foo", "moz-bar", "target",
               getApplyDirFile().path + "/" + DIR_RESOURCES + "link"];
   runHelperProcess(args);
   getApplyDirFile(DIR_RESOURCES + "link", false).permissions = 0o666;
   
--- a/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js
@@ -12,53 +12,47 @@ function run_test() {
 
   gStageUpdate = true;
   setupTestCommon();
   gTestFiles = gTestFilesPartialSuccess;
   gTestFiles[gTestFiles.length - 2].originalContents = null;
   gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
   gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
   gTestDirs = gTestDirsPartialSuccess;
+  preventDistributionFiles();
   setupUpdaterTest(FILE_PARTIAL_MAR);
+  if (IS_MACOSX) {
+    // Create files in the old distribution directory location to verify that
+    // the directory and its contents are moved to the new location on update.
+    let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
+    writeFile(testFile, "test\n");
+    testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
+    writeFile(testFile, "test\n");
+  }
 
   createUpdaterINI(false);
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED);
 }
 
 function checkUpdateFinished() {
   checkFilesAfterUpdateSuccess(getStageDirFile, true, false);
-  checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
-
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file doesn't " +
-              "exist. Path: " + running.path);
-    do_check_false(running.exists());
-  }
+  checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
+  checkPostUpdateRunningFile(false);
 
   // Switch the application to the staged application that was updated.
   gStageUpdate = false;
   gSwitchApp = true;
   do_timeout(TEST_CHECK_TIMEOUT, function() {
-    runUpdate(0, STATE_SUCCEEDED);
+    runUpdate(0, STATE_SUCCEEDED, checkUpdateApplied);
   });
 }
 
 /**
  * Checks if the post update binary was properly launched for the platforms that
  * support launching post update process.
  */
 function checkUpdateApplied() {
@@ -70,29 +64,36 @@ function checkUpdateApplied() {
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateApplied() {
+  checkPostUpdateRunningFile(true);
+
+  let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
   if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
+    Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
+
+    let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
+
+    testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
+
+    distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
+
+    checkUpdateLogContains("Moving old distribution directory to new location");
+  } else {
+    debugDump("testing that files aren't added with an add-if instruction " +
+              "when the file's destination directory doesn't exist");
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
-  if (IS_WIN || IS_MACOSX) {
-    let running = getPostUpdateFile(".running");
-    debugDump("checking that the post update process running file exists. " +
-              "Path: " + running.path);
-    do_check_true(running.exists());
-  }
-
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
-  checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
+  checkUpdateLogContents(LOG_PARTIAL_SUCCESS, true);
   standardInit();
   checkCallbackAppLog();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js
@@ -8,29 +8,29 @@
 function run_test() {
   if (!shouldRunServiceTest()) {
     return;
   }
 
   setupTestCommon();
   gTestFiles = gTestFilesCompleteSuccess;
   gTestDirs = gTestDirsCompleteSuccess;
+  preventDistributionFiles();
   setupUpdaterTest(FILE_COMPLETE_MAR);
+  if (IS_MACOSX) {
+    // Create files in the old distribution directory location to verify that
+    // the directory and its contents are moved to the new location on update.
+    let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
+    writeFile(testFile, "test\n");
+    testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
+    writeFile(testFile, "test\n");
+  }
 
   createUpdaterINI();
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on a successful
-  // update (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
 }
 
@@ -47,22 +47,34 @@ function checkUpdateFinished() {
   }
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateFinished() {
+  let distributionDir = getApplyDirFile(DIR_RESOURCES + "distribution", true);
   if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
+    Assert.ok(distributionDir.exists(), MSG_SHOULD_EXIST);
+
+    let testFile = getApplyDirFile(DIR_RESOURCES + "distribution/testFile", true);
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
+
+    testFile = getApplyDirFile(DIR_RESOURCES + "distribution/test/testFile", true);
+    Assert.ok(testFile.exists(), MSG_SHOULD_EXIST);
+
+    distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
+
+    checkUpdateLogContains("Moving old distribution directory to new location");
+  } else {
+    debugDump("testing that files aren't added with an add-if instruction " +
+              "when the file's destination directory doesn't exist");
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
   }
 
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
-  checkUpdateLogContents(LOG_COMPLETE_SUCCESS);
+  checkUpdateLogContents(LOG_COMPLETE_SUCCESS, true);
   standardInit();
   checkCallbackServiceLog();
 }
--- a/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js
+++ b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js
@@ -15,28 +15,28 @@ function run_test() {
   gTestFiles[gTestFiles.length - 1].originalContents = null;
   gTestFiles[gTestFiles.length - 1].compareContents = "FromPartial\n";
   gTestFiles[gTestFiles.length - 1].comparePerms = 0o644;
   gTestFiles[gTestFiles.length - 2].originalContents = null;
   gTestFiles[gTestFiles.length - 2].compareContents = "FromPartial\n";
   gTestFiles[gTestFiles.length - 2].comparePerms = 0o644;
   gTestDirs = gTestDirsPartialSuccess;
   setupUpdaterTest(FILE_PARTIAL_MAR);
+  if (IS_MACOSX) {
+    // Create files in the old distribution directory location to verify that
+    // the directory and its contents are removed when there is a distribution
+    // directory in the new location.
+    let testFile = getApplyDirFile(DIR_MACOS + "distribution/testFile", true);
+    writeFile(testFile, "test\n");
+    testFile = getApplyDirFile(DIR_MACOS + "distribution/test/testFile", true);
+    writeFile(testFile, "test\n");
+  }
 
   createUpdaterINI(true);
-
-  // For Mac OS X set the last modified time for the root directory to a date in
-  // the past to test that the last modified time is updated on all updates since
-  // the precomplete file in the root of the bundle is renamed, etc. (bug 600098).
-  if (IS_MACOSX) {
-    let now = Date.now();
-    let yesterday = now - (1000 * 60 * 60 * 24);
-    let applyToDir = getApplyDirFile();
-    applyToDir.lastModifiedTime = yesterday;
-  }
+  setAppBundleModTime();
 
   setupAppFilesAsync();
 }
 
 function setupAppFilesFinished() {
   runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED);
 }
 
@@ -54,21 +54,19 @@ function checkUpdateFinished() {
 }
 
 /**
  * Checks if the update has finished and if it has finished performs checks for
  * the test.
  */
 function finishCheckUpdateFinished() {
   if (IS_MACOSX) {
-    debugDump("testing last modified time on the apply to directory has " +
-              "changed after a successful update (bug 600098)");
-    let now = Date.now();
-    let applyToDir = getApplyDirFile();
-    let timeDiff = Math.abs(applyToDir.lastModifiedTime - now);
-    do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE);
+    let distributionDir = getApplyDirFile(DIR_MACOS + "distribution", true);
+    Assert.ok(!distributionDir.exists(), MSG_SHOULD_NOT_EXIST);
+    checkUpdateLogContains("removing old distribution directory");
   }
 
+  checkAppBundleModTime();
   checkFilesAfterUpdateSuccess(getApplyDirFile, false, false);
   checkUpdateLogContents(LOG_PARTIAL_SUCCESS);
   standardInit();
   checkCallbackServiceLog();
 }