Bug 1571656 - Use Assert.jsm numeric comparison functions in tests r=mixedpuppy,MattN
authorMoritz Birghan <mbirghan@mozilla.com>
Mon, 18 Nov 2019 13:03:58 +0000
changeset 502409 edb4de0b8fdc194a95c837eaec8bc53b1df1a08d
parent 502408 6ddf558231ebee00b3b0828d343e7115c4e975f7
child 502410 83096c9e152d28d7cdda1542eb6bf3452f739da0
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy, MattN
bugs1571656
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1571656 - Use Assert.jsm numeric comparison functions in tests r=mixedpuppy,MattN Differential Revision: https://phabricator.services.mozilla.com/D40614
browser/components/places/tests/browser/browser_bookmarkProperties_bookmarkAllTabs.js
browser/components/places/tests/browser/browser_library_commands.js
browser/components/places/tests/browser/browser_toolbar_overflow.js
browser/components/urlbar/tests/browser/browser_restoreEmptyInput.js
browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
dom/tests/browser/perfmetrics/browser_test_performance_metrics.js
extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js
intl/locale/tests/unit/test_osPreferences.js
js/xpconnect/tests/unit/test_watchdog_hibernate.js
netwerk/test/httpserver/test/test_async_response_sending.js
services/sync/tests/unit/test_addons_store.js
toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js
toolkit/components/places/tests/bookmarks/test_bookmarks_update.js
toolkit/components/places/tests/migration/test_current_from_downgraded.js
toolkit/components/places/tests/queries/test_bookmarks.js
toolkit/components/places/tests/unifiedcomplete/test_autofill_origins.js
toolkit/modules/tests/xpcshell/test_NewTabUtils.js
toolkit/modules/tests/xpcshell/test_timer.js
toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js
widget/tests/browser/browser_test_procinfo.js
widget/tests/unit/test_macsharingservice.js
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_bookmarkAllTabs.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_bookmarkAllTabs.js
@@ -33,16 +33,16 @@ add_task(async function() {
         "onItemChanged",
         (id, prop, isAnno, val) => prop == "title" && val == "folder"
       );
       fillBookmarkTextField("editBMPanel_namePicker", "folder", dialog);
       await promiseTitleChange;
     },
     dialog => {
       let savedItemId = dialog.gEditItemOverlay.itemId;
-      Assert.ok(savedItemId > 0, "Found the itemId");
+      Assert.greater(savedItemId, 0, "Found the itemId");
       return PlacesTestUtils.waitForNotification(
         "onItemRemoved",
         id => id === savedItemId
       );
     }
   );
 });
--- a/browser/components/places/tests/browser/browser_library_commands.js
+++ b/browser/components/places/tests/browser/browser_library_commands.js
@@ -140,17 +140,17 @@ add_task(async function test_query_on_to
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "place:sort=4",
     title: "special_query",
     parentGuid: PlacesUtils.bookmarks.toolbarGuid,
     index: 0,
   });
 
   // Get first child and check it is the just inserted query.
-  Assert.ok(toolbarNode.childCount > 0, "Toolbar node has children");
+  Assert.greater(toolbarNode.childCount, 0, "Toolbar node has children");
   let queryNode = toolbarNode.getChild(0);
   Assert.equal(
     queryNode.title,
     "special_query",
     "Query node is correctly selected"
   );
 
   // Select query node.
--- a/browser/components/places/tests/browser/browser_toolbar_overflow.js
+++ b/browser/components/places/tests/browser/browser_toolbar_overflow.js
@@ -127,17 +127,17 @@ add_task(async function test_separator_f
   promiseReady = BrowserTestUtils.waitForEvent(
     gToolbar,
     "BookmarksToolbarVisibilityUpdated"
   );
   await promiseSetToolbarVisibility(gToolbar, true);
   await promiseReady;
 
   let children = gToolbarContent.children;
-  Assert.ok(children.length > 2, "Multiple elements are visible");
+  Assert.greater(children.length, 2, "Multiple elements are visible");
   Assert.equal(
     children[1]._placesNode.uri,
     "http://test.places.0/",
     "Found the first bookmark"
   );
   Assert.equal(
     children[1].style.visibility,
     "visible",
--- a/browser/components/urlbar/tests/browser/browser_restoreEmptyInput.js
+++ b/browser/components/urlbar/tests/browser/browser_restoreEmptyInput.js
@@ -16,17 +16,17 @@ add_task(async function test() {
 
   Assert.equal(
     UrlbarTestUtils.getSelectedRowIndex(window),
     -1,
     "Nothing selected"
   );
 
   let resultCount = UrlbarTestUtils.getResultCount(window);
-  Assert.ok(resultCount > 0, "At least one result");
+  Assert.greater(resultCount, 0, "At least one result");
 
   for (let i = 0; i < resultCount; i++) {
     EventUtils.synthesizeKey("KEY_ArrowDown");
   }
   Assert.equal(
     UrlbarTestUtils.getSelectedRowIndex(window),
     resultCount - 1,
     "Last result selected"
--- a/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
+++ b/browser/modules/test/browser/browser_UnsubmittedCrashHandler.js
@@ -570,17 +570,17 @@ add_task(async function test_shutdown_wh
  * browser.crashReports.unsubmittedCheck.shutdownWhileShowing is
  * set and the lastShownDate is today, then we don't decrement
  * browser.crashReports.unsubmittedCheck.chancesUntilSuppress.
  */
 add_task(async function test_dont_decrement_chances_on_same_day() {
   let initChances = UnsubmittedCrashHandler.prefs.getIntPref(
     "chancesUntilSuppress"
   );
-  Assert.ok(initChances > 1, "We should start with at least 1 chance.");
+  Assert.greater(initChances, 1, "We should start with at least 1 chance.");
 
   await createPendingCrashReports(1);
   let notification = await UnsubmittedCrashHandler.checkForUnsubmittedCrashReports();
   Assert.ok(notification, "There should be a notification");
 
   UnsubmittedCrashHandler.uninit();
 
   gNotificationBox.removeNotification(notification, true);
@@ -620,17 +620,17 @@ add_task(async function test_dont_decrem
  * browser.crashReports.unsubmittedCheck.shutdownWhileShowing is
  * set and the lastShownDate is before today, then we decrement
  * browser.crashReports.unsubmittedCheck.chancesUntilSuppress.
  */
 add_task(async function test_decrement_chances_on_other_day() {
   let initChances = UnsubmittedCrashHandler.prefs.getIntPref(
     "chancesUntilSuppress"
   );
-  Assert.ok(initChances > 1, "We should start with at least 1 chance.");
+  Assert.greater(initChances, 1, "We should start with at least 1 chance.");
 
   await createPendingCrashReports(1);
   let notification = await UnsubmittedCrashHandler.checkForUnsubmittedCrashReports();
   Assert.ok(notification, "There should be a notification");
 
   UnsubmittedCrashHandler.uninit();
 
   gNotificationBox.removeNotification(notification, true);
--- a/dom/tests/browser/perfmetrics/browser_test_performance_metrics.js
+++ b/dom/tests/browser/perfmetrics/browser_test_performance_metrics.js
@@ -143,24 +143,24 @@ add_task(async function test() {
           }
         }
       }
 
       // get all metrics via the promise
       let results = await ChromeUtils.requestPerformanceMetrics();
       exploreResults(results);
 
-      Assert.ok(workerDuration > 0, "Worker duration should be positive");
-      Assert.ok(workerTotal > 0, "Worker count should be positive");
-      Assert.ok(duration > 0, "Duration should be positive");
-      Assert.ok(total > 0, "Should get a positive count");
+      Assert.greater(workerDuration, 0, "Worker duration should be positive");
+      Assert.greater(workerTotal, 0, "Worker count should be positive");
+      Assert.greater(duration, 0, "Duration should be positive");
+      Assert.greater(total, 0, "Should get a positive count");
       Assert.ok(parentProcessEvent, "parent process sent back some events");
       Assert.ok(isTopLevel, "example.com as a top level window");
       Assert.ok(aboutMemoryFound, "about:memory");
-      Assert.ok(heapUsage > 0, "got some memory value reported");
+      Assert.greater(heapUsage, 0, "got some memory value reported");
       Assert.ok(sharedWorker, "We got some info from a shared worker");
       let numCounters = counterIds.length;
       Assert.ok(
         numCounters > 5,
         "This test generated at least " + numCounters + " unique counters"
       );
 
       // checking that subframes are not orphans
@@ -180,51 +180,51 @@ add_task(async function test() {
       Assert.ok(
         workerDuration > previousWorkerDuration,
         "Worker duration should be positive"
       );
       Assert.ok(
         workerTotal > previousWorkerTotal,
         "Worker count should be positive"
       );
-      Assert.ok(duration > previousDuration, "Duration should be positive");
-      Assert.ok(total > previousTotal, "Should get a positive count");
+      Assert.greater(duration, previousDuration, "Duration should be positive");
+      Assert.greater(total, previousTotal, "Should get a positive count");
 
       // load a tab with a setInterval, we should get counters on TaskCategory::Timer
       await BrowserTestUtils.withNewTab(
         { gBrowser, url: INTERVAL_URL },
         async function(browser) {
           let tabId = gBrowser.selectedBrowser.outerWindowID;
           let previousTimerCalls = timerCalls;
           results = await ChromeUtils.requestPerformanceMetrics();
           exploreResults(results, tabId);
-          Assert.ok(timerCalls > previousTimerCalls, "Got timer calls");
+          Assert.greater(timerCalls, previousTimerCalls, "Got timer calls");
         }
       );
 
       // load a tab with a setTimeout, we should get counters on TaskCategory::Timer
       await BrowserTestUtils.withNewTab(
         { gBrowser, url: TIMEOUT_URL },
         async function(browser) {
           let tabId = gBrowser.selectedBrowser.outerWindowID;
           let previousTimerCalls = timerCalls;
           results = await ChromeUtils.requestPerformanceMetrics();
           exploreResults(results, tabId);
-          Assert.ok(timerCalls > previousTimerCalls, "Got timer calls");
+          Assert.greater(timerCalls, previousTimerCalls, "Got timer calls");
         }
       );
 
       // load a tab with a sound
       await BrowserTestUtils.withNewTab(
         { gBrowser, url: SOUND_URL },
         async function(browser) {
           let tabId = gBrowser.selectedBrowser.outerWindowID;
           results = await ChromeUtils.requestPerformanceMetrics();
           exploreResults(results, tabId);
-          Assert.ok(mediaMemory > 0, "Got some memory used for media");
+          Assert.greater(mediaMemory, 0, "Got some memory used for media");
         }
       );
     }
   );
 
   BrowserTestUtils.removeTab(page1);
   BrowserTestUtils.removeTab(page2);
   BrowserTestUtils.removeTab(page3);
--- a/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js
+++ b/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js
@@ -239,17 +239,21 @@ function run_test() {
   );
   let numMigrated = 0;
   while (select.executeStep()) {
     let thisModTime = select.getInt64(0);
     Assert.ok(thisModTime == 0, "new modifiedTime field is correct");
     numMigrated += 1;
   }
   // check we found at least 1 record that was migrated.
-  Assert.ok(numMigrated > 0, "we found at least 1 record that was migrated");
+  Assert.greater(
+    numMigrated,
+    0,
+    "we found at least 1 record that was migrated"
+  );
 
   // This permission should always be there.
   let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
     Ci.nsIScriptSecurityManager
   );
   let uri = NetUtil.newURI("http://example.org");
   let principal = ssm.createContentPrincipal(uri, {});
   Assert.equal(
--- a/intl/locale/tests/unit/test_osPreferences.js
+++ b/intl/locale/tests/unit/test_osPreferences.js
@@ -28,14 +28,14 @@ function run_test()
   ];
 
   for (let i = 0; i < getDateTimePatternTests.length; i++) {
     const test = getDateTimePatternTests[i];
 
     const pattern = osprefs.getDateTimePattern(...test);
     if (test[0] !== osprefs.dateTimeFormatStyleNone &&
         test[1] !== osprefs.dateTImeFormatStyleNone) {
-      Assert.ok(pattern.length > 0, "pattern is not empty.");
+      Assert.greater(pattern.length, 0, "pattern is not empty.");
     }
   }
 
   Assert.ok(1, "osprefs didn't crash");
 }
--- a/js/xpconnect/tests/unit/test_watchdog_hibernate.js
+++ b/js/xpconnect/tests/unit/test_watchdog_hibernate.js
@@ -10,18 +10,18 @@ async function testBody() {
   // default to 0, so this should always be true.
   var now = Date.now() * 1000;
   var startHibernation = Cu.getWatchdogTimestamp("WatchdogHibernateStart");
   var stopHibernation = Cu.getWatchdogTimestamp("WatchdogHibernateStop");
   do_log_info("Pre-hibernation statistics:");
   do_log_info("now: " + now / 1000000);
   do_log_info("startHibernation: " + startHibernation / 1000000);
   do_log_info("stopHibernation: " + stopHibernation / 1000000);
-  Assert.ok(startHibernation < now, "startHibernation ok");
-  Assert.ok(stopHibernation < now, "stopHibernation ok");
+  Assert.less(startHibernation, now, "startHibernation ok");
+  Assert.less(stopHibernation, now, "stopHibernation ok");
 
   // When the watchdog runs, it hibernates if there's been no activity for the
   // last 2 seconds, otherwise it sleeps for 1 second. As such, given perfect
   // scheduling, we should never have more than 3 seconds of inactivity without
   // hibernating. To add some padding for automation, we mandate that hibernation
   // must begin between 2 and 5 seconds from now.
 
   // Sleep for 10 seconds. Note: we don't use nsITimer here because then we may run
@@ -37,13 +37,13 @@ async function testBody() {
   do_log_info("startHibernation: " + startHibernation / 1000000);
   do_log_info("stopHibernation: " + stopHibernation / 1000000);
   // XPCOM timers, JS times, and PR_Now() are apparently not directly
   // comparable, as evidenced by certain seemingly-impossible timing values
   // that occasionally get logged in windows automation. We're really just
   // making sure this behavior is roughly as expected on the macro scale,
   // so we add a 1 second fuzz factor here.
   const FUZZ_FACTOR = 1 * 1000 * 1000;
-  Assert.ok(stateChange > now + 10*1000*1000 - FUZZ_FACTOR, "stateChange ok");
-  Assert.ok(startHibernation > now + 2*1000*1000 - FUZZ_FACTOR, "startHibernation ok");
-  Assert.ok(startHibernation < now + 5*1000*1000 + FUZZ_FACTOR, "startHibernation ok");
-  Assert.ok(stopHibernation > now + 10*1000*1000 - FUZZ_FACTOR, "stopHibernation ok");
+  Assert.greater(stateChange, now + 10*1000*1000 - FUZZ_FACTOR, "stateChange ok");
+  Assert.greater(startHibernation, now + 2*1000*1000 - FUZZ_FACTOR, "startHibernation ok");
+  Assert.less(startHibernation, now + 5*1000*1000 + FUZZ_FACTOR, "startHibernation ok");
+  Assert.greater(stopHibernation, now + 10*1000*1000 - FUZZ_FACTOR, "stopHibernation ok");
 }
--- a/netwerk/test/httpserver/test/test_async_response_sending.js
+++ b/netwerk/test/httpserver/test/test_async_response_sending.js
@@ -996,17 +996,17 @@ function CustomPipe(name) {
         "*** [" +
           this.name +
           "].makeWritableByIncrements" +
           "([" +
           increments.join(", ") +
           "])"
       );
 
-      Assert.ok(increments.length > 0, "bad increments");
+      Assert.greater(increments.length, 0, "bad increments");
       Assert.ok(
         increments.every(function(v) {
           return v > 0;
         }),
         "zero increment?"
       );
 
       Assert.ok(Components.isSuccessCode(self._status));
--- a/services/sync/tests/unit/test_addons_store.js
+++ b/services/sync/tests/unit/test_addons_store.js
@@ -606,17 +606,17 @@ add_task(async function test_ignore_syst
   await engine._refreshReconcilerState();
   let num = 0;
   let ids = await store.getAllIDs();
   for (let guid in ids) {
     num += 1;
     let addon = reconciler.getAddonStateFromSyncGUID(guid);
     Assert.notEqual(addon.id, SYSTEM_ADDON_ID);
   }
-  Assert.ok(num > 1, "should have seen at least one.");
+  Assert.greater(num, 1, "should have seen at least one.");
 });
 
 add_task(async function test_incoming_system() {
   _("Ensure we handle incoming records that refer to a system addon");
   // eg, loop initially had a normal addon but it was then "promoted" to be a
   // system addon but wanted to keep the same ID. The server record exists due
   // to this.
 
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js
@@ -377,17 +377,17 @@ add_task(async function create_bookmark_
     parentGuid: PlacesUtils.bookmarks.unfiledGuid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "http://example.com/",
     title: "a bookmark",
   });
   checkBookmarkObject(bm);
 
   await PlacesTestUtils.promiseAsyncUpdates();
-  Assert.ok(frecencyForUrl(bm.url) > 0, "Check frecency has been updated");
+  Assert.greater(frecencyForUrl(bm.url), 0, "Check frecency has been updated");
 });
 
 add_task(async function create_bookmark_without_type() {
   let bm = await PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.unfiledGuid,
     url: "http://example.com/",
     title: "a bookmark",
   });
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_update.js
@@ -303,17 +303,17 @@ add_task(async function update_url() {
     parentGuid: PlacesUtils.bookmarks.unfiledGuid,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     url: "http://example.com/",
     title: "title",
   });
   checkBookmarkObject(bm);
   let lastModified = bm.lastModified;
   let frecency = frecencyForUrl(bm.url);
-  Assert.ok(frecency > 0, "Check frecency has been updated");
+  Assert.greater(frecency, 0, "Check frecency has been updated");
 
   bm = await PlacesUtils.bookmarks.update({
     guid: bm.guid,
     url: "http://mozilla.org/",
   });
   checkBookmarkObject(bm);
   Assert.ok(bm.lastModified >= lastModified);
   Assert.equal(bm.url.href, "http://mozilla.org/");
--- a/toolkit/components/places/tests/migration/test_current_from_downgraded.js
+++ b/toolkit/components/places/tests/migration/test_current_from_downgraded.js
@@ -8,17 +8,17 @@ add_task(async function setup() {
   while (version > 0) {
     let dbFile = OS.Path.join(do_get_cwd().path, `places_v${version}.sqlite`);
     if (await OS.File.exists(dbFile)) {
       info("Using database version " + version);
       break;
     }
     version--;
   }
-  Assert.ok(version > 0, "Found a valid database version");
+  Assert.greater(version, 0, "Found a valid database version");
   await setupPlacesDatabase(`places_v${version}.sqlite`);
   // Downgrade the schema version to the first supported one.
   let path = OS.Path.join(OS.Constants.Path.profileDir, DB_FILENAME);
   let db = await Sqlite.openConnection({ path });
   await db.setSchemaVersion(FIRST_UPGRADABLE_SCHEMA_VERSION);
   await db.close();
 });
 
--- a/toolkit/components/places/tests/queries/test_bookmarks.js
+++ b/toolkit/components/places/tests/queries/test_bookmarks.js
@@ -28,17 +28,17 @@ add_task(async function test_eraseEveryt
   Assert.ok(folder.dateAdded > 0);
   Assert.equal(typeof folder.lastModified, "number");
   Assert.ok(folder.lastModified > 0);
 
   let root = PlacesUtils.getFolderContents(folder.bookmarkGuid).root;
   Assert.equal(root.childCount, 4, "The folder should have 4 children");
   for (let i = 0; i < root.childCount; ++i) {
     let node = root.getChild(i);
-    Assert.ok(node.itemId > 0, "The node should have an itemId");
+    Assert.greater(node.itemId, 0, "The node should have an itemId");
   }
   Assert.equal(root.getChild(0).title, "title 1");
   Assert.equal(root.getChild(1).title, "title 2");
   await PlacesUtils.bookmarks.eraseEverything();
   Assert.equal(unfiled.childCount, 0);
   unfiled.containerOpen = false;
 });
 
--- a/toolkit/components/places/tests/unifiedcomplete/test_autofill_origins.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_autofill_origins.js
@@ -275,24 +275,24 @@ add_task(async function groupByHost() {
     { uri: "https://mozilla.org/" },
     { uri: "https://mozilla.org/" },
     { uri: "https://mozilla.org/" },
   ]);
 
   let httpFrec = frecencyForUrl("http://example.com/");
   let httpsFrec = frecencyForUrl("https://example.com/");
   let otherFrec = frecencyForUrl("https://mozilla.org/");
-  Assert.ok(httpFrec < httpsFrec, "Sanity check");
-  Assert.ok(httpsFrec < otherFrec, "Sanity check");
+  Assert.less(httpFrec, httpsFrec, "Sanity check");
+  Assert.less(httpsFrec, otherFrec, "Sanity check");
 
   // Make sure the frecencies of the three origins are as expected in relation
   // to the threshold.
   let threshold = await getOriginAutofillThreshold();
-  Assert.ok(httpFrec < threshold, "http origin should be < threshold");
-  Assert.ok(httpsFrec < threshold, "https origin should be < threshold");
+  Assert.less(httpFrec, threshold, "http origin should be < threshold");
+  Assert.less(httpsFrec, threshold, "https origin should be < threshold");
   Assert.ok(threshold <= otherFrec, "Other origin should cross threshold");
 
   Assert.ok(
     threshold <= httpFrec + httpsFrec,
     "http and https origin added together should cross threshold"
   );
 
   // The https origin should be autofilled.
@@ -344,24 +344,24 @@ add_task(async function groupByHostNonDe
     { uri: "https://mozilla.org/" },
     { uri: "https://mozilla.org/" },
     { uri: "https://mozilla.org/" },
   ]);
 
   let httpFrec = frecencyForUrl("http://example.com/");
   let httpsFrec = frecencyForUrl("https://example.com/");
   let otherFrec = frecencyForUrl("https://mozilla.org/");
-  Assert.ok(httpFrec < httpsFrec, "Sanity check");
-  Assert.ok(httpsFrec < otherFrec, "Sanity check");
+  Assert.less(httpFrec, httpsFrec, "Sanity check");
+  Assert.less(httpsFrec, otherFrec, "Sanity check");
 
   // Make sure the frecencies of the three origins are as expected in relation
   // to the threshold.
   let threshold = await getOriginAutofillThreshold();
-  Assert.ok(httpFrec < threshold, "http origin should be < threshold");
-  Assert.ok(httpsFrec < threshold, "https origin should be < threshold");
+  Assert.less(httpFrec, threshold, "http origin should be < threshold");
+  Assert.less(httpsFrec, threshold, "https origin should be < threshold");
   Assert.ok(threshold <= otherFrec, "Other origin should cross threshold");
 
   Assert.ok(
     threshold <= httpFrec + httpsFrec,
     "http and https origin added together should cross threshold"
   );
 
   // The https origin should be autofilled.
--- a/toolkit/modules/tests/xpcshell/test_NewTabUtils.js
+++ b/toolkit/modules/tests/xpcshell/test_NewTabUtils.js
@@ -1048,17 +1048,17 @@ add_task(async function getTopFrencentSi
     await PlacesTestUtils.addVisits(testURI);
   }
 
   let links = await provider.getTopSites({ topsiteFrecency: 100 });
   Assert.ok(
     links.length < MANY_LINKS,
     "query default limited to less than many"
   );
-  Assert.ok(links.length > 6, "query default to more than visible count");
+  Assert.greater(links.length, 6, "query default to more than visible count");
 });
 
 add_task(async function getTopFrencentSites_allowedProtocols() {
   await setUpActivityStreamTest();
 
   let provider = NewTabUtils.activityStreamLinks;
 
   // add a visit from a file:// site
--- a/toolkit/modules/tests/xpcshell/test_timer.js
+++ b/toolkit/modules/tests/xpcshell/test_timer.js
@@ -9,17 +9,17 @@ var imported = {};
 ChromeUtils.import("resource://gre/modules/Timer.jsm", imported);
 
 add_task(async function test_setTimeout() {
   let timeout1 = imported.setTimeout(
     () => do_throw("Should not be called"),
     100
   );
   Assert.equal(typeof timeout1, "number", "setTimeout returns a number");
-  Assert.ok(timeout1 > 0, "setTimeout returns a positive number");
+  Assert.greater(timeout1, 0, "setTimeout returns a positive number");
 
   imported.clearTimeout(timeout1);
 
   await new Promise(resolve => {
     let timeout2 = imported.setTimeout(
       (param1, param2) => {
         Assert.ok(true, "Should be called");
         Assert.equal(param1, 5, "first parameter is correct");
@@ -27,34 +27,34 @@ add_task(async function test_setTimeout(
         resolve();
       },
       100,
       5,
       "test"
     );
 
     Assert.equal(typeof timeout2, "number", "setTimeout returns a number");
-    Assert.ok(timeout2 > 0, "setTimeout returns a positive number");
+    Assert.greater(timeout2, 0, "setTimeout returns a positive number");
     Assert.notEqual(
       timeout1,
       timeout2,
       "Calling setTimeout again returns a different value"
     );
   });
 });
 
 add_task(async function test_setTimeoutWithTarget() {
   let target = Services.systemGroupEventTarget;
   let timeout1 = imported.setTimeoutWithTarget(
     () => do_throw("Should not be called"),
     100,
     target
   );
   Assert.equal(typeof timeout1, "number", "setTimeout returns a number");
-  Assert.ok(timeout1 > 0, "setTimeout returns a positive number");
+  Assert.greater(timeout1, 0, "setTimeout returns a positive number");
 
   imported.clearTimeout(timeout1);
 
   await new Promise(resolve => {
     let timeout2 = imported.setTimeoutWithTarget(
       (param1, param2) => {
         Assert.ok(true, "Should be called");
         Assert.equal(param1, 5, "first parameter is correct");
@@ -63,32 +63,32 @@ add_task(async function test_setTimeoutW
       },
       100,
       target,
       5,
       "test"
     );
 
     Assert.equal(typeof timeout2, "number", "setTimeout returns a number");
-    Assert.ok(timeout2 > 0, "setTimeout returns a positive number");
+    Assert.greater(timeout2, 0, "setTimeout returns a positive number");
     Assert.notEqual(
       timeout1,
       timeout2,
       "Calling setTimeout again returns a different value"
     );
   });
 });
 
 add_task(async function test_setInterval() {
   let interval1 = imported.setInterval(
     () => do_throw("Should not be called!"),
     100
   );
   Assert.equal(typeof interval1, "number", "setInterval returns a number");
-  Assert.ok(interval1 > 0, "setTimeout returns a positive number");
+  Assert.greater(interval1, 0, "setTimeout returns a positive number");
 
   imported.clearInterval(interval1);
 
   const EXPECTED_CALLS = 5;
   let calls = 0;
 
   await new Promise(resolve => {
     let interval2 = imported.setInterval(
@@ -112,17 +112,17 @@ add_task(async function test_setInterval
 add_task(async function test_setIntervalWithTarget() {
   let target = Services.systemGroupEventTarget;
   let interval1 = imported.setIntervalWithTarget(
     () => do_throw("Should not be called!"),
     100,
     target
   );
   Assert.equal(typeof interval1, "number", "setInterval returns a number");
-  Assert.ok(interval1 > 0, "setTimeout returns a positive number");
+  Assert.greater(interval1, 0, "setTimeout returns a positive number");
 
   imported.clearInterval(interval1);
 
   const EXPECTED_CALLS = 5;
   let calls = 0;
 
   await new Promise(resolve => {
     let interval2 = imported.setIntervalWithTarget(
@@ -172,17 +172,17 @@ add_task(async function test_requestIdle
   let request1 = imported.requestIdleCallback(() =>
     do_throw("Should not be called")
   );
   Assert.equal(
     typeof request1,
     "number",
     "requestIdleCallback returns a number"
   );
-  Assert.ok(request1 > 0, "setTimeout returns a positive number");
+  Assert.greater(request1, 0, "setTimeout returns a positive number");
 
   imported.cancelIdleCallback(request1);
 
   await new Promise(resolve => {
     let request2 = imported.requestIdleCallback(
       deadline => {
         Assert.ok(true, "Should be called");
         Assert.equal(
@@ -200,16 +200,20 @@ add_task(async function test_requestIdle
       { timeout: 100 }
     );
 
     Assert.equal(
       typeof request2,
       "number",
       "requestIdleCallback returns a number"
     );
-    Assert.ok(request2 > 0, "requestIdleCallback returns a positive number");
+    Assert.greater(
+      request2,
+      0,
+      "requestIdleCallback returns a positive number"
+    );
     Assert.notEqual(
       request1,
       request2,
       "Calling requestIdleCallback again returns a different value"
     );
   });
 });
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_long.js
@@ -3,17 +3,17 @@ gUseRealCertChecks = true;
 const ID = "123456789012345678901234567890123456789012345678901@somewhere.com";
 
 // Tests that signature verification works correctly on an extension with
 // an ID that does not fit into a certificate CN field.
 add_task(async function test_long_id() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
   await promiseStartupManager();
 
-  Assert.ok(ID.length > 64, "ID is > 64 characters");
+  Assert.greater(ID.length, 64, "ID is > 64 characters");
 
   await promiseInstallFile(do_get_file("data/signing_checks/long.xpi"));
   let addon = await promiseAddonByID(ID);
 
   Assert.notEqual(addon, null, "Addon install properly");
   Assert.ok(
     addon.signedState > AddonManager.SIGNEDSTATE_MISSING,
     "Signature verification worked properly"
--- a/widget/tests/browser/browser_test_procinfo.js
+++ b/widget/tests/browser/browser_test_procinfo.js
@@ -46,14 +46,14 @@ add_task(async function test_proc_info()
           for (var y = 0; y < childProc.threads.length; y++) {
             cpuThreads += childProc.threads[y].cpuUser;
           }
           cpuUser += childProc.cpuUser;
         }
       }
       // see https://bugzilla.mozilla.org/show_bug.cgi?id=1529023
       if (!MAC) {
-        Assert.ok(cpuThreads > 0, "Got some cpu time in the threads");
+        Assert.greater(cpuThreads, 0, "Got some cpu time in the threads");
       }
-      Assert.ok(cpuUser > 0, "Got some cpu time");
+      Assert.greater(cpuUser, 0, "Got some cpu time");
     }
   );
 });
--- a/widget/tests/unit/test_macsharingservice.js
+++ b/widget/tests/unit/test_macsharingservice.js
@@ -5,17 +5,17 @@
 
 // Basic tests to verify that MacSharingService returns expected data
 
 function test_getSharingProviders() {
   let sharingService = Cc["@mozilla.org/widget/macsharingservice;1"].getService(
     Ci.nsIMacSharingService
   );
   let providers = sharingService.getSharingProviders("http://example.org");
-  Assert.ok(providers.length > 1, "There are providers returned");
+  Assert.greater(providers.length, 1, "There are providers returned");
   providers.forEach(provider => {
     Assert.ok("name" in provider, "Provider has name");
     Assert.ok("menuItemTitle" in provider, "Provider has menuItemTitle");
     Assert.ok("image" in provider, "Provider has image");
 
     Assert.notEqual(
       provider.title,
       "Mail",