Bug 648364 - Remove dead code from the test harness. r=rnewman

This commit is contained in:
Philipp von Weitershausen 2011-05-20 18:45:51 -07:00
Родитель 40b96ccb6b
Коммит f92d89ba81
7 изменённых файлов: 43 добавлений и 267 удалений

Просмотреть файл

@ -1,32 +1,10 @@
var gProfD;
// Load httpd from the add-on test harness or from xpcshell and declare Cc, etc.
// without a var/const so they don't get hoisted and conflict with load_httpd.
if (this.do_load_httpd_js == null) {
Cc = Components.classes;
Ci = Components.interfaces;
Cr = Components.results;
Cu = Components.utils;
Cu.import("resource://harness/modules/httpd.js");
let file = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("ProfD", Ci.nsIFile);
gProfD = file.clone();
}
else {
do_load_httpd_js();
gProfD = do_get_profile();
}
do_load_httpd_js();
gProfD = do_get_profile();
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
try {
// In the context of xpcshell tests, there won't be a default AppInfo
Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
}
catch(ex) {
// Make sure to provide the right OS so crypto loads the right binaries
let OS = "XPCShell";
if ("@mozilla.org/windows-registry-key;1" in Cc)
@ -64,7 +42,6 @@ registrar.registerFactory(Components.ID("{fbfae60b-64a4-44ef-a911-08ceb70b9f31}"
"XULAppInfo", "@mozilla.org/xre/app-info;1",
XULAppInfoFactory);
}
// Register resource aliases. Normally done in SyncComponents.manifest.
function addResourceAlias() {

Просмотреть файл

@ -2,77 +2,25 @@ Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/record.js");
var btoa;
// initialize nss
let ch = Cc["@mozilla.org/security/hash;1"].
createInstance(Ci.nsICryptoHash);
let ds = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
let provider = {
getFile: function(prop, persistent) {
persistent.value = true;
switch (prop) {
case "ExtPrefDL":
return [ds.get("CurProcD", Ci.nsIFile)];
return [Services.dirsvc.get("CurProcD", Ci.nsIFile)];
case "ProfD":
return ds.get("CurProcD", Ci.nsIFile);
case "UHist":
let histFile = ds.get("CurProcD", Ci.nsIFile);
let histFile = Services.dirsvc.get("CurProcD", Ci.nsIFile);
histFile.append("history.dat");
return histFile;
default:
throw Cr.NS_ERROR_FAILURE;
}
},
QueryInterface: function(iid) {
if (iid.equals(Ci.nsIDirectoryServiceProvider) ||
iid.equals(Ci.nsISupports)) {
return this;
}
throw Cr.NS_ERROR_NO_INTERFACE;
}
};
ds.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
function loadInSandbox(aUri) {
var sandbox = Components.utils.Sandbox(this);
var request = Components.
classes["@mozilla.org/xmlextras/xmlhttprequest;1"].
createInstance();
request.open("GET", aUri, false);
request.overrideMimeType("application/javascript");
request.send(null);
Components.utils.evalInSandbox(request.responseText, sandbox, "1.8");
return sandbox;
}
function FakeTimerService() {
this.callbackQueue = [];
var self = this;
this.__proto__ = {
makeTimerForCall: function FTS_makeTimerForCall(cb) {
// Just add the callback to our queue and we'll call it later, so
// as to simulate a real nsITimer.
self.callbackQueue.push(cb);
return "fake nsITimer";
},
processCallback: function FTS_processCallbacks() {
var cb = self.callbackQueue.pop();
if (cb) {
cb();
return true;
}
return false;
}
};
Utils.makeTimerForCall = self.makeTimerForCall;
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDirectoryServiceProvider])
};
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
btoa = Cu.import("resource://services-sync/log4moz.js").btoa;
function getTestLogger(component) {
@ -110,45 +58,6 @@ function initTestLogging(level) {
return logStats;
}
function FakePrefService(contents) {
Cu.import("resource://services-sync/util.js");
this.fakeContents = contents;
Utils.__prefs = this;
}
FakePrefService.prototype = {
_getPref: function fake__getPref(pref) {
getTestLogger().trace("Getting pref: " + pref);
return this.fakeContents[pref];
},
getCharPref: function fake_getCharPref(pref) {
return this._getPref(pref);
},
getBoolPref: function fake_getBoolPref(pref) {
return this._getPref(pref);
},
getIntPref: function fake_getIntPref(pref) {
return this._getPref(pref);
},
addObserver: function fake_addObserver() {}
};
function FakePasswordService(contents) {
Cu.import("resource://services-sync/util.js");
this.fakeContents = contents;
let self = this;
Utils.findPassword = function fake_findPassword(realm, username) {
getTestLogger().trace("Password requested for " +
realm + ":" + username);
if (realm in self.fakeContents && username in self.fakeContents[realm])
return self.fakeContents[realm][username];
else
return null;
};
};
function FakeFilesystemService(contents) {
this.fakeContents = contents;
let self = this;
@ -232,128 +141,24 @@ FakeCryptoService.prototype = {
generateRandomBytes: function(aByteCount) {
return "not-so-random-now-are-we-HA-HA-HA! >:)".slice(aByteCount);
},
}
};
function SyncTestingInfrastructure(engineFactory) {
let __fakePasswords = {
'Mozilla Services Password': {foo: "bar"},
'Mozilla Services Encryption Passphrase': {foo: "a-abcde-abcde-abcde-abcde-abcde"}
};
let __fakePrefs = {
"encryption" : "none",
"log.logger.service.crypto" : "Debug",
"log.logger.service.engine" : "Debug",
"log.logger.async" : "Debug",
"xmpp.enabled" : false
};
function SyncTestingInfrastructure() {
Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/util.js");
ID.set('WeaveID',
new Identity('Mozilla Services Encryption Passphrase', 'foo'));
ID.set('WeaveCryptoID',
new Identity('Mozilla Services Encryption Passphrase', 'foo'));
this.fakePasswordService = new FakePasswordService(__fakePasswords);
this.fakePrefService = new FakePrefService(__fakePrefs);
this.fakeTimerService = new FakeTimerService();
this.logStats = initTestLogging();
this.fakeFilesystem = new FakeFilesystemService({});
this.fakeGUIDService = new FakeGUIDService();
this.fakeCryptoService = new FakeCryptoService();
this._logger = getTestLogger();
this._engineFactory = engineFactory;
this._clientStates = [];
this.saveClientState = function pushClientState(label) {
let state = Utils.deepCopy(this.fakeFilesystem.fakeContents);
let currContents = this.fakeFilesystem.fakeContents;
this.fakeFilesystem.fakeContents = [];
let engine = this._engineFactory();
let snapshot = Utils.deepCopy(engine._store.wrap());
this._clientStates[label] = {state: state, snapshot: snapshot};
this.fakeFilesystem.fakeContents = currContents;
};
this.restoreClientState = function restoreClientState(label) {
let state = this._clientStates[label].state;
let snapshot = this._clientStates[label].snapshot;
function _restoreState() {
let self = yield;
this.fakeFilesystem.fakeContents = [];
let engine = this._engineFactory();
engine._store.wipe();
let originalSnapshot = Utils.deepCopy(engine._store.wrap());
engine._core.detectUpdates(self.cb, originalSnapshot, snapshot);
let commands = yield;
engine._store.applyCommands.async(engine._store, self.cb, commands);
yield;
this.fakeFilesystem.fakeContents = Utils.deepCopy(state);
}
let self = this;
function restoreState(cb) {
_restoreState.async(self, cb);
}
this.runAsyncFunc("restore client state of " + label,
restoreState);
};
this.__makeCallback = function __makeCallback() {
this.__callbackCalled = false;
let self = this;
return function callback() {
self.__callbackCalled = true;
};
};
this.doSync = function doSync(name) {
let self = this;
function freshEngineSync(cb) {
let engine = self._engineFactory();
engine.sync(cb);
}
this.runAsyncFunc(name, freshEngineSync);
};
this.runAsyncFunc = function runAsyncFunc(name, func) {
let logger = this._logger;
logger.info("-----------------------------------------");
logger.info("Step '" + name + "' starting.");
logger.info("-----------------------------------------");
func(this.__makeCallback());
while (this.fakeTimerService.processCallback()) {}
do_check_true(this.__callbackCalled);
for (name in Async.outstandingGenerators)
logger.warn("Outstanding generator exists: " + name);
do_check_eq(this.logStats.errorsLogged, 0);
do_check_eq(Async.outstandingGenerators.length, 0);
logger.info("Step '" + name + "' succeeded.");
};
this.resetClientState = function resetClientState() {
this.fakeFilesystem.fakeContents = {};
let engine = this._engineFactory();
engine._store.wipe();
};
}
/*
* Ensure exceptions from inside callbacks leads to test failures.
*/

Просмотреть файл

@ -8,13 +8,11 @@ Cu.import("resource://services-sync/service.js");
Cu.import("resource://gre/modules/PlacesUtils.jsm");
Engines.register(BookmarksEngine);
function makeEngine() {
return new BookmarksEngine();
}
var syncTesting = new SyncTestingInfrastructure(makeEngine);
var syncTesting = new SyncTestingInfrastructure();
add_test(function bad_record_allIDs() {
let syncTesting = new SyncTestingInfrastructure();
_("Ensure that bad Places queries don't cause an error in getAllIDs.");
let engine = new BookmarksEngine();
let store = engine._store;
@ -45,6 +43,7 @@ add_test(function bad_record_allIDs() {
add_test(function test_ID_caching() {
let syncTesting = new SyncTestingInfrastructure();
_("Ensure that Places IDs are not cached.");
let engine = new BookmarksEngine();
@ -85,7 +84,7 @@ add_test(function test_ID_caching() {
add_test(function test_processIncoming_error_orderChildren() {
_("Ensure that _orderChildren() is called even when _processIncoming() throws an error.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -158,13 +157,13 @@ add_test(function test_processIncoming_error_orderChildren() {
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeEngine);
server.stop(run_next_test);
}
});
add_test(function test_restorePromptsReupload() {
_("Ensure that restoring from a backup will reupload all records.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("username", "foo");
Service.serverURL = "http://localhost:8080/";
Service.clusterURL = "http://localhost:8080/";
@ -297,7 +296,6 @@ add_test(function test_restorePromptsReupload() {
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeEngine);
server.stop(run_next_test);
}
});
@ -338,6 +336,7 @@ add_test(function test_mismatched_types() {
"parentid": "toolbar"
};
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("username", "foo");
Service.serverURL = "http://localhost:8080/";
Service.clusterURL = "http://localhost:8080/";
@ -381,7 +380,6 @@ add_test(function test_mismatched_types() {
store.wipe();
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeEngine);
server.stop(run_next_test);
}
});

Просмотреть файл

@ -20,10 +20,7 @@ let store = engine._store;
// Clean up after other tests. Only necessary in XULRunner.
store.wipe();
function makeEngine() {
return new BookmarksEngine();
}
var syncTesting = new SyncTestingInfrastructure(makeEngine);
var syncTesting = new SyncTestingInfrastructure();
function newSmartBookmark(parent, uri, position, title, queryID) {
let id = PlacesUtils.bookmarks.insertBookmark(parent, uri, position, title);

Просмотреть файл

@ -5,11 +5,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/util.js");
function makeSteamEngine() {
return new SteamEngine();
}
var syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
var syncTesting = new SyncTestingInfrastructure();
function test_processIncoming_mobile_history_batched() {
_("SyncEngine._processIncoming works on history engine.");

Просмотреть файл

@ -5,10 +5,9 @@ function makeSteamEngine() {
return new SyncEngine('Steam');
}
var syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
function test_url_attributes() {
_("SyncEngine url attributes");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "https://cluster/");
let engine = makeSteamEngine();
try {
@ -22,6 +21,7 @@ function test_url_attributes() {
function test_syncID() {
_("SyncEngine.syncID corresponds to preference");
let syncTesting = new SyncTestingInfrastructure();
let engine = makeSteamEngine();
try {
// Ensure pristine environment
@ -36,12 +36,12 @@ function test_syncID() {
do_check_eq(engine.syncID, "fake-guid-1");
} finally {
Svc.Prefs.resetBranch("");
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
function test_lastSync() {
_("SyncEngine.lastSync and SyncEngine.lastSyncLocal correspond to preferences");
let syncTesting = new SyncTestingInfrastructure();
let engine = makeSteamEngine();
try {
// Ensure pristine environment
@ -71,6 +71,7 @@ function test_lastSync() {
function test_toFetch() {
_("SyncEngine.toFetch corresponds to file on disk");
let syncTesting = new SyncTestingInfrastructure();
const filename = "weave/toFetch/steam.json";
let engine = makeSteamEngine();
try {
@ -100,6 +101,7 @@ function test_toFetch() {
function test_resetClient() {
_("SyncEngine.resetClient resets lastSync and toFetch");
let syncTesting = new SyncTestingInfrastructure();
let engine = makeSteamEngine();
try {
// Ensure pristine environment
@ -123,6 +125,7 @@ function test_resetClient() {
function test_wipeServer() {
_("SyncEngine.wipeServer deletes server data and resets the client.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
let engine = makeSteamEngine();

Просмотреть файл

@ -97,8 +97,6 @@ function makeSteamEngine() {
return new SteamEngine();
}
var syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
/*
* Tests
*
@ -116,6 +114,7 @@ var syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
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("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -165,13 +164,13 @@ function test_syncStartup_emptyOrOutdatedGlobalsResetsSync() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
function test_syncStartup_serverHasNewerVersion() {
_("SyncEngine._syncStartup ");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let global = new ServerWBO('global', {engines: {steam: {version: 23456}}});
@ -197,7 +196,6 @@ function test_syncStartup_serverHasNewerVersion() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -205,6 +203,7 @@ function test_syncStartup_serverHasNewerVersion() {
function test_syncStartup_syncIDMismatchResetsClient() {
_("SyncEngine._syncStartup resets sync if syncIDs don't match");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let server = sync_httpd_setup({});
@ -237,7 +236,6 @@ function test_syncStartup_syncIDMismatchResetsClient() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -245,6 +243,7 @@ function test_syncStartup_syncIDMismatchResetsClient() {
function test_processIncoming_emptyServer() {
_("SyncEngine._processIncoming working with an empty server backend");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -265,7 +264,6 @@ function test_processIncoming_emptyServer() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -273,6 +271,7 @@ function test_processIncoming_emptyServer() {
function test_processIncoming_createFromServer() {
_("SyncEngine._processIncoming creates new records from server data");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -329,7 +328,6 @@ function test_processIncoming_createFromServer() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -337,6 +335,7 @@ function test_processIncoming_createFromServer() {
function test_processIncoming_reconcile() {
_("SyncEngine._processIncoming updates local records");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -451,7 +450,6 @@ function test_processIncoming_reconcile() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -459,6 +457,7 @@ function test_processIncoming_reconcile() {
function test_processIncoming_mobile_batchSize() {
_("SyncEngine._processIncoming doesn't fetch everything at once on mobile clients");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
Svc.Prefs.set("client.type", "mobile");
@ -524,13 +523,13 @@ function test_processIncoming_mobile_batchSize() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
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("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
Svc.Prefs.set("client.type", "mobile");
@ -594,13 +593,13 @@ function test_processIncoming_store_toFetch() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
function test_processIncoming_resume_toFetch() {
_("toFetch items left over from previous syncs are fetched on the next sync, along with new items.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -654,13 +653,13 @@ function test_processIncoming_resume_toFetch() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
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("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -711,13 +710,13 @@ function test_processIncoming_applyIncomingBatchSize_smaller() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
function test_processIncoming_applyIncomingBatchSize_multiple() {
_("Ensure that incoming items are applied according to applyIncomingBatchSize.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -767,13 +766,13 @@ function test_processIncoming_applyIncomingBatchSize_multiple() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
function test_processIncoming_failed_records() {
_("Ensure that failed records from _reconcile and applyIncomingBatch are refetched.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -981,7 +980,6 @@ function test_processIncoming_decrypt_failed() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -989,6 +987,7 @@ function test_processIncoming_decrypt_failed() {
function test_uploadOutgoing_toEmptyServer() {
_("SyncEngine._uploadOutgoing uploads new records to server");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -1042,7 +1041,6 @@ function test_uploadOutgoing_toEmptyServer() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -1050,6 +1048,7 @@ function test_uploadOutgoing_toEmptyServer() {
function test_uploadOutgoing_failed() {
_("SyncEngine._uploadOutgoing doesn't clear the tracker of objects that failed to upload.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -1115,6 +1114,7 @@ function test_uploadOutgoing_failed() {
function test_uploadOutgoing_MAX_UPLOAD_RECORDS() {
_("SyncEngine._uploadOutgoing uploads in batches of MAX_UPLOAD_RECORDS");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -1186,6 +1186,7 @@ function test_syncFinish_noDelete() {
function test_syncFinish_deleteByIds() {
_("SyncEngine._syncFinish deletes server records slated for deletion (list of record IDs).");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -1222,7 +1223,6 @@ function test_syncFinish_deleteByIds() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -1230,6 +1230,7 @@ function test_syncFinish_deleteByIds() {
function test_syncFinish_deleteLotsInBatches() {
_("SyncEngine._syncFinish deletes server records in batches of 100 (list of record IDs).");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
let collection = new ServerCollection();
@ -1296,7 +1297,6 @@ function test_syncFinish_deleteLotsInBatches() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
@ -1304,6 +1304,7 @@ function test_syncFinish_deleteLotsInBatches() {
function test_sync_partialUpload() {
_("SyncEngine.sync() keeps changedIDs that couldn't be uploaded.");
let syncTesting = new SyncTestingInfrastructure();
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -1373,12 +1374,12 @@ function test_sync_partialUpload() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
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("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -1404,12 +1405,12 @@ function test_canDecrypt_noCryptoKeys() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}
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("clusterURL", "http://localhost:8080/");
Svc.Prefs.set("username", "foo");
@ -1435,7 +1436,6 @@ function test_canDecrypt_true() {
server.stop(do_test_finished);
Svc.Prefs.resetBranch("");
Records.clearCache();
syncTesting = new SyncTestingInfrastructure(makeSteamEngine);
}
}