mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786489 - Part 1: Update serverURL and clusterURL through Service; r=rnewman
The preferred method to update serverURL and clusterURL is by going through the SyncService Service singleton, not by setting preferences.
This commit is contained in:
parent
ae2a788f16
commit
5f41f9020f
@ -11,7 +11,7 @@ function run_test() {
|
||||
_("Set up test fixtures.");
|
||||
|
||||
Identity.username = "john@example.com";
|
||||
Svc.Prefs.set("clusterURL", "http://fakebase/");
|
||||
Service.clusterURL = "http://fakebase/";
|
||||
let baseUri = "http://fakebase/1.1/foo/storage/";
|
||||
let pubUri = baseUri + "keys/pubkey";
|
||||
let privUri = baseUri + "keys/privkey";
|
||||
|
@ -73,8 +73,8 @@ add_test(function test_removeClientData() {
|
||||
Service.startOver();
|
||||
do_check_false(engine.removed);
|
||||
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
|
||||
do_check_false(engine.removed);
|
||||
Service.startOver();
|
||||
|
@ -12,7 +12,7 @@ function makeSteamEngine() {
|
||||
function test_url_attributes() {
|
||||
_("SyncEngine url attributes");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("clusterURL", "https://cluster/");
|
||||
Service.clusterURL = "https://cluster/";
|
||||
let engine = makeSteamEngine();
|
||||
try {
|
||||
do_check_eq(engine.storageURL, "https://cluster/1.1/foo/storage/");
|
||||
@ -161,8 +161,8 @@ function test_resetClient() {
|
||||
function test_wipeServer() {
|
||||
_("SyncEngine.wipeServer deletes server data and resets the client.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
let engine = makeSteamEngine();
|
||||
|
||||
const PAYLOAD = 42;
|
||||
|
@ -39,8 +39,8 @@ function createServerAndConfigureClient() {
|
||||
};
|
||||
|
||||
const USER = "foo";
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", USER);
|
||||
|
||||
let server = new SyncServer();
|
||||
@ -75,8 +75,8 @@ add_test(function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {
|
||||
_("SyncEngine._syncStartup resets sync and wipes server data if there's no or an outdated global record");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
// Some server side data that's going to be wiped
|
||||
@ -129,8 +129,8 @@ add_test(function test_syncStartup_serverHasNewerVersion() {
|
||||
_("SyncEngine._syncStartup ");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let global = new ServerWBO('global', {engines: {rotary: {version: 23456}}});
|
||||
let server = httpd_setup({
|
||||
@ -160,8 +160,8 @@ add_test(function test_syncStartup_syncIDMismatchResetsClient() {
|
||||
_("SyncEngine._syncStartup resets sync if syncIDs don't match");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let server = sync_httpd_setup({});
|
||||
|
||||
@ -198,8 +198,8 @@ add_test(function test_processIncoming_emptyServer() {
|
||||
_("SyncEngine._processIncoming working with an empty server backend");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
|
||||
@ -224,8 +224,8 @@ add_test(function test_processIncoming_createFromServer() {
|
||||
_("SyncEngine._processIncoming creates new records from server data");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
generateNewKeys();
|
||||
@ -286,8 +286,8 @@ add_test(function test_processIncoming_reconcile() {
|
||||
_("SyncEngine._processIncoming updates local records");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
|
||||
@ -606,8 +606,8 @@ add_test(function test_processIncoming_mobile_batchSize() {
|
||||
_("SyncEngine._processIncoming doesn't fetch everything at once on mobile clients");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
Svc.Prefs.set("client.type", "mobile");
|
||||
|
||||
@ -676,8 +676,8 @@ add_test(function test_processIncoming_mobile_batchSize() {
|
||||
add_test(function test_processIncoming_store_toFetch() {
|
||||
_("If processIncoming fails in the middle of a batch on mobile, state is saved in toFetch and lastSync.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
Svc.Prefs.set("client.type", "mobile");
|
||||
|
||||
@ -744,8 +744,8 @@ add_test(function test_processIncoming_store_toFetch() {
|
||||
add_test(function test_processIncoming_resume_toFetch() {
|
||||
_("toFetch and previousFailed items left over from previous syncs are fetched on the next sync, along with new items.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
const LASTSYNC = Date.now() / 1000;
|
||||
@ -813,8 +813,8 @@ add_test(function test_processIncoming_resume_toFetch() {
|
||||
add_test(function test_processIncoming_applyIncomingBatchSize_smaller() {
|
||||
_("Ensure that a number of incoming items less than applyIncomingBatchSize is still applied.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
// Engine that doesn't like the first and last record it's given.
|
||||
@ -868,7 +868,7 @@ add_test(function test_processIncoming_applyIncomingBatchSize_smaller() {
|
||||
add_test(function test_processIncoming_applyIncomingBatchSize_multiple() {
|
||||
_("Ensure that incoming items are applied according to applyIncomingBatchSize.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
const APPLY_BATCH_SIZE = 10;
|
||||
@ -920,8 +920,8 @@ add_test(function test_processIncoming_applyIncomingBatchSize_multiple() {
|
||||
add_test(function test_processIncoming_notify_count() {
|
||||
_("Ensure that failed records are reported only once.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
const APPLY_BATCH_SIZE = 5;
|
||||
@ -1009,8 +1009,8 @@ add_test(function test_processIncoming_notify_count() {
|
||||
add_test(function test_processIncoming_previousFailed() {
|
||||
_("Ensure that failed records are retried.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
Svc.Prefs.set("client.type", "mobile");
|
||||
|
||||
@ -1095,8 +1095,8 @@ add_test(function test_processIncoming_previousFailed() {
|
||||
add_test(function test_processIncoming_failed_records() {
|
||||
_("Ensure that failed records from _reconcile and applyIncomingBatch are refetched.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
// Let's create three and a bit batches worth of server side records.
|
||||
@ -1230,8 +1230,8 @@ add_test(function test_processIncoming_decrypt_failed() {
|
||||
_("Ensure that records failing to decrypt are either replaced or refetched.");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
// Some good and some bogus records. One doesn't contain valid JSON,
|
||||
@ -1308,8 +1308,8 @@ add_test(function test_uploadOutgoing_toEmptyServer() {
|
||||
_("SyncEngine._uploadOutgoing uploads new records to server");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
collection._wbos.flying = new ServerWBO('flying');
|
||||
@ -1367,8 +1367,8 @@ add_test(function test_uploadOutgoing_failed() {
|
||||
_("SyncEngine._uploadOutgoing doesn't clear the tracker of objects that failed to upload.");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
// We only define the "flying" WBO on the server, not the "scotsman"
|
||||
@ -1430,8 +1430,8 @@ add_test(function test_uploadOutgoing_MAX_UPLOAD_RECORDS() {
|
||||
_("SyncEngine._uploadOutgoing uploads in batches of MAX_UPLOAD_RECORDS");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
|
||||
@ -1502,8 +1502,8 @@ add_test(function test_syncFinish_deleteByIds() {
|
||||
_("SyncEngine._syncFinish deletes server records slated for deletion (list of record IDs).");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
collection._wbos.flying = new ServerWBO(
|
||||
@ -1544,8 +1544,8 @@ add_test(function test_syncFinish_deleteLotsInBatches() {
|
||||
_("SyncEngine._syncFinish deletes server records in batches of 100 (list of record IDs).");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
|
||||
@ -1616,8 +1616,8 @@ add_test(function test_sync_partialUpload() {
|
||||
_("SyncEngine.sync() keeps changedIDs that couldn't be uploaded.");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
let collection = new ServerCollection();
|
||||
@ -1690,8 +1690,8 @@ add_test(function test_sync_partialUpload() {
|
||||
add_test(function test_canDecrypt_noCryptoKeys() {
|
||||
_("SyncEngine.canDecrypt returns false if the engine fails to decrypt items on the server, e.g. due to a missing crypto key collection.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
// Wipe CollectionKeys so we can test the desired scenario.
|
||||
@ -1719,8 +1719,8 @@ add_test(function test_canDecrypt_noCryptoKeys() {
|
||||
add_test(function test_canDecrypt_true() {
|
||||
_("SyncEngine.canDecrypt returns true if the engine can decrypt the items on the server.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
// Set up CollectionKeys, as service.js does.
|
||||
@ -1748,8 +1748,8 @@ add_test(function test_canDecrypt_true() {
|
||||
|
||||
add_test(function test_syncapplied_observer() {
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("serverURL", TEST_SERVER_URL);
|
||||
Svc.Prefs.set("clusterURL", TEST_CLUSTER_URL);
|
||||
Service.serverURL = TEST_SERVER_URL;
|
||||
Service.clusterURL = TEST_CLUSTER_URL;
|
||||
Svc.Prefs.set("username", "foo");
|
||||
|
||||
const NUMBER_OF_RECORDS = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user