Bug 1296767 part 5 - Remove add_identity_test helper. r=markh

MozReview-Commit-ID: 12pP01IHRyp

--HG--
extra : rebase_source : 2c5af253df77ed08dd8bdf0c7645ed98e6a96c9a
This commit is contained in:
Edouard Oger 2017-01-18 15:52:47 -05:00
parent cfef81983f
commit 9050cab070
12 changed files with 86 additions and 111 deletions

View File

@ -15,7 +15,6 @@ this.EXPORTED_SYMBOLS = [
"waitForZeroTimer",
"promiseZeroTimer",
"promiseNamedTimer",
"add_identity_test",
"MockFxaStorageManager",
"AccountState", // from a module import
"sumHistogram",
@ -261,32 +260,6 @@ this.encryptPayload = function encryptPayload(cleartext) {
};
}
// This helper can be used instead of 'add_test' or 'add_task' to run the
// specified test function with different identity managers.
// So far we use this with one, the FxA one, but we keep it in case we change
// idmanagers again.
//
// * The test itself should be passed as 'test' - ie, test code will generally
// pass |this|.
// * The test function is a regular test function - although note that it must
// be a generator - async operations should yield them, and run_next_test
// mustn't be called.
this.add_identity_test = function(test, testFunction) {
function note(what) {
let msg = "running test " + testFunction.name + " with " + what + " identity manager";
test.do_print(msg);
}
let ns = {};
Cu.import("resource://services-sync/service.js", ns);
test.add_task(async function() {
note("FxAccounts");
let oldIdentity = Status._authManager;
Status.__authManager = ns.Service.identity = new BrowserIDManager();
await testFunction();
Status.__authManager = ns.Service.identity = oldIdentity;
});
}
this.sumHistogram = function(name, options = {}) {
let histogram = options.key ? Services.telemetry.getKeyedHistogramById(name) :
Services.telemetry.getHistogramById(name);

View File

@ -6,7 +6,7 @@ Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
add_identity_test(this, async function test_missing_crypto_collection() {
add_task(async function test_missing_crypto_collection() {
let johnHelper = track_collections_helper();
let johnU = johnHelper.with_updated_collection;
let johnColls = johnHelper.collections;

View File

@ -63,7 +63,7 @@ function clean() {
errorHandler.didReportProlongedError = false;
}
add_identity_test(this, async function test_401_logout() {
add_task(async function test_401_logout() {
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -106,7 +106,7 @@ add_identity_test(this, async function test_401_logout() {
await deferred.promise;
});
add_identity_test(this, async function test_credentials_changed_logout() {
add_task(async function test_credentials_changed_logout() {
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -132,7 +132,7 @@ add_identity_test(this, async function test_credentials_changed_logout() {
await promiseStopServer(server);
});
add_identity_test(this, function test_no_lastSync_pref() {
add_task(function test_no_lastSync_pref() {
// Test reported error.
Status.resetSync();
errorHandler.dontIgnoreErrors = true;
@ -147,7 +147,7 @@ add_identity_test(this, function test_no_lastSync_pref() {
});
add_identity_test(this, function test_shouldReportError() {
add_task(function test_shouldReportError() {
Status.login = MASTER_PASSWORD_LOCKED;
do_check_false(errorHandler.shouldReportError());
@ -320,7 +320,7 @@ add_identity_test(this, function test_shouldReportError() {
do_check_false(errorHandler.didReportProlongedError);
});
add_identity_test(this, async function test_shouldReportError_master_password() {
add_task(async function test_shouldReportError_master_password() {
_("Test error ignored due to locked master password");
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -345,7 +345,7 @@ add_identity_test(this, async function test_shouldReportError_master_password()
// Test that even if we don't have a cluster URL, a login failure due to
// authentication errors is always reported.
add_identity_test(this, function test_shouldReportLoginFailureWithNoCluster() {
add_task(function test_shouldReportLoginFailureWithNoCluster() {
// Ensure no clusterURL - any error not specific to login should not be reported.
Service.serverURL = "";
Service.clusterURL = "";
@ -379,7 +379,7 @@ add_task(async function test_login_syncAndReportErrors_non_network_error() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_sync_syncAndReportErrors_non_network_error() {
add_task(async function test_sync_syncAndReportErrors_non_network_error() {
// Test non-network errors are reported
// when calling syncAndReportErrors
let server = EHTestsCommon.sync_httpd_setup();
@ -428,7 +428,7 @@ add_task(async function test_login_syncAndReportErrors_prolonged_non_network_err
await promiseStopServer(server);
});
add_identity_test(this, async function test_sync_syncAndReportErrors_prolonged_non_network_error() {
add_task(async function test_sync_syncAndReportErrors_prolonged_non_network_error() {
// Test prolonged, non-network errors are
// reported when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -459,7 +459,7 @@ add_identity_test(this, async function test_sync_syncAndReportErrors_prolonged_n
await promiseStopServer(server);
});
add_identity_test(this, async function test_login_syncAndReportErrors_network_error() {
add_task(async function test_login_syncAndReportErrors_network_error() {
// Test network errors are reported when calling syncAndReportErrors.
await configureIdentity({username: "broken.wipe"});
Service.serverURL = fakeServerUrl;
@ -494,7 +494,7 @@ add_test(function test_sync_syncAndReportErrors_network_error() {
errorHandler.syncAndReportErrors();
});
add_identity_test(this, async function test_login_syncAndReportErrors_prolonged_network_error() {
add_task(async function test_login_syncAndReportErrors_prolonged_network_error() {
// Test prolonged, network errors are reported
// when calling syncAndReportErrors.
await configureIdentity({username: "johndoe"});
@ -577,7 +577,7 @@ add_task(async function test_sync_prolonged_non_network_error() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_login_prolonged_network_error() {
add_task(async function test_login_prolonged_network_error() {
// Test prolonged, network errors are reported
await configureIdentity({username: "johndoe"});
Service.serverURL = fakeServerUrl;
@ -654,7 +654,7 @@ add_task(async function test_sync_non_network_error() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_login_network_error() {
add_task(async function test_login_network_error() {
await configureIdentity({username: "johndoe"});
Service.serverURL = fakeServerUrl;
Service.clusterURL = fakeServerUrl;
@ -690,7 +690,7 @@ add_test(function test_sync_network_error() {
Service.sync();
});
add_identity_test(this, async function test_sync_server_maintenance_error() {
add_task(async function test_sync_server_maintenance_error() {
// Test server maintenance errors are not reported.
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -724,7 +724,7 @@ add_identity_test(this, async function test_sync_server_maintenance_error() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_info_collections_login_server_maintenance_error() {
add_task(async function test_info_collections_login_server_maintenance_error() {
// Test info/collections server maintenance errors are not reported.
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -762,7 +762,7 @@ add_identity_test(this, async function test_info_collections_login_server_mainte
await promiseStopServer(server);
});
add_identity_test(this, async function test_meta_global_login_server_maintenance_error() {
add_task(async function test_meta_global_login_server_maintenance_error() {
// Test meta/global server maintenance errors are not reported.
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);

View File

@ -63,7 +63,7 @@ function clean() {
errorHandler.didReportProlongedError = false;
}
add_identity_test(this, async function test_crypto_keys_login_server_maintenance_error() {
add_task(async function test_crypto_keys_login_server_maintenance_error() {
Status.resetSync();
// Test crypto/keys server maintenance errors are not reported.
let server = EHTestsCommon.sync_httpd_setup();
@ -135,7 +135,7 @@ add_task(async function test_sync_prolonged_server_maintenance_error() {
clean();
});
add_identity_test(this, async function test_info_collections_login_prolonged_server_maintenance_error() {
add_task(async function test_info_collections_login_prolonged_server_maintenance_error() {
// Test info/collections prolonged server maintenance errors are reported.
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -167,7 +167,7 @@ add_identity_test(this, async function test_info_collections_login_prolonged_ser
await promiseStopServer(server);
});
add_identity_test(this, async function test_meta_global_login_prolonged_server_maintenance_error() {
add_task(async function test_meta_global_login_prolonged_server_maintenance_error() {
// Test meta/global prolonged server maintenance errors are reported.
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -199,7 +199,7 @@ add_identity_test(this, async function test_meta_global_login_prolonged_server_m
await promiseStopServer(server);
});
add_identity_test(this, async function test_download_crypto_keys_login_prolonged_server_maintenance_error() {
add_task(async function test_download_crypto_keys_login_prolonged_server_maintenance_error() {
// Test crypto/keys prolonged server maintenance errors are reported.
let server = EHTestsCommon.sync_httpd_setup();
await EHTestsCommon.setUp(server);
@ -232,7 +232,7 @@ add_identity_test(this, async function test_download_crypto_keys_login_prolonged
await promiseStopServer(server);
});
add_identity_test(this, async function test_upload_crypto_keys_login_prolonged_server_maintenance_error() {
add_task(async function test_upload_crypto_keys_login_prolonged_server_maintenance_error() {
// Test crypto/keys prolonged server maintenance errors are reported.
let server = EHTestsCommon.sync_httpd_setup();
@ -264,7 +264,7 @@ add_identity_test(this, async function test_upload_crypto_keys_login_prolonged_s
await promiseStopServer(server);
});
add_identity_test(this, async function test_wipeServer_login_prolonged_server_maintenance_error() {
add_task(async function test_wipeServer_login_prolonged_server_maintenance_error() {
// Test that we report prolonged server maintenance errors that occur whilst
// wiping the server.
let server = EHTestsCommon.sync_httpd_setup();
@ -297,7 +297,7 @@ add_identity_test(this, async function test_wipeServer_login_prolonged_server_ma
await promiseStopServer(server);
});
add_identity_test(this, async function test_wipeRemote_prolonged_server_maintenance_error() {
add_task(async function test_wipeRemote_prolonged_server_maintenance_error() {
// Test that we report prolonged server maintenance errors that occur whilst
// wiping all remote devices.
let server = EHTestsCommon.sync_httpd_setup();
@ -365,7 +365,7 @@ add_task(async function test_sync_syncAndReportErrors_server_maintenance_error()
await promiseStopServer(server);
});
add_identity_test(this, async function test_info_collections_login_syncAndReportErrors_server_maintenance_error() {
add_task(async function test_info_collections_login_syncAndReportErrors_server_maintenance_error() {
// Test info/collections server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -398,7 +398,7 @@ add_identity_test(this, async function test_info_collections_login_syncAndReport
await promiseStopServer(server);
});
add_identity_test(this, async function test_meta_global_login_syncAndReportErrors_server_maintenance_error() {
add_task(async function test_meta_global_login_syncAndReportErrors_server_maintenance_error() {
// Test meta/global server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -431,7 +431,7 @@ add_identity_test(this, async function test_meta_global_login_syncAndReportError
await promiseStopServer(server);
});
add_identity_test(this, async function test_download_crypto_keys_login_syncAndReportErrors_server_maintenance_error() {
add_task(async function test_download_crypto_keys_login_syncAndReportErrors_server_maintenance_error() {
// Test crypto/keys server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -466,7 +466,7 @@ add_identity_test(this, async function test_download_crypto_keys_login_syncAndRe
await promiseStopServer(server);
});
add_identity_test(this, async function test_upload_crypto_keys_login_syncAndReportErrors_server_maintenance_error() {
add_task(async function test_upload_crypto_keys_login_syncAndReportErrors_server_maintenance_error() {
// Test crypto/keys server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -499,7 +499,7 @@ add_identity_test(this, async function test_upload_crypto_keys_login_syncAndRepo
await promiseStopServer(server);
});
add_identity_test(this, async function test_wipeServer_login_syncAndReportErrors_server_maintenance_error() {
add_task(async function test_wipeServer_login_syncAndReportErrors_server_maintenance_error() {
// Test crypto/keys server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -532,7 +532,7 @@ add_identity_test(this, async function test_wipeServer_login_syncAndReportErrors
await promiseStopServer(server);
});
add_identity_test(this, async function test_wipeRemote_syncAndReportErrors_server_maintenance_error() {
add_task(async function test_wipeRemote_syncAndReportErrors_server_maintenance_error() {
// Test that we report prolonged server maintenance errors that occur whilst
// wiping all remote devices.
let server = EHTestsCommon.sync_httpd_setup();
@ -601,7 +601,7 @@ add_task(async function test_sync_syncAndReportErrors_prolonged_server_maintenan
await promiseStopServer(server);
});
add_identity_test(this, async function test_info_collections_login_syncAndReportErrors_prolonged_server_maintenance_error() {
add_task(async function test_info_collections_login_syncAndReportErrors_prolonged_server_maintenance_error() {
// Test info/collections server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -636,7 +636,7 @@ add_identity_test(this, async function test_info_collections_login_syncAndReport
await promiseStopServer(server);
});
add_identity_test(this, async function test_meta_global_login_syncAndReportErrors_prolonged_server_maintenance_error() {
add_task(async function test_meta_global_login_syncAndReportErrors_prolonged_server_maintenance_error() {
// Test meta/global server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -671,7 +671,7 @@ add_identity_test(this, async function test_meta_global_login_syncAndReportError
await promiseStopServer(server);
});
add_identity_test(this, async function test_download_crypto_keys_login_syncAndReportErrors_prolonged_server_maintenance_error() {
add_task(async function test_download_crypto_keys_login_syncAndReportErrors_prolonged_server_maintenance_error() {
// Test crypto/keys server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -708,7 +708,7 @@ add_identity_test(this, async function test_download_crypto_keys_login_syncAndRe
await promiseStopServer(server);
});
add_identity_test(this, async function test_upload_crypto_keys_login_syncAndReportErrors_prolonged_server_maintenance_error() {
add_task(async function test_upload_crypto_keys_login_syncAndReportErrors_prolonged_server_maintenance_error() {
// Test crypto/keys server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();
@ -743,7 +743,7 @@ add_identity_test(this, async function test_upload_crypto_keys_login_syncAndRepo
await promiseStopServer(server);
});
add_identity_test(this, async function test_wipeServer_login_syncAndReportErrors_prolonged_server_maintenance_error() {
add_task(async function test_wipeServer_login_syncAndReportErrors_prolonged_server_maintenance_error() {
// Test crypto/keys server maintenance errors are reported
// when calling syncAndReportErrors.
let server = EHTestsCommon.sync_httpd_setup();

View File

@ -64,7 +64,7 @@ function do_check_hard_eol(eh, start) {
do_check_true(Status.eol);
}
add_identity_test(this, async function test_200_hard() {
add_task(async function test_200_hard() {
let eh = Service.errorHandler;
let start = Date.now();
let server = sync_httpd_setup(handler200("hard-eol"));
@ -83,7 +83,7 @@ add_identity_test(this, async function test_200_hard() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_513_hard() {
add_task(async function test_513_hard() {
let eh = Service.errorHandler;
let start = Date.now();
let server = sync_httpd_setup(handler513);
@ -106,7 +106,7 @@ add_identity_test(this, async function test_513_hard() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_200_soft() {
add_task(async function test_200_soft() {
let eh = Service.errorHandler;
let start = Date.now();
let server = sync_httpd_setup(handler200("soft-eol"));

View File

@ -66,7 +66,7 @@ function generateAndUploadKeys(server) {
}
add_identity_test(this, async function test_backoff500() {
add_task(async function test_backoff500() {
_("Test: HTTP 500 sets backoff status.");
let server = sync_httpd_setup();
await setUp(server);
@ -93,7 +93,7 @@ add_identity_test(this, async function test_backoff500() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_backoff503() {
add_task(async function test_backoff503() {
_("Test: HTTP 503 with Retry-After header leads to backoff notification and sets backoff status.");
let server = sync_httpd_setup();
await setUp(server);
@ -129,7 +129,7 @@ add_identity_test(this, async function test_backoff503() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_overQuota() {
add_task(async function test_overQuota() {
_("Test: HTTP 400 with body error code 14 means over quota.");
let server = sync_httpd_setup();
await setUp(server);
@ -158,7 +158,7 @@ add_identity_test(this, async function test_overQuota() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_service_networkError() {
add_task(async function test_service_networkError() {
_("Test: Connection refused error from Service.sync() leads to the right status code.");
let server = sync_httpd_setup();
await setUp(server);
@ -180,7 +180,7 @@ add_identity_test(this, async function test_service_networkError() {
}
});
add_identity_test(this, async function test_service_offline() {
add_task(async function test_service_offline() {
_("Test: Wanting to sync in offline mode leads to the right status code but does not increment the ignorable error count.");
let server = sync_httpd_setup();
await setUp(server);
@ -205,7 +205,7 @@ add_identity_test(this, async function test_service_offline() {
Services.prefs.clearUserPref("network.dns.offline-localhost");
});
add_identity_test(this, async function test_engine_networkError() {
add_task(async function test_engine_networkError() {
_("Test: Network related exceptions from engine.sync() lead to the right status code.");
let server = sync_httpd_setup();
await setUp(server);
@ -232,7 +232,7 @@ add_identity_test(this, async function test_engine_networkError() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_resource_timeout() {
add_task(async function test_resource_timeout() {
let server = sync_httpd_setup();
await setUp(server);

View File

@ -57,7 +57,7 @@ function run_test() {
run_next_test();
}
add_identity_test(this, async function test_successful_sync_adjustSyncInterval() {
add_task(async function test_successful_sync_adjustSyncInterval() {
_("Test successful sync calling adjustSyncInterval");
let syncSuccesses = 0;
function onSyncFinish() {
@ -156,7 +156,7 @@ add_identity_test(this, async function test_successful_sync_adjustSyncInterval()
await promiseStopServer(server);
});
add_identity_test(this, async function test_unsuccessful_sync_adjustSyncInterval() {
add_task(async function test_unsuccessful_sync_adjustSyncInterval() {
_("Test unsuccessful sync calling adjustSyncInterval");
let syncFailures = 0;
@ -261,7 +261,7 @@ add_identity_test(this, async function test_unsuccessful_sync_adjustSyncInterval
await promiseStopServer(server);
});
add_identity_test(this, async function test_back_triggers_sync() {
add_task(async function test_back_triggers_sync() {
let server = sync_httpd_setup();
await setUp(server);
@ -290,7 +290,7 @@ add_identity_test(this, async function test_back_triggers_sync() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_adjust_interval_on_sync_error() {
add_task(async function test_adjust_interval_on_sync_error() {
let server = sync_httpd_setup();
await setUp(server);
@ -321,7 +321,7 @@ add_identity_test(this, async function test_adjust_interval_on_sync_error() {
await promiseStopServer(server);
});
add_identity_test(this, async function test_bug671378_scenario() {
add_task(async function test_bug671378_scenario() {
// Test scenario similar to bug 671378. This bug appeared when a score
// update occurred that wasn't large enough to trigger a sync so
// scheduleNextSync() was called without a time interval parameter,

View File

@ -28,7 +28,7 @@ function run_test() {
run_next_test();
}
add_identity_test(this, async function test_resetLocalData() {
add_task(async function test_resetLocalData() {
await configureIdentity();
Service.status.enforceBackoff = true;
Service.status.backoffInterval = 42;

View File

@ -44,7 +44,7 @@ function run_test() {
run_next_test();
}
add_identity_test(this, async function test_wipeServer_list_success() {
add_task(async function test_wipeServer_list_success() {
_("Service.wipeServer() deletes collections given as argument.");
let steam_coll = new FakeCollection();
@ -78,7 +78,7 @@ add_identity_test(this, async function test_wipeServer_list_success() {
}
});
add_identity_test(this, async function test_wipeServer_list_503() {
add_task(async function test_wipeServer_list_503() {
_("Service.wipeServer() deletes collections given as argument.");
let steam_coll = new FakeCollection();
@ -119,7 +119,7 @@ add_identity_test(this, async function test_wipeServer_list_503() {
}
});
add_identity_test(this, async function test_wipeServer_all_success() {
add_task(async function test_wipeServer_all_success() {
_("Service.wipeServer() deletes all the things.");
/**
@ -149,7 +149,7 @@ add_identity_test(this, async function test_wipeServer_all_success() {
Svc.Prefs.resetBranch("");
});
add_identity_test(this, async function test_wipeServer_all_404() {
add_task(async function test_wipeServer_all_404() {
_("Service.wipeServer() accepts a 404.");
/**
@ -181,7 +181,7 @@ add_identity_test(this, async function test_wipeServer_all_404() {
Svc.Prefs.resetBranch("");
});
add_identity_test(this, async function test_wipeServer_all_503() {
add_task(async function test_wipeServer_all_503() {
_("Service.wipeServer() throws if it encounters a non-200/404 response.");
/**
@ -213,7 +213,7 @@ add_identity_test(this, async function test_wipeServer_all_503() {
Svc.Prefs.resetBranch("");
});
add_identity_test(this, async function test_wipeServer_all_connectionRefused() {
add_task(async function test_wipeServer_all_connectionRefused() {
_("Service.wipeServer() throws if it encounters a network problem.");
let server = httpd_setup({});
await setUpTestFixtures(server);

View File

@ -1,6 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://services-sync/browserid_identity.js");
Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/clients.js");
@ -159,7 +160,7 @@ add_test(function test_prefAttributes() {
run_next_test();
});
add_identity_test(this, async function test_updateClientMode() {
add_task(async function test_updateClientMode() {
_("Test updateClientMode adjusts scheduling attributes based on # of clients appropriately");
do_check_eq(scheduler.syncThreshold, SINGLE_USER_THRESHOLD);
do_check_eq(scheduler.syncInterval, scheduler.singleDeviceInterval);
@ -191,7 +192,7 @@ add_identity_test(this, async function test_updateClientMode() {
await cleanUpAndGo();
});
add_identity_test(this, async function test_masterpassword_locked_retry_interval() {
add_task(async function test_masterpassword_locked_retry_interval() {
_("Test Status.login = MASTER_PASSWORD_LOCKED results in reschedule at MASTER_PASSWORD interval");
let loginFailed = false;
Svc.Obs.add("weave:service:login:error", function onLoginError() {
@ -228,7 +229,7 @@ add_identity_test(this, async function test_masterpassword_locked_retry_interval
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_calculateBackoff() {
add_task(async function test_calculateBackoff() {
do_check_eq(Status.backoffInterval, 0);
// Test no interval larger than the maximum backoff is used if
@ -250,7 +251,7 @@ add_identity_test(this, async function test_calculateBackoff() {
await cleanUpAndGo();
});
add_identity_test(this, async function test_scheduleNextSync_nowOrPast() {
add_task(async function test_scheduleNextSync_nowOrPast() {
let promiseObserved = promiseOneObserver("weave:service:sync:finish");
let server = sync_httpd_setup();
@ -262,7 +263,7 @@ add_identity_test(this, async function test_scheduleNextSync_nowOrPast() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_scheduleNextSync_future_noBackoff() {
add_task(async function test_scheduleNextSync_future_noBackoff() {
_("scheduleNextSync() uses the current syncInterval if no interval is provided.");
// Test backoffInterval is 0 as expected.
do_check_eq(Status.backoffInterval, 0);
@ -311,7 +312,7 @@ add_identity_test(this, async function test_scheduleNextSync_future_noBackoff()
await cleanUpAndGo();
});
add_identity_test(this, async function test_scheduleNextSync_future_backoff() {
add_task(async function test_scheduleNextSync_future_backoff() {
_("scheduleNextSync() will honour backoff in all scheduling requests.");
// Let's take a backoff interval that's bigger than the default sync interval.
const BACKOFF = 7337;
@ -361,7 +362,7 @@ add_identity_test(this, async function test_scheduleNextSync_future_backoff() {
await cleanUpAndGo();
});
add_identity_test(this, async function test_handleSyncError() {
add_task(async function test_handleSyncError() {
let server = sync_httpd_setup();
await setUp(server);
@ -424,7 +425,7 @@ add_identity_test(this, async function test_handleSyncError() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_client_sync_finish_updateClientMode() {
add_task(async function test_client_sync_finish_updateClientMode() {
let server = sync_httpd_setup();
await setUp(server);
@ -463,7 +464,7 @@ add_identity_test(this, async function test_client_sync_finish_updateClientMode(
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_autoconnect_nextSync_past() {
add_task(async function test_autoconnect_nextSync_past() {
let promiseObserved = promiseOneObserver("weave:service:sync:finish");
// nextSync will be 0 by default, so it's way in the past.
@ -475,7 +476,7 @@ add_identity_test(this, async function test_autoconnect_nextSync_past() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_autoconnect_nextSync_future() {
add_task(async function test_autoconnect_nextSync_future() {
let previousSync = Date.now() + scheduler.syncInterval / 2;
scheduler.nextSync = previousSync;
// nextSync rounds to the nearest second.
@ -534,7 +535,7 @@ add_task(async function test_autoconnect_mp_locked() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_no_autoconnect_during_wizard() {
add_task(async function test_no_autoconnect_during_wizard() {
let server = sync_httpd_setup();
await setUp(server);
@ -553,8 +554,9 @@ add_identity_test(this, async function test_no_autoconnect_during_wizard() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_no_autoconnect_status_not_ok() {
add_task(async function test_no_autoconnect_status_not_ok() {
let server = sync_httpd_setup();
Status.__authManager = Service.identity = new BrowserIDManager();
// Ensure we don't actually try to sync (or log in for that matter).
function onLoginStart() {
@ -572,7 +574,7 @@ add_identity_test(this, async function test_no_autoconnect_status_not_ok() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_autoconnectDelay_pref() {
add_task(async function test_autoconnectDelay_pref() {
let promiseObserved = promiseOneObserver("weave:service:sync:finish");
Svc.Prefs.set("autoconnectDelay", 1);
@ -589,7 +591,7 @@ add_identity_test(this, async function test_autoconnectDelay_pref() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_idle_adjustSyncInterval() {
add_task(async function test_idle_adjustSyncInterval() {
// Confirm defaults.
do_check_eq(scheduler.idle, false);
@ -611,7 +613,7 @@ add_identity_test(this, async function test_idle_adjustSyncInterval() {
await cleanUpAndGo();
});
add_identity_test(this, async function test_back_triggersSync() {
add_task(async function test_back_triggersSync() {
// Confirm defaults.
do_check_false(scheduler.idle);
do_check_eq(Status.backoffInterval, 0);
@ -631,7 +633,7 @@ add_identity_test(this, async function test_back_triggersSync() {
await cleanUpAndGo();
});
add_identity_test(this, async function test_active_triggersSync_observesBackoff() {
add_task(async function test_active_triggersSync_observesBackoff() {
// Confirm defaults.
do_check_false(scheduler.idle);
@ -660,7 +662,7 @@ add_identity_test(this, async function test_active_triggersSync_observesBackoff(
await cleanUpAndGo();
});
add_identity_test(this, async function test_back_debouncing() {
add_task(async function test_back_debouncing() {
_("Ensure spurious back-then-idle events, as observed on OS X, don't trigger a sync.");
// Confirm defaults.
@ -685,7 +687,7 @@ add_identity_test(this, async function test_back_debouncing() {
await cleanUpAndGo();
});
add_identity_test(this, async function test_no_sync_node() {
add_task(async function test_no_sync_node() {
// Test when Status.sync == NO_SYNC_NODE_FOUND
// it is not overwritten on sync:finish
let server = sync_httpd_setup();
@ -705,7 +707,7 @@ add_identity_test(this, async function test_no_sync_node() {
}
});
add_identity_test(this, async function test_sync_failed_partial_500s() {
add_task(async function test_sync_failed_partial_500s() {
_("Test a 5xx status calls handleSyncError.");
scheduler._syncErrors = MAX_ERROR_COUNT_BEFORE_BACKOFF;
let server = sync_httpd_setup();
@ -732,7 +734,7 @@ add_identity_test(this, async function test_sync_failed_partial_500s() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_sync_failed_partial_400s() {
add_task(async function test_sync_failed_partial_400s() {
_("Test a non-5xx status doesn't call handleSyncError.");
scheduler._syncErrors = MAX_ERROR_COUNT_BEFORE_BACKOFF;
let server = sync_httpd_setup();
@ -764,7 +766,7 @@ add_identity_test(this, async function test_sync_failed_partial_400s() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_sync_X_Weave_Backoff() {
add_task(async function test_sync_X_Weave_Backoff() {
let server = sync_httpd_setup();
await setUp(server);
@ -821,7 +823,7 @@ add_identity_test(this, async function test_sync_X_Weave_Backoff() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_sync_503_Retry_After() {
add_task(async function test_sync_503_Retry_After() {
let server = sync_httpd_setup();
await setUp(server);
@ -882,7 +884,7 @@ add_identity_test(this, async function test_sync_503_Retry_After() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_loginError_recoverable_reschedules() {
add_task(async function test_loginError_recoverable_reschedules() {
_("Verify that a recoverable login error schedules a new sync.");
await configureIdentity({username: "johndoe@mozilla.com"});
Service.serverURL = "http://localhost:1234/";
@ -922,7 +924,7 @@ add_identity_test(this, async function test_loginError_recoverable_reschedules()
await cleanUpAndGo()
});
add_identity_test(this, async function test_loginError_fatal_clearsTriggers() {
add_task(async function test_loginError_fatal_clearsTriggers() {
_("Verify that a fatal login error clears sync triggers.");
await configureIdentity({username: "johndoe@mozilla.com"});
@ -956,7 +958,7 @@ add_identity_test(this, async function test_loginError_fatal_clearsTriggers() {
await cleanUpAndGo(server);
});
add_identity_test(this, async function test_proper_interval_on_only_failing() {
add_task(async function test_proper_interval_on_only_failing() {
_("Ensure proper behavior when only failed records are applied.");
// If an engine reports that no records succeeded, we shouldn't decrease the

View File

@ -69,7 +69,7 @@ async function cleanAndGo(engine, server) {
// Avoid addon manager complaining about not being initialized
Service.engineManager.unregister("addons");
add_identity_test(this, async function test_basic() {
add_task(async function test_basic() {
let helper = track_collections_helper();
let upd = helper.with_updated_collection;
@ -461,7 +461,7 @@ add_task(async function test_nserror() {
}
});
add_identity_test(this, async function test_discarding() {
add_task(async function test_discarding() {
let helper = track_collections_helper();
let upd = helper.with_updated_collection;
let telem = get_sync_test_telemetry();

View File

@ -221,7 +221,7 @@
"Traversal.jsm": ["TraversalRules", "TraversalHelper"],
"UpdateTelemetry.jsm": ["AUSTLMY"],
"util.js": ["getChromeWindow", "XPCOMUtils", "Services", "Utils", "Async", "Svc", "Str"],
"utils.js": ["applicationName", "assert", "Copy", "getBrowserObject", "getChromeWindow", "getWindows", "getWindowByTitle", "getWindowByType", "getWindowId", "getMethodInWindows", "getPreference", "saveDataURL", "setPreference", "sleep", "startTimer", "stopTimer", "takeScreenshot", "unwrapNode", "waitFor", "btoa", "encryptPayload", "makeIdentityConfig", "makeFxAccountsInternalMock", "configureFxAccountIdentity", "configureIdentity", "SyncTestingInfrastructure", "waitForZeroTimer", "Promise", "add_identity_test", "MockFxaStorageManager", "AccountState", "sumHistogram", "CommonUtils", "CryptoUtils", "TestingUtils"],
"utils.js": ["applicationName", "assert", "Copy", "getBrowserObject", "getChromeWindow", "getWindows", "getWindowByTitle", "getWindowByType", "getWindowId", "getMethodInWindows", "getPreference", "saveDataURL", "setPreference", "sleep", "startTimer", "stopTimer", "takeScreenshot", "unwrapNode", "waitFor", "btoa", "encryptPayload", "makeIdentityConfig", "makeFxAccountsInternalMock", "configureFxAccountIdentity", "configureIdentity", "SyncTestingInfrastructure", "waitForZeroTimer", "Promise", "MockFxaStorageManager", "AccountState", "sumHistogram", "CommonUtils", "CryptoUtils", "TestingUtils"],
"Utils.jsm": ["Utils", "Logger", "PivotContext", "PrefCache"],
"VariablesView.jsm": ["VariablesView", "escapeHTML"],
"VariablesViewController.jsm": ["VariablesViewController", "StackFrameUtils"],