Bug 1614860 - Use Assert methods instead of mark_failure in ex-Mozmill tests. r=mkmelin
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 13 Feb 2020 12:27:02 +0200
changeset 28754 72e16c6f960ab78cb558e949852a22de78895647
parent 28753 59a1899adf445ba3990004e9310d4934744324a3
child 28755 2e35a75dba0ae6dbb38eb335a37ff15baa1a3e0d
push id17020
push usermkmelin@iki.fi
push dateThu, 13 Feb 2020 10:29:45 +0000
treeherdercomm-central@2e35a75dba0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1614860
Bug 1614860 - Use Assert methods instead of mark_failure in ex-Mozmill tests. r=mkmelin
mail/test/browser/shared-modules/ContentTabHelpers.jsm
mail/test/browser/shared-modules/FolderDisplayHelpers.jsm
mail/test/browser/shared-modules/JunkHelpers.jsm
mail/test/browser/shared-modules/WindowHelpers.jsm
--- a/mail/test/browser/shared-modules/ContentTabHelpers.jsm
+++ b/mail/test/browser/shared-modules/ContentTabHelpers.jsm
@@ -4,24 +4,22 @@
 
 "use strict";
 
 const EXPORTED_SYMBOLS = [
   "open_content_tab_with_url",
   "open_content_tab_with_click",
   "plan_for_content_tab_load",
   "wait_for_content_tab_load",
-  "assert_content_tab_has_url",
   "assert_content_tab_has_favicon",
   "content_tab_e",
   "content_tab_eid",
   "get_content_tab_element_display",
   "assert_content_tab_element_hidden",
   "assert_content_tab_element_visible",
-  "wait_for_content_tab_element_display_value",
   "wait_for_content_tab_element_display",
   "get_element_by_text",
   "assert_content_tab_text_present",
   "assert_content_tab_text_absent",
   "NotificationWatcher",
   "get_notification_bar_for_tab",
   "get_test_plugin",
   "updateBlocklist",
@@ -41,24 +39,24 @@ var folderDisplayHelper = ChromeUtils.im
 );
 var { MockObjectReplacer } = ChromeUtils.import(
   "resource://testing-common/mozmill/MockObjectHelpers.jsm"
 );
 var wh = ChromeUtils.import(
   "resource://testing-common/mozmill/WindowHelpers.jsm"
 );
 
+var { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 var FAST_TIMEOUT = 1000;
 var FAST_INTERVAL = 100;
 var EXT_PROTOCOL_SVC_CID = "@mozilla.org/uriloader/external-protocol-service;1";
 
 var mc = folderDisplayHelper.mc;
-var mark_failure = folderDisplayHelper.mark_failure;
 
 var _originalBlocklistURL = null;
 
 var gMockExtProtSvcReg = new MockObjectReplacer(
   EXT_PROTOCOL_SVC_CID,
   MockExtProtConstructor
 );
 
@@ -281,52 +279,27 @@ function wait_for_content_tab_load(aTab,
   // The above may return immediately, meaning the event queue might not get a
   // chance. Give it a chance now.
   mc.sleep(0);
   // Finally, require that the tab's browser thinks that no page is being loaded.
   wh.wait_for_browser_load(aTab.browser, aURL);
 }
 
 /**
- * Assert that the given content tab has the given URL (string) loaded.
- */
-function assert_content_tab_has_url(aTab, aURL) {
-  if (aTab.browser.currentURI.spec != aURL) {
-    mark_failure([
-      "The tab",
-      aTab,
-      "should have URL",
-      aURL,
-      "but instead has",
-      aTab.browser.currentURI.spec,
-    ]);
-  }
-}
-
-/**
  * Gets the element with the given ID from the content tab's displayed page.
  */
 function content_tab_e(aTab, aId) {
   return aTab.browser.contentDocument.getElementById(aId);
 }
 
 /**
  * Assert that the given content tab has the given URL loaded as a favicon.
  */
 function assert_content_tab_has_favicon(aTab, aURL) {
-  if (aTab.browser.mIconURL != aURL) {
-    mark_failure([
-      "The tab",
-      aTab,
-      "should have a favicon with URL",
-      aURL,
-      "but instead has",
-      aTab.browser.mIconURL,
-    ]);
-  }
+  Assert.equal(aTab.browser.mIconURL, aURL, "Checking tab favicon");
 }
 
 /**
  * Gets the element with the given ID from the content tab's displayed page,
  * wrapped in an elib.Elem.
  */
 function content_tab_eid(aTab, aId) {
   return new elib.Elem(content_tab_e(aTab, aId));
@@ -340,78 +313,44 @@ function get_content_tab_element_display
   return style.getPropertyValue("display");
 }
 
 /**
  * Asserts that the given element is hidden from view on the page.
  */
 function assert_content_tab_element_hidden(aTab, aElem) {
   let display = get_content_tab_element_display(aTab, aElem);
-  if (display != "none") {
-    mark_failure([
-      "Element",
-      aElem,
-      "should be hidden but has display",
-      display,
-      "instead",
-    ]);
-  }
+  Assert.equal(display, "none", "Element should be hidden");
 }
 
 /**
  * Asserts that the given element is visible on the page.
  */
 function assert_content_tab_element_visible(aTab, aElem) {
   let display = get_content_tab_element_display(aTab, aElem);
-  if (display == "none") {
-    mark_failure([
-      "Element",
-      aElem,
-      "should be visible but has display",
-      display,
-      "instead",
-    ]);
-  }
-}
-
-/**
- * Waits for the element's display property to be the given value.
- */
-function wait_for_content_tab_element_display_value(aTab, aElem, aValue) {
-  function isValue() {
-    return get_content_tab_element_display(aTab, aElem) == aValue;
-  }
-  try {
-    utils.waitFor(isValue);
-  } catch (e) {
-    if (e instanceof utils.TimeoutError) {
-      mark_failure([
-        "Timeout waiting for element",
-        aElem,
-        "to have display value",
-        aValue,
-      ]);
-    } else {
-      throw e;
-    }
-  }
+  Assert.notEqual(display, "none", "Element should be visible");
 }
 
 /**
  * Waits for the element's display property indicate it is visible.
  */
 function wait_for_content_tab_element_display(aTab, aElem) {
   function isValue() {
     return get_content_tab_element_display(aTab, aElem) != "none";
   }
   try {
     utils.waitFor(isValue);
   } catch (e) {
     if (e instanceof utils.TimeoutError) {
-      mark_failure(["Timeout waiting for element", aElem, "to become visible"]);
+      Assert.report(
+        true,
+        undefined,
+        undefined,
+        "Timeout waiting for element to become visible"
+      );
     } else {
       throw e;
     }
   }
 }
 
 /**
  * Finds element in document fragment, containing only the specified text
@@ -440,30 +379,30 @@ function get_content_tab_element_by_text
   let doc = aTab.browser.contentDocument.documentElement;
   return get_element_by_text(doc, aText);
 }
 
 /**
  * Asserts that the given text is present on the content tab's page.
  */
 function assert_content_tab_text_present(aTab, aText) {
-  if (!get_content_tab_element_by_text(aTab, aText)) {
-    mark_failure([
-      'Unable to find string "' + aText + "\" on the content tab's page",
-    ]);
-  }
+  Assert.ok(
+    get_content_tab_element_by_text(aTab, aText),
+    `String "${aText}" should be on the content tab's page`
+  );
 }
 
 /**
  * Asserts that the given text is absent on the content tab's page.
  */
 function assert_content_tab_text_absent(aTab, aText) {
-  if (get_content_tab_element_by_text(aTab, aText)) {
-    mark_failure(['Found string "' + aText + "\" on the content tab's page"]);
-  }
+  Assert.ok(
+    !get_content_tab_element_by_text(aTab, aText),
+    `String "${aText}" should not be on the content tab's page`
+  );
 }
 
 /**
  * Returns the notification bar for a tab if one is currently visible,
  * null if otherwise.
  */
 function get_notification_bar_for_tab(aTab) {
   let notificationBoxEls = mc.tabmail.selectedTab.panel.querySelector(
--- a/mail/test/browser/shared-modules/FolderDisplayHelpers.jsm
+++ b/mail/test/browser/shared-modules/FolderDisplayHelpers.jsm
@@ -162,16 +162,17 @@ var frame = ChromeUtils.import("resource
 var os = ChromeUtils.import("resource://testing-common/mozmill/os.jsm");
 var utils = ChromeUtils.import("resource://testing-common/mozmill/utils.jsm");
 
 // the windowHelper module
 var windowHelper = ChromeUtils.import(
   "resource://testing-common/mozmill/WindowHelpers.jsm"
 );
 
+var { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
 var { Log4Moz } = ChromeUtils.import("resource:///modules/gloda/Log4moz.jsm");
 
 var nsMsgViewIndex_None = 0xffffffff;
 var { MailConsts } = ChromeUtils.import("resource:///modules/MailConsts.jsm");
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { MailUtils } = ChromeUtils.import("resource:///modules/MailUtils.jsm");
@@ -198,17 +199,16 @@ var testHelperModule;
 // (end pseudo-modules)
 
 var msgGen;
 
 var inboxFolder = null;
 
 // logHelper exports
 var mark_action;
-var mark_failure;
 
 // Default size of the main Thunderbird window in which the tests will run.
 var gDefaultWindowWidth = 1024;
 var gDefaultWindowHeight = 768;
 
 var initialized = false;
 function setupModule() {
   if (initialized) {
@@ -232,17 +232,16 @@ function setupModule() {
   };
 
   // -- logging
 
   // The xpcshell test resources assume they are loaded into a single global
   //  namespace, so we need to help them out to maintain their delusion.
   load_via_src_path("resources/logHelper.js", testHelperModule);
   mark_action = testHelperModule.mark_action;
-  mark_failure = testHelperModule.mark_failure;
 
   // Remove the dump appender that got appended; it just adds noise.
   testHelperModule._mailnewsTestLogger.removeAppender(
     testHelperModule._mailnewsTestLogger.ownAppenders[
       testHelperModule._mailnewsTestLogger.ownAppenders.length - 1
     ]
   );
 
@@ -354,17 +353,17 @@ function setupModule() {
   //  we need.
   mc = windowHelper.wait_for_existing_window("mail:3pane");
   windowHelper.augment_controller(mc);
 
   // Tell window-helper about the true mark_action function in order to try
   // and further complicate this horrid seven-dimensional rats' nest.
   windowHelper.hereIsMarkAction(
     mark_action,
-    mark_failure,
+    null,
     testHelperModule._normalize_for_json
   );
 
   mark_action("fdh", "startup completed", [
     mc.window.msgWindow != null
       ? "3pane looks initialized"
       : "3pane does not appear to have fully loaded yet!",
   ]);
@@ -827,90 +826,51 @@ function switch_tab(aNewTab) {
 }
 
 /**
  * Assert that the currently selected tab is the given one.
  *
  * @param aTab The tab that should currently be selected.
  */
 function assert_selected_tab(aTab) {
-  if (mc.tabmail.currentTabInfo != aTab) {
-    mark_failure([
-      "The currently selected tab should be",
-      aTab,
-      "(index: " + mc.tabmail.tabInfo.indexOf(aTab) + ") but is",
-      _jsonize_tabmail_tab(mc.tabmail.currentTabInfo),
-      "(index: " +
-        mc.tabmail.tabInfo.indexOf(mc.tabmail.currentTabInfo) +
-        ") tabs:",
-      mc.tabmail.tabInfo,
-    ]);
-  }
+  Assert.equal(mc.tabmail.currentTabInfo, aTab);
 }
 
 /**
  * Assert that the currently selected tab is _not_ the given one.
  *
  * @param aTab The tab that should currently not be selected.
  */
 function assert_not_selected_tab(aTab) {
-  if (mc.tabmail.currentTabInfo == aTab) {
-    mark_failure([
-      "The currently selected tab should not be",
-      aTab,
-      "but is. Tabs:",
-      _jsonize_tabmail_tab(mc.tabmail.tabInfo),
-    ]);
-  }
+  Assert.notEqual(mc.tabmail.currentTabInfo, aTab);
 }
 
 /**
  * Assert that the given tab has the given mode name. Valid mode names include
  * "message" and "folder".
  *
  * @param aTab A Tab. The currently selected tab if null.
  * @param aModeName A string that should match the mode name of the tab.
  */
 function assert_tab_mode_name(aTab, aModeName) {
   if (!aTab) {
     aTab = mc.tabmail.currentTabInfo;
   }
 
-  if (aTab.mode.type != aModeName) {
-    mark_failure([
-      "Tab",
-      aTab,
-      "should be of type",
-      aModeName,
-      "but is actually of type",
-      aTab.mode.type,
-      "Tabs:",
-      mc.tabmail.tabInfo,
-    ]);
-  }
+  Assert.equal(aTab.mode.type, aModeName, `Tab should be of type ${aModeName}`);
 }
 
 /**
  * Assert that the number of tabs open matches the value given.
  *
  * @param aNumber The number of tabs that should be open.
  */
 function assert_number_of_tabs_open(aNumber) {
   let actualNumber = mc.tabmail.tabContainer.allTabs.length;
-  if (actualNumber != aNumber) {
-    mark_failure([
-      "There should be " +
-        aNumber +
-        " tabs open, but there " +
-        "are actually " +
-        actualNumber +
-        " tabs open. Tabs:",
-      mc.tabmail.tabInfo,
-    ]);
-  }
+  Assert.equal(actualNumber, aNumber, `There should be ${aNumber} tabs open`);
 }
 
 /**
  * Assert that the given tab's title is based on the provided folder or
  *  message.
  *
  * @param aTab A Tab.
  * @param aWhat Either an nsIMsgFolder or an nsIMsgDBHdr
@@ -933,28 +893,17 @@ function assert_tab_titled_from(aTab, aW
 
 /**
  * Assert that the given tab's title is what is given.
  *
  * @param aTab The tab to check.
  * @param aTitle The title to check.
  */
 function assert_tab_has_title(aTab, aTitle) {
-  if (aTab.title != aTitle) {
-    mark_failure([
-      "Tab title of tab",
-      aTab,
-      "should be '" +
-        aTitle +
-        "' but is not." +
-        " (Current title: '" +
-        aTab.title +
-        "')",
-    ]);
-  }
+  Assert.equal(aTab.title, aTitle);
 }
 
 /**
  * Close a tab.  If no tab is specified, it is assumed you want to close the
  *  current tab.
  */
 function close_tab(aTabToClose) {
   mark_action("fdh", "close_tab", [aTabToClose]);
@@ -1022,21 +971,22 @@ function select_none(aController) {
   //  which is the sign that the event actually happened.
   function noMessageChecker() {
     return aController.messageDisplay.displayedMessage == null;
   }
   try {
     utils.waitFor(noMessageChecker);
   } catch (e) {
     if (e instanceof utils.TimeoutError) {
-      mark_failure([
-        "Timeout waiting for displayedMessage to become null.",
-        "Current value: ",
-        aController.messageDisplay.displayedMessage,
-      ]);
+      Assert.report(
+        true,
+        undefined,
+        undefined,
+        "Timeout waiting for displayedMessage to become null."
+      );
     } else {
       throw e;
     }
   }
   wait_for_blank_content_pane(aController);
 }
 
 /**
@@ -2050,20 +2000,24 @@ function wait_for_blank_content_pane(aCo
 
   let isBlankChecker = function() {
     return aController.window.content.location.href == "about:blank";
   };
   try {
     utils.waitFor(isBlankChecker);
   } catch (e) {
     if (e instanceof utils.TimeoutError) {
-      mark_failure([
-        "Timeout waiting for blank content pane.  Current location:",
-        aController.window.content.location.href,
-      ]);
+      Assert.report(
+        true,
+        undefined,
+        undefined,
+        `Timeout waiting for blank content pane. Current location: ${
+          aController.window.content.location.href
+        }`
+      );
     } else {
       throw e;
     }
   }
 
   // the above may return immediately, meaning the event queue might not get a
   //  chance.  give it a chance now.
   aController.sleep(0);
@@ -2096,17 +2050,22 @@ var FolderListener = {
     if (this.sawEvents) {
       return;
     }
     let self = this;
     try {
       utils.waitFor(() => self.sawEvents);
     } catch (e) {
       if (e instanceof utils.TimeoutError) {
-        mark_failure(["Timeout waiting for events:", this.watchingFor]);
+        Assert.report(
+          true,
+          undefined,
+          undefined,
+          `Timeout waiting for events: ${this.watchingFor}`
+        );
       } else {
         throw e;
       }
     }
   },
 
   OnItemEvent: function FolderNotificationHelper_OnItemEvent(aFolder, aEvent) {
     if (!this.watchingFor) {
@@ -2165,24 +2124,21 @@ function assert_messages_in_view(aSynSet
 function assert_messages_not_in_view(aMessages, aController) {
   if (aController == null) {
     aController = mc;
   }
   if (aMessages instanceof Ci.nsIMsgDBHdr) {
     aMessages = [aMessages];
   }
   for (let msgHdr of aMessages) {
-    if (mc.dbView.findIndexOfMsgHdr(msgHdr, true) != nsMsgViewIndex_None) {
-      mark_failure([
-        "Message header is present in view but should not be:",
-        msgHdr,
-        "index:",
-        mc.dbView.findIndexOfMsgHdr(msgHdr, true),
-      ]);
-    }
+    Assert.equal(
+      mc.dbView.findIndexOfMsgHdr(msgHdr, true),
+      nsMsgViewIndex_None,
+      `Message header is present in view but should not be`
+    );
   }
 }
 var assert_message_not_in_view = assert_messages_not_in_view;
 
 /**
  * When displaying a folder, assert that the message pane is visible and all the
  *  menus, splitters, etc. are set up right.
  */
@@ -2388,25 +2344,17 @@ function _process_row_message_arguments(
  */
 function assert_selected(...aArgs) {
   let [troller, desiredIndices] = _process_row_message_arguments(...aArgs);
 
   // - get the actual selection (already sorted by integer value)
   let selectedIndices = troller.folderDisplay.selectedIndices;
   // - test selection equivalence
   // which is the same as string equivalence in this case. muah hah hah.
-  if (desiredIndices.toString() != selectedIndices.toString()) {
-    mark_failure([
-      "Desired selection is:",
-      desiredIndices,
-      "but actual selection is: ",
-      selectedIndices,
-    ]);
-  }
-
+  Assert.equal(desiredIndices.toString(), selectedIndices.toString());
   return [troller, desiredIndices];
 }
 
 /**
  * Assert that the given set of messages is displayed, but not necessarily
  *  selected.  Unless you are dealing with transient selection issues or some
  *  other situation where the FolderDisplay should not be correlated with the
  *  MessageDisplay, you really should be using assert_selected_and_displayed.
@@ -3039,24 +2987,17 @@ var assert_folder_selected = assert_fold
  * - An nsIMsgFolder.
  * - A list of nsIMsgFolders.
  *
  * In each case, since we can only have one folder displayed, we only look at
  * the first folder you pass in.
  */
 function assert_folder_displayed(...aArgs) {
   let [troller, desiredFolders] = _process_row_folder_arguments(...aArgs);
-  if (troller.folderDisplay.displayedFolder != desiredFolders[0]) {
-    mark_failure([
-      "The displayed folder should be",
-      desiredFolders[0],
-      "but is actually",
-      troller.folderDisplay.displayedFolder,
-    ]);
-  }
+  Assert.equal(troller.folderDisplay.displayedFolder, desiredFolders[0]);
 }
 
 /**
  * Asserts that the folders corresponding to the one or more folder spec
  * arguments are selected and displayed. If you specify multiple folders,
  * we verify that all of them are selected and that the first folder you pass
  * in is the one displayed. (If you don't pass in any folders, we can't assume
  * anything, so we don't test that case.)
@@ -3067,24 +3008,17 @@ function assert_folder_displayed(...aArg
  * - An integer identifying a view index.
  * - A list containing two integers, indicating a range of view indices.
  * - An nsIMsgFolder.
  * - A list of nsIMsgFolders.
  */
 function assert_folders_selected_and_displayed(...aArgs) {
   let [troller, desiredFolders] = assert_folders_selected(...aArgs);
   if (desiredFolders.length > 0) {
-    if (troller.folderDisplay.displayedFolder != desiredFolders[0]) {
-      mark_failure([
-        "The displayed folder should be",
-        desiredFolders[0],
-        "but is actually",
-        troller.folderDisplay.displayedFolder,
-      ]);
-    }
+    Assert.equal(troller.folderDisplay.displayedFolder, desiredFolders[0]);
   }
 }
 
 var assert_no_folders_selected = assert_folders_selected_and_displayed;
 var assert_folder_selected_and_displayed = assert_folders_selected_and_displayed;
 
 /**
  * Assert that there are the given number of rows (not including children of
--- a/mail/test/browser/shared-modules/JunkHelpers.jsm
+++ b/mail/test/browser/shared-modules/JunkHelpers.jsm
@@ -12,18 +12,20 @@ const EXPORTED_SYMBOLS = [
 var elib = ChromeUtils.import(
   "resource://testing-common/mozmill/elementslib.jsm"
 );
 var utils = ChromeUtils.import("resource://testing-common/mozmill/utils.jsm");
 
 var folderDisplayHelper = ChromeUtils.import(
   "resource://testing-common/mozmill/FolderDisplayHelpers.jsm"
 );
+
+var { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
+
 var mc = folderDisplayHelper.mc;
-var mark_failure = folderDisplayHelper.mark_failure;
 
 /**
  * Mark the selected messages as junk. This is done by pressing the J key.
  *
  * @param aController The controller in whose context to do this, defaults to
  *     |mc| if omitted.
  */
 function mark_selected_messages_as_junk(aController) {
@@ -125,21 +127,17 @@ function delete_mail_marked_as_junk(aNum
     utils.waitFor(
       () => numMessagesDeleted != null,
       "Timeout waiting for numMessagesDeleted to turn " +
         "non-null. This either means that deleteJunkInFolder " +
         "didn't get called or that it didn't return a value."
     );
 
     // Check the number of deleted messages.
-    if (aNumDeletesExpected != numMessagesDeleted) {
-      mark_failure([
-        "Expected",
-        aNumDeletesExpected,
-        "deletes, but",
-        numMessagesDeleted,
-        "happened",
-      ]);
-    }
+    Assert.equal(
+      aNumDeletesExpected,
+      numMessagesDeleted,
+      `Expected ${aNumDeletesExpected} deletes`
+    );
   } finally {
     aController.window.deleteJunkInFolder = realDeleteJunkInFolder;
   }
 }
--- a/mail/test/browser/shared-modules/WindowHelpers.jsm
+++ b/mail/test/browser/shared-modules/WindowHelpers.jsm
@@ -23,28 +23,29 @@ const EXPORTED_SYMBOLS = [
   "wait_for_browser_load",
   "wait_for_frame_load",
   "plan_for_observable_event",
   "wait_for_observable_event",
   "resize_to",
   "augment_controller",
 ];
 
-var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
-
 var controller = ChromeUtils.import(
   "resource://testing-common/mozmill/controller.jsm"
 );
 var elib = ChromeUtils.import(
   "resource://testing-common/mozmill/elementslib.jsm"
 );
 var frame = ChromeUtils.import("resource://testing-common/mozmill/frame.jsm");
 var utils = ChromeUtils.import("resource://testing-common/mozmill/utils.jsm");
 
+var { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
+var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 /**
  * Timeout to use when waiting for the first window ever to load.  This is
  *  long because we are basically waiting for the entire app startup process.
  */
 var FIRST_WINDOW_EVER_TIMEOUT_MS = 30000;
 /**
  * Interval to check if the window has shown up for the first window ever to
  *  load.  The check interval is longer because it's less likely the window
@@ -73,29 +74,27 @@ var WINDOW_CLOSE_CHECK_INTERVAL_MS = 100
 /**
  * Timeout for focusing a window.  Only really an issue on linux.
  */
 var WINDOW_FOCUS_TIMEOUT_MS = 10000;
 
 // Have a dummy mark_action function in case test-folder-display-helpers does
 // not provide us with one.
 var mark_action = function dummy_mark_action() {};
-var mark_failure = function dummy_mark_failure() {};
 var normalize_for_json = function dummy_normalize_for_json() {};
 /**
  * This is used by test-folder-display-helpers to provide us with a reference
  * to logHelper's mark_action because of ugliness in the module system.
  */
 function hereIsMarkAction(
   mark_action_impl,
   mark_failure_impl,
   normalize_for_json_impl
 ) {
   mark_action = mark_action_impl;
-  mark_failure = mark_failure_impl;
   normalize_for_json = normalize_for_json_impl;
 }
 
 function getWindowTypeOrId(aWindowElem) {
   let windowType = aWindowElem.getAttribute("windowtype");
   // Ignore types that start with "prompt:". This prefix gets added in
   // toolkit/components/prompts/src/CommonDialog.jsm since bug 1388238.
   if (windowType && !windowType.startsWith("prompt:")) {
@@ -817,20 +816,24 @@ function _wait_for_generic_load(aDetails
 
     return predicate(aDetails.currentURI);
   }
 
   try {
     utils.waitFor(isLoadedChecker);
   } catch (e) {
     if (e instanceof utils.TimeoutError) {
-      mark_failure([
-        "Timeout waiting for content page to load. Current URL is:",
-        aDetails.currentURI.spec,
-      ]);
+      Assert.report(
+        true,
+        undefined,
+        undefined,
+        `Timeout waiting for content page to load. Current URL is: ${
+          aDetails.currentURI.spec
+        }`
+      );
     } else {
       throw e;
     }
   }
 
   // Lie to mozmill to convince it to not explode because these frames never
   // get a mozmillDocumentLoaded attribute (bug 666438).
   let contentWindow = aDetails.contentWindow;