summaryrefslogtreecommitdiffstats
path: root/services/sync/tests/unit
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-09-02 11:37:51 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-09-02 11:37:51 +0200
commit2781afdf950ec271a8f37016263e71da857895bb (patch)
tree9afdf2c1c88d4c81e006dd02690cb781c3731c46 /services/sync/tests/unit
parent35f68645a333370bedebf093e62a685c2bdef902 (diff)
downloadUXP-2781afdf950ec271a8f37016263e71da857895bb.tar
UXP-2781afdf950ec271a8f37016263e71da857895bb.tar.gz
UXP-2781afdf950ec271a8f37016263e71da857895bb.tar.lz
UXP-2781afdf950ec271a8f37016263e71da857895bb.tar.xz
UXP-2781afdf950ec271a8f37016263e71da857895bb.zip
Remove FxA migrator.
This resolves #637
Diffstat (limited to 'services/sync/tests/unit')
-rw-r--r--services/sync/tests/unit/test_fxa_migration.js117
-rw-r--r--services/sync/tests/unit/xpcshell.ini3
2 files changed, 0 insertions, 120 deletions
diff --git a/services/sync/tests/unit/test_fxa_migration.js b/services/sync/tests/unit/test_fxa_migration.js
deleted file mode 100644
index 0ca770e28..000000000
--- a/services/sync/tests/unit/test_fxa_migration.js
+++ /dev/null
@@ -1,117 +0,0 @@
-// We change this pref before anything else initializes
-Services.prefs.setCharPref("identity.fxaccounts.auth.uri", "http://localhost");
-
-// Test the FxAMigration module
-Cu.import("resource://services-sync/FxaMigrator.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-
-// Set our username pref early so sync initializes with the legacy provider.
-Services.prefs.setCharPref("services.sync.username", "foo");
-// And ensure all debug messages end up being printed.
-Services.prefs.setCharPref("services.sync.log.appender.dump", "Debug");
-
-// Now import sync
-Cu.import("resource://services-sync/service.js");
-Cu.import("resource://services-sync/record.js");
-Cu.import("resource://services-sync/util.js");
-
-// And reset the username.
-Services.prefs.clearUserPref("services.sync.username");
-
-Cu.import("resource://testing-common/services/sync/utils.js");
-Cu.import("resource://testing-common/services/common/logging.js");
-Cu.import("resource://testing-common/services/sync/rotaryengine.js");
-
-const FXA_USERNAME = "someone@somewhere";
-
-// Utilities
-function promiseOneObserver(topic) {
- return new Promise((resolve, reject) => {
- let observer = function(subject, topic, data) {
- Services.obs.removeObserver(observer, topic);
- resolve({ subject: subject, data: data });
- }
- Services.obs.addObserver(observer, topic, false);
- });
-}
-
-function promiseStopServer(server) {
- return new Promise((resolve, reject) => {
- server.stop(resolve);
- });
-}
-
-
-// Helpers
-function configureLegacySync() {
- let engine = new RotaryEngine(Service);
- engine.enabled = true;
- Svc.Prefs.set("registerEngines", engine.name);
- Svc.Prefs.set("log.logger.engine.rotary", "Trace");
-
- let contents = {
- meta: {global: {engines: {rotary: {version: engine.version,
- syncID: engine.syncID}}}},
- crypto: {},
- rotary: {}
- };
-
- const USER = "foo";
- const PASSPHRASE = "abcdeabcdeabcdeabcdeabcdea";
-
- setBasicCredentials(USER, "password", PASSPHRASE);
-
- let onRequest = function(request, response) {
- // ideally we'd only do this while a legacy user is configured, but WTH.
- response.setHeader("x-weave-alert", JSON.stringify({code: "soft-eol"}));
- }
- let server = new SyncServer({onRequest: onRequest});
- server.registerUser(USER, "password");
- server.createContents(USER, contents);
- server.start();
-
- Service.serverURL = server.baseURI;
- Service.clusterURL = server.baseURI;
- Service.identity.username = USER;
- Service._updateCachedURLs();
-
- Service.engineManager._engines[engine.name] = engine;
-
- return [engine, server];
-}
-
-add_task(function *testMigrationUnlinks() {
-
- // when we do a .startOver we want the new provider.
- let oldValue = Services.prefs.getBoolPref("services.sync-testing.startOverKeepIdentity");
- Services.prefs.setBoolPref("services.sync-testing.startOverKeepIdentity", false);
-
- do_register_cleanup(() => {
- Services.prefs.setBoolPref("services.sync-testing.startOverKeepIdentity", oldValue)
- });
-
- // Arrange for a legacy sync user.
- let [engine, server] = configureLegacySync();
-
- // Start a sync - this will cause an EOL notification which the migrator's
- // observer will notice.
- let promiseMigration = promiseOneObserver("fxa-migration:state-changed");
- let promiseStartOver = promiseOneObserver("weave:service:start-over:finish");
- _("Starting sync");
- Service.sync();
- _("Finished sync");
-
- yield promiseStartOver;
- yield promiseMigration;
- // We should have seen the observer and Sync should no longer be configured.
- Assert.ok(!Services.prefs.prefHasUserValue("services.sync.username"));
-});
-
-function run_test() {
- initTestLogging();
- do_register_cleanup(() => {
- fxaMigrator.finalize();
- Svc.Prefs.resetBranch("");
- });
- run_next_test();
-}
diff --git a/services/sync/tests/unit/xpcshell.ini b/services/sync/tests/unit/xpcshell.ini
index 609003ce9..4c0f0e7b7 100644
--- a/services/sync/tests/unit/xpcshell.ini
+++ b/services/sync/tests/unit/xpcshell.ini
@@ -190,9 +190,6 @@ support-files = prefs_test_prefs_store.js
[test_warn_on_truncated_response.js]
[test_postqueue.js]
-# FxA migration
-[test_fxa_migration.js]
-
# Synced tabs.
[test_syncedtabs.js]