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
This commit is contained in:
Jan Varga 2024-03-13 01:22:45 +00:00
parent d748d02371
commit 1830746011

View file

@ -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: {
initFailure: 9,
initSuccess: 0,
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