Bug 792546 - Part 4: Move utility functions to testing-only JS module; r=rnewman

This commit is contained in:
Gregory Szorc 2012-09-24 13:45:49 -07:00
parent bd79af95ab
commit 4fd177cc88
45 changed files with 137 additions and 67 deletions

View File

@ -65,6 +65,7 @@ sync_stage_modules := \
sync_testing_modules := \ sync_testing_modules := \
fakeservices.js \ fakeservices.js \
rotaryengine.js \ rotaryengine.js \
utils.js \
$(NULL) $(NULL)
DIRS += locales DIRS += locales

View File

@ -0,0 +1,87 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = [
"TEST_CLUSTER_URL",
"TEST_SERVER_URL",
"btoa", // It comes from a module import.
"encryptPayload",
"setBasicCredentials",
"SyncTestingInfrastructure",
"waitForZeroTimer",
];
const {utils: Cu} = Components;
Cu.import("resource://services-common/utils.js");
Cu.import("resource://services-crypto/utils.js");
Cu.import("resource://testing-common/services-common/logging.js");
Cu.import("resource://testing-common/services/sync/fakeservices.js");
const TEST_SERVER_URL = "http://localhost:8080/";
const TEST_CLUSTER_URL = TEST_SERVER_URL;
/**
* First wait >100ms (nsITimers can take up to that much time to fire, so
* we can account for the timer in delayedAutoconnect) and then two event
* loop ticks (to account for the Utils.nextTick() in autoConnect).
*/
function waitForZeroTimer(callback) {
let ticks = 2;
function wait() {
if (ticks) {
ticks -= 1;
CommonUtils.nextTick(wait);
return;
}
callback();
}
CommonUtils.namedTimer(wait, 150, {}, "timer");
}
function setBasicCredentials(username, password, syncKey) {
let ns = {};
Cu.import("resource://services-sync/service.js", ns);
let auth = ns.Service.identity;
auth.username = username;
auth.basicPassword = password;
auth.syncKey = syncKey;
}
function SyncTestingInfrastructure(username, password, syncKey) {
let ns = {};
Cu.import("resource://services-sync/service.js", ns);
let auth = ns.Service.identity;
auth.account = username || "foo";
auth.basicPassword = password || "password";
auth.syncKey = syncKey || "foo";
ns.Service.serverURL = TEST_SERVER_URL;
ns.Service.clusterURL = TEST_CLUSTER_URL;
this.logStats = initTestLogging();
this.fakeFilesystem = new FakeFilesystemService({});
this.fakeGUIDService = new FakeGUIDService();
this.fakeCryptoService = new FakeCryptoService();
}
/**
* Turn WBO cleartext into fake "encrypted" payload as it goes over the wire.
*/
function encryptPayload(cleartext) {
if (typeof cleartext == "object") {
cleartext = JSON.stringify(cleartext);
}
return {
ciphertext: cleartext, // ciphertext == cleartext with fake crypto
IV: "irrelevant",
hmac: fakeSHA256HMAC(cleartext, CryptoUtils.makeHMACKey("")),
};
}

View File

@ -6,10 +6,6 @@ Cu.import("resource://services-common/async.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/record.js"); Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://testing-common/services/sync/fakeservices.js");
let btoa;
let atob;
let provider = { let provider = {
getFile: function(prop, persistent) { getFile: function(prop, persistent) {
@ -25,26 +21,6 @@ let provider = {
}; };
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider); Services.dirsvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
let timer;
function waitForZeroTimer(callback) {
// First wait >100ms (nsITimers can take up to that much time to fire, so
// we can account for the timer in delayedAutoconnect) and then two event
// loop ticks (to account for the Utils.nextTick() in autoConnect).
let ticks = 2;
function wait() {
if (ticks) {
ticks -= 1;
Utils.nextTick(wait);
return;
}
callback();
}
timer = Utils.namedTimer(wait, 150, {}, "timer");
}
btoa = Cu.import("resource://services-common/log4moz.js").btoa;
atob = Cu.import("resource://services-common/log4moz.js").atob;
// This is needed for loadAddonTestFunctions(). // This is needed for loadAddonTestFunctions().
let gGlobalScope = this; let gGlobalScope = this;
@ -146,33 +122,7 @@ function uninstallAddon(addon) {
Async.waitForSyncCallback(cb); Async.waitForSyncCallback(cb);
} }
function setBasicCredentials(username, password, syncKey) {
let ns = {};
Cu.import("resource://services-sync/service.js", ns);
let auth = ns.Service.identity;
auth.username = username;
auth.basicPassword = password;
auth.syncKey = syncKey;
}
function SyncTestingInfrastructure(username, password, syncKey) {
let ns = {};
Cu.import("resource://services-sync/service.js", ns);
let auth = ns.Service.identity;
auth.account = username || "foo";
auth.basicPassword = password || "password";
auth.syncKey = syncKey || "foo";
ns.Service.serverURL = TEST_SERVER_URL;
ns.Service.clusterURL = TEST_CLUSTER_URL;
this.logStats = initTestLogging();
this.fakeFilesystem = new FakeFilesystemService({});
this.fakeGUIDService = new FakeGUIDService();
this.fakeCryptoService = new FakeCryptoService();
}
_("Setting the identity for passphrase"); _("Setting the identity for passphrase");
Cu.import("resource://services-sync/identity.js"); Cu.import("resource://services-sync/identity.js");
@ -181,17 +131,6 @@ Cu.import("resource://services-sync/identity.js");
* Test setup helpers. * Test setup helpers.
*/ */
// Turn WBO cleartext into fake "encrypted" payload as it goes over the wire.
function encryptPayload(cleartext) {
if (typeof cleartext == "object") {
cleartext = JSON.stringify(cleartext);
}
return {ciphertext: cleartext, // ciphertext == cleartext with fake crypto
IV: "irrelevant",
hmac: fakeSHA256HMAC(cleartext, Utils.makeHMACKey(""))};
}
function generateNewKeys(collectionKeys, collections=null) { function generateNewKeys(collectionKeys, collections=null) {
let wbo = collectionKeys.generateNewKeysWBO(collections); let wbo = collectionKeys.generateNewKeysWBO(collections);
let modified = new_timestamp(); let modified = new_timestamp();

View File

@ -1,8 +1,5 @@
const Cm = Components.manager; const Cm = Components.manager;
const TEST_CLUSTER_URL = "http://localhost:8080/";
const TEST_SERVER_URL = "http://localhost:8080/";
// Shared logging for all HTTP server functions. // Shared logging for all HTTP server functions.
Cu.import("resource://services-common/log4moz.js"); Cu.import("resource://services-common/log4moz.js");
const SYNC_HTTP_LOGGER = "Sync.Test.Server"; const SYNC_HTTP_LOGGER = "Sync.Test.Server";

View File

@ -10,6 +10,7 @@ Cu.import("resource://services-common/preferences.js");
Cu.import("resource://services-sync/addonsreconciler.js"); Cu.import("resource://services-sync/addonsreconciler.js");
Cu.import("resource://services-sync/engines/addons.js"); Cu.import("resource://services-sync/engines/addons.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://testing-common/services/sync/utils.js");
let prefs = new Preferences(); let prefs = new Preferences();
prefs.set("extensions.getAddons.get.url", prefs.set("extensions.getAddons.get.url",

View File

@ -8,6 +8,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/bookmarks.js"); Cu.import("resource://services-sync/engines/bookmarks.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.register(BookmarksEngine); Service.engineManager.register(BookmarksEngine);
var syncTesting = new SyncTestingInfrastructure(); var syncTesting = new SyncTestingInfrastructure();

View File

@ -7,6 +7,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/bookmarks.js"); Cu.import("resource://services-sync/engines/bookmarks.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark"; const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
var IOService = Cc["@mozilla.org/network/io-service;1"] var IOService = Cc["@mozilla.org/network/io-service;1"]

View File

@ -6,6 +6,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/clients.js"); Cu.import("resource://services-sync/engines/clients.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const MORE_THAN_CLIENTS_TTL_REFRESH = 691200; // 8 days const MORE_THAN_CLIENTS_TTL_REFRESH = 691200; // 8 days
const LESS_THAN_CLIENTS_TTL_REFRESH = 86400; // 1 day const LESS_THAN_CLIENTS_TTL_REFRESH = 86400; // 1 day

View File

@ -1,5 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Verify that we wipe the server if we have to regenerate keys. // Verify that we wipe the server if we have to regenerate keys.
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://testing-common/services/sync/utils.js");
add_test(function test_missing_crypto_collection() { add_test(function test_missing_crypto_collection() {
let johnHelper = track_collections_helper(); let johnHelper = track_collections_helper();

View File

@ -10,6 +10,7 @@ Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js"); Cu.import("resource://services-sync/status.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
add_test(function test_locally_changed_keys() { add_test(function test_locally_changed_keys() {
let passphrase = "abcdeabcdeabcdeabcdeabcdea"; let passphrase = "abcdeabcdeabcdeabcdeabcdea";

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/rotaryengine.js"); Cu.import("resource://testing-common/services/sync/rotaryengine.js");
Cu.import("resource://testing-common/services/sync/utils.js");
add_test(function test_processIncoming_abort() { add_test(function test_processIncoming_abort() {
_("An abort exception, raised in applyIncoming, will abort _processIncoming."); _("An abort exception, raised in applyIncoming, will abort _processIncoming.");

View File

@ -7,6 +7,7 @@ Cu.import("resource://services-sync/keys.js");
Cu.import("resource://services-sync/policies.js"); Cu.import("resource://services-sync/policies.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js"); Cu.import("resource://services-sync/status.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const TEST_MAINTENANCE_URL = "http://localhost:8080/maintenance/"; const TEST_MAINTENANCE_URL = "http://localhost:8080/maintenance/";
const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true); const logsdir = FileUtils.getDir("ProfD", ["weave", "logs"], true);

View File

@ -8,6 +8,8 @@ Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js"); Cu.import("resource://services-sync/status.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/fakeservices.js");
Cu.import("resource://testing-common/services/sync/utils.js");
initTestLogging("Trace"); initTestLogging("Trace");

View File

@ -7,6 +7,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/identity.js"); Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.clear(); Service.engineManager.clear();

View File

@ -4,8 +4,8 @@
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/rotaryengine.js"); Cu.import("resource://testing-common/services/sync/rotaryengine.js");
Cu.import("resource://testing-common/services/sync/utils.js");
// Track HMAC error counts. // Track HMAC error counts.
let hmacErrorCount = 0; let hmacErrorCount = 0;

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/engines/clients.js"); Cu.import("resource://services-sync/engines/clients.js");
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Svc.DefaultPrefs.set("registerEngines", ""); Svc.DefaultPrefs.set("registerEngines", "");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");

View File

@ -3,6 +3,7 @@ Cu.import("resource://services-sync/identity.js");
Cu.import("resource://services-sync/jpakeclient.js"); Cu.import("resource://services-sync/jpakeclient.js");
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const JPAKE_LENGTH_SECRET = 8; const JPAKE_LENGTH_SECRET = 8;
const JPAKE_LENGTH_CLIENTID = 256; const JPAKE_LENGTH_CLIENTID = 256;

View File

@ -34,6 +34,7 @@ const modules = [
const testingModules = [ const testingModules = [
"fakeservices.js", "fakeservices.js",
"rotaryengine.js", "rotaryengine.js",
"utils.js",
]; ];
function run_test() { function run_test() {

View File

@ -10,6 +10,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js"); Cu.import("resource://services-sync/status.js");
Cu.import("resource://testing-common/services/sync/rotaryengine.js"); Cu.import("resource://testing-common/services/sync/rotaryengine.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.clear(); Service.engineManager.clear();

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/resource.js"); Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const TEST_GET_URL = "http://localhost:8080/1.1/johndoe/storage/meta/global"; const TEST_GET_URL = "http://localhost:8080/1.1/johndoe/storage/meta/global";

View File

@ -7,6 +7,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js"); Cu.import("resource://services-sync/status.js");
Cu.import("resource://testing-common/services/sync/rotaryengine.js"); Cu.import("resource://testing-common/services/sync/rotaryengine.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.clear(); Service.engineManager.clear();
Service.engineManager.register(RotaryEngine); Service.engineManager.register(RotaryEngine);

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/jpakeclient.js"); Cu.import("resource://services-sync/jpakeclient.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function run_test() { function run_test() {
setBasicCredentials("johndoe", "ilovejane", Utils.generatePassphrase()); setBasicCredentials("johndoe", "ilovejane", Utils.generatePassphrase());

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/fakeservices.js");
function test_urls() { function test_urls() {
_("URL related Service properties corresopnd to preference settings."); _("URL related Service properties corresopnd to preference settings.");

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function run_test() { function run_test() {
initTestLogging("Trace"); initTestLogging("Trace");

View File

@ -1,5 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function run_test() { function run_test() {
do_test_pending(); do_test_pending();

View File

@ -3,6 +3,7 @@
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function do_check_throws(func) { function do_check_throws(func) {
var raised = false; var raised = false;

View File

@ -3,6 +3,7 @@
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function run_test() { function run_test() {
initTestLogging("Trace"); initTestLogging("Trace");

View File

@ -8,6 +8,7 @@ Cu.import("resource://services-sync/engines/tabs.js");
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.register(TabEngine); Service.engineManager.register(TabEngine);

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-common/rest.js");
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
let collections = {steam: 65.11328, let collections = {steam: 65.11328,
petrol: 82.488281, petrol: 82.488281,

View File

@ -6,6 +6,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/policies.js"); Cu.import("resource://services-sync/policies.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function login_handling(handler) { function login_handling(handler) {
return function (request, response) { return function (request, response) {

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-sync/resource.js"); Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const JAPANESE = "\u34ff\u35ff\u36ff\u37ff"; const JAPANESE = "\u34ff\u35ff\u36ff\u37ff";
const APPLES = "\uf8ff\uf8ff\uf8ff\uf8ff"; const APPLES = "\uf8ff\uf8ff\uf8ff\uf8ff";

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function run_test() { function run_test() {
try { try {

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function BlaEngine() { function BlaEngine() {
SyncEngine.call(this, "Bla", Service); SyncEngine.call(this, "Bla", Service);

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-common/observers.js"); Cu.import("resource://services-common/observers.js");
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Svc.Prefs.set("registerEngines", "Tab,Bookmarks,Form,History"); Svc.Prefs.set("registerEngines", "Tab,Bookmarks,Form,History");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/policies.js"); Cu.import("resource://services-sync/policies.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function login_handling(handler) { function login_handling(handler) {
return function (request, response) { return function (request, response) {

View File

@ -6,6 +6,8 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/keys.js"); Cu.import("resource://services-sync/keys.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/fakeservices.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function run_test() { function run_test() {
let logger = Log4Moz.repository.rootLogger; let logger = Log4Moz.repository.rootLogger;

View File

@ -7,6 +7,7 @@ Cu.import("resource://services-sync/engines/clients.js");
Cu.import("resource://services-sync/record.js"); Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
initTestLogging(); initTestLogging();
Service.engineManager.clear(); Service.engineManager.clear();

View File

@ -5,6 +5,7 @@ Cu.import("resource://services-common/log4moz.js");
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function login_handling(handler) { function login_handling(handler) {
return function (request, response) { return function (request, response) {

View File

@ -6,6 +6,7 @@ Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/record.js"); Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.clear(); Service.engineManager.clear();

View File

@ -1,6 +1,8 @@
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://services-sync/record.js"); Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/resource.js"); Cu.import("resource://services-sync/resource.js");
Cu.import("resource://testing-common/services/sync/fakeservices.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Svc.DefaultPrefs.set("registerEngines", ""); Svc.DefaultPrefs.set("registerEngines", "");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");

View File

@ -4,6 +4,7 @@
Cu.import("resource://services-sync/engines.js"); Cu.import("resource://services-sync/engines.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function makeSteamEngine() { function makeSteamEngine() {
return new SyncEngine('Steam', Service); return new SyncEngine('Steam', Service);

View File

@ -8,6 +8,7 @@ Cu.import("resource://services-sync/resource.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/rotaryengine.js"); Cu.import("resource://testing-common/services/sync/rotaryengine.js");
Cu.import("resource://testing-common/services/sync/utils.js");
function makeRotaryEngine() { function makeRotaryEngine() {
return new RotaryEngine(Service); return new RotaryEngine(Service);

View File

@ -8,6 +8,7 @@ Cu.import("resource://services-sync/policies.js");
Cu.import("resource://services-sync/record.js"); Cu.import("resource://services-sync/record.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/status.js"); Cu.import("resource://services-sync/status.js");
Cu.import("resource://testing-common/services/sync/utils.js");
Service.engineManager.clear(); Service.engineManager.clear();

View File

@ -6,6 +6,7 @@ Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/rest.js"); Cu.import("resource://services-sync/rest.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
Cu.import("resource://services-sync/util.js"); Cu.import("resource://services-sync/util.js");
Cu.import("resource://testing-common/services/sync/utils.js");
const STORAGE_REQUEST_RESOURCE_URL = TEST_SERVER_URL + "resource"; const STORAGE_REQUEST_RESOURCE_URL = TEST_SERVER_URL + "resource";

View File

@ -4,8 +4,6 @@
Cu.import("resource://services-sync/constants.js"); Cu.import("resource://services-sync/constants.js");
Cu.import("resource://services-sync/service.js"); Cu.import("resource://services-sync/service.js");
var btoa = Cu.import("resource://services-sync/util.js").btoa;
// Test upgrade of a dashed old-style sync key. // Test upgrade of a dashed old-style sync key.
function run_test() { function run_test() {
const PBKDF2_KEY_BYTES = 16; const PBKDF2_KEY_BYTES = 16;