Commit 18307460 authored by Jan Varga's avatar Jan Varga
Browse files

Bug 1884216 - Fix test_dom_quota_try.js to deal with different number of...

Bug 1884216 - Fix test_dom_quota_try.js to deal with different number of errors in nightly builds; r=dom-storage-reviewers,asuth

The error propagation during temporary storage initialization is a bit
different in nightly builds due to the use of OK_IN_NIGHTLY_PROPAGATE_IN_OTHERS
macro. This patch also fixes the case when logging to telemetry is disabled
completely.

Differential Revision: https://phabricator.services.mozilla.com/D203965
parent d748d023
Loading
Loading
Loading
Loading
+26 −4
Original line number Diff line number Diff line
@@ -3,6 +3,10 @@
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

const { AppConstants } = ChromeUtils.importESModule(
  "resource://gre/modules/AppConstants.sys.mjs"
);

const { TelemetryTestUtils } = ChromeUtils.importESModule(
  "resource://testing-common/TelemetryTestUtils.sys.mjs"
);
@@ -73,9 +77,25 @@ const testcases = [
      await requestFinished(request);
    },
    initFunction: initTemporaryStorage,
    expectedNumberOfEvents: {
    getExpectedNumberOfEvents() {
      if (AppConstants.EARLY_BETA_OR_EARLIER || AppConstants.DEBUG) {
        if (AppConstants.NIGHTLY_BUILD) {
          return {
            initFailure: 9,
            initSuccess: 0,
          };
        }

        return {
          initFailure: 14,
          initSuccess: 0,
        };
      }

      return {
        initFailure: 0,
        initSuccess: 0,
      };
    },
    async cleanup() {
      const request = clear();
@@ -144,7 +164,9 @@ async function testSteps() {
        ok(!expectedInitResult, msg);
      }

      const expectedNumberOfEventsObject = testcase.expectedNumberOfEvents;
      const expectedNumberOfEventsObject = testcase.getExpectedNumberOfEvents
        ? testcase.getExpectedNumberOfEvents()
        : testcase.expectedNumberOfEvents;

      const expectedNumberOfEvents = expectedInitResult
        ? expectedNumberOfEventsObject.initSuccess