Bug 1220906 - Part 4: Remove tests referencing SyncAccounts. r?rnewman draft
authorNick Alexander <nalexander@mozilla.com>
Mon, 18 Jan 2016 16:28:53 -0800
changeset 323263 5fb01e0014964e70da332cd2ef8de0be74538093
parent 323262 0fe55dc6012b5895fc465b45ec5bd35bed5d64ec
child 323264 ffda6a31c28425939fdee29c39665bf5efe46b2a
push id9692
push usernalexander@mozilla.com
push dateTue, 19 Jan 2016 22:55:33 +0000
reviewersrnewman
bugs1220906
milestone46.0a1
Bug 1220906 - Part 4: Remove tests referencing SyncAccounts. r?rnewman
mobile/android/tests/background/junit3/background_junit3_sources.mozbuild
mobile/android/tests/background/junit3/instrumentation.ini
mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/AndroidSyncTestCaseWithAccounts.java
mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestAccountPickler.java
mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestConfigurationMigrator.java
mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestSyncAccounts.java
mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestSyncAuthenticatorService.java
mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestUpgradeRequired.java
--- a/mobile/android/tests/background/junit3/background_junit3_sources.mozbuild
+++ b/mobile/android/tests/background/junit3/background_junit3_sources.mozbuild
@@ -59,27 +59,22 @@ background_junit3_sources = [
     'src/org/mozilla/gecko/background/sync/helpers/HistoryHelpers.java',
     'src/org/mozilla/gecko/background/sync/helpers/PasswordHelpers.java',
     'src/org/mozilla/gecko/background/sync/helpers/SessionTestHelper.java',
     'src/org/mozilla/gecko/background/sync/helpers/SimpleSuccessBeginDelegate.java',
     'src/org/mozilla/gecko/background/sync/helpers/SimpleSuccessCreationDelegate.java',
     'src/org/mozilla/gecko/background/sync/helpers/SimpleSuccessFetchDelegate.java',
     'src/org/mozilla/gecko/background/sync/helpers/SimpleSuccessFinishDelegate.java',
     'src/org/mozilla/gecko/background/sync/helpers/SimpleSuccessStoreDelegate.java',
-    'src/org/mozilla/gecko/background/sync/TestAccountPickler.java',
     'src/org/mozilla/gecko/background/sync/TestClientsStage.java',
-    'src/org/mozilla/gecko/background/sync/TestConfigurationMigrator.java',
     'src/org/mozilla/gecko/background/sync/TestResetting.java',
     'src/org/mozilla/gecko/background/sync/TestSendTabData.java',
     'src/org/mozilla/gecko/background/sync/TestStoreTracking.java',
-    'src/org/mozilla/gecko/background/sync/TestSyncAccounts.java',
-    'src/org/mozilla/gecko/background/sync/TestSyncAuthenticatorService.java',
     'src/org/mozilla/gecko/background/sync/TestSyncConfiguration.java',
     'src/org/mozilla/gecko/background/sync/TestTabsRecord.java',
-    'src/org/mozilla/gecko/background/sync/TestUpgradeRequired.java',
     'src/org/mozilla/gecko/background/sync/TestWebURLFinder.java',
     'src/org/mozilla/gecko/background/testhelpers/BaseMockServerSyncStage.java',
     'src/org/mozilla/gecko/background/testhelpers/CommandHelpers.java',
     'src/org/mozilla/gecko/background/testhelpers/DefaultGlobalSessionCallback.java',
     'src/org/mozilla/gecko/background/testhelpers/JPakeNumGeneratorFixed.java',
     'src/org/mozilla/gecko/background/testhelpers/MockAbstractNonRepositorySyncStage.java',
     'src/org/mozilla/gecko/background/testhelpers/MockClientsDatabaseAccessor.java',
     'src/org/mozilla/gecko/background/testhelpers/MockClientsDataDelegate.java',
--- a/mobile/android/tests/background/junit3/instrumentation.ini
+++ b/mobile/android/tests/background/junit3/instrumentation.ini
@@ -15,20 +15,15 @@ subsuite = background
 [src/org/mozilla/gecko/background/db/TestClientsDatabaseAccessor.java]
 [src/org/mozilla/gecko/background/db/TestFennecTabsRepositorySession.java]
 [src/org/mozilla/gecko/background/db/TestFennecTabsStorage.java]
 [src/org/mozilla/gecko/background/db/TestFormHistoryRepositorySession.java]
 [src/org/mozilla/gecko/background/db/TestPasswordsRepository.java]
 [src/org/mozilla/gecko/background/fxa/TestBrowserIDKeyPairGeneration.java]
 [src/org/mozilla/gecko/background/fxa/authenticator/TestAccountPickler.java]
 [src/org/mozilla/gecko/background/nativecode/test/TestNativeCrypto.java]
-[src/org/mozilla/gecko/background/sync/TestAccountPickler.java]
 [src/org/mozilla/gecko/background/sync/TestClientsStage.java]
-[src/org/mozilla/gecko/background/sync/TestConfigurationMigrator.java]
 [src/org/mozilla/gecko/background/sync/TestResetting.java]
 [src/org/mozilla/gecko/background/sync/TestSendTabData.java]
 [src/org/mozilla/gecko/background/sync/TestStoreTracking.java]
-[src/org/mozilla/gecko/background/sync/TestSyncAccounts.java]
-[src/org/mozilla/gecko/background/sync/TestSyncAuthenticatorService.java]
 [src/org/mozilla/gecko/background/sync/TestSyncConfiguration.java]
 [src/org/mozilla/gecko/background/sync/TestTabsRecord.java]
-[src/org/mozilla/gecko/background/sync/TestUpgradeRequired.java]
 [src/org/mozilla/gecko/background/sync/TestWebURLFinder.java]
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/AndroidSyncTestCaseWithAccounts.java
+++ b/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/AndroidSyncTestCaseWithAccounts.java
@@ -1,26 +1,30 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 package org.mozilla.gecko.background.sync;
 
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AccountManagerCallback;
+import android.accounts.AccountManagerFuture;
+import android.content.Context;
+import android.test.InstrumentationTestCase;
+
+import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
+import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
+
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
-import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
-import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.Context;
+import java.util.concurrent.TimeUnit;
 
 public class AndroidSyncTestCaseWithAccounts extends AndroidSyncTestCase {
   public final String testAccountType;
   public final String testAccountPrefix;
 
   protected Context context;
   protected AccountManager accountManager;
   protected int numAccounts;
@@ -56,19 +60,48 @@ public class AndroidSyncTestCaseWithAcco
       if (account.name.startsWith(testAccountPrefix)) {
         testAccounts.add(account);
       }
     }
 
     return testAccounts;
   }
 
+  public static void deleteAccount(final InstrumentationTestCase test, final AccountManager accountManager, final Account account) {
+    performWait(new Runnable() {
+      @Override
+      public void run() {
+        try {
+          test.runTestOnUiThread(new Runnable() {
+            final AccountManagerCallback<Boolean> callback = new AccountManagerCallback<Boolean>() {
+              @Override
+              public void run(AccountManagerFuture<Boolean> future) {
+                try {
+                  future.getResult(5L, TimeUnit.SECONDS);
+                } catch (Exception e) {
+                }
+                performNotify();
+              }
+            };
+
+            @Override
+            public void run() {
+              accountManager.removeAccount(account, callback, null);
+            }
+          });
+        } catch (Throwable e) {
+          performNotify(e);
+        }
+      }
+    });
+  }
+
   public void deleteTestAccounts() {
     for (Account account : getTestAccounts()) {
-      TestSyncAccounts.deleteAccount(this, accountManager, account);
+      deleteAccount(this, accountManager, account);
     }
   }
 
   public boolean testAccountsExist() {
     // Note that we don't use FirefoxAccounts.firefoxAccountsExist because it unpickles.
     return !getTestAccounts().isEmpty();
   }
 
deleted file mode 100644
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestAccountPickler.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko.background.sync;
-
-import java.io.FileOutputStream;
-import java.io.PrintStream;
-
-import org.mozilla.gecko.background.common.GlobalConstants;
-import org.mozilla.gecko.db.BrowserContract;
-import org.mozilla.gecko.sync.ExtendedJSONObject;
-import org.mozilla.gecko.sync.SyncConfiguration;
-import org.mozilla.gecko.sync.SyncConstants;
-import org.mozilla.gecko.sync.Utils;
-import org.mozilla.gecko.sync.config.AccountPickler;
-import org.mozilla.gecko.sync.setup.Constants;
-import org.mozilla.gecko.sync.setup.SyncAccounts;
-import org.mozilla.gecko.sync.setup.SyncAccounts.SyncAccountParameters;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.SharedPreferences;
-
-public class TestAccountPickler extends AndroidSyncTestCaseWithAccounts {
-  public static final String TEST_FILENAME = "test.json";
-  public static final String TEST_ACCOUNTTYPE = SyncConstants.ACCOUNTTYPE_SYNC;
-
-  // Test account names must start with TEST_USERNAME in order to be recognized
-  // as test accounts and deleted in tearDown.
-  public static final String TEST_USERNAME   = "testAccount@mozilla.com";
-  public static final String TEST_USERNAME2  = TEST_USERNAME + "2";
-
-  public static final String TEST_SYNCKEY    = "testSyncKey";
-  public static final String TEST_PASSWORD   = "testPassword";
-  public static final String TEST_SERVER_URL = "test.server.url/";
-  public static final String TEST_CLUSTER_URL  = "test.cluster.url/";
-  public static final String TEST_CLIENT_NAME = "testClientName";
-  public static final String TEST_CLIENT_GUID = "testClientGuid";
-
-  public static final String TEST_PRODUCT = GlobalConstants.BROWSER_INTENT_PACKAGE;
-  public static final String TEST_PROFILE = "default";
-  public static final long TEST_VERSION = SyncConfiguration.CURRENT_PREFS_VERSION;
-
-  protected SyncAccountParameters params;
-
-  public TestAccountPickler() {
-    super(TEST_ACCOUNTTYPE, TEST_USERNAME);
-  }
-
-  @Override
-  public void setUp() {
-    super.setUp();
-    params = new SyncAccountParameters(context, accountManager,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVER_URL,
-        TEST_CLUSTER_URL, TEST_CLIENT_NAME, TEST_CLIENT_GUID);
-  }
-
-  public void testPersist() throws Exception {
-    context.deleteFile(TEST_FILENAME);
-    assertFileNotPresent(context, TEST_FILENAME);
-
-    AccountPickler.pickle(context, TEST_FILENAME, params, true);
-
-    final String s = Utils.readFile(context, TEST_FILENAME);
-    assertNotNull(s);
-
-    final ExtendedJSONObject o = ExtendedJSONObject.parseJSONObject(s);
-    assertEquals(TEST_USERNAME,  o.getString(Constants.JSON_KEY_ACCOUNT));
-    assertEquals(TEST_PASSWORD,  o.getString(Constants.JSON_KEY_PASSWORD));
-    assertEquals(TEST_SERVER_URL, o.getString(Constants.JSON_KEY_SERVER));
-    assertEquals(TEST_SYNCKEY,   o.getString(Constants.JSON_KEY_SYNCKEY));
-    assertEquals(TEST_CLUSTER_URL, o.getString(Constants.JSON_KEY_CLUSTER));
-    assertEquals(TEST_CLIENT_NAME, o.getString(Constants.JSON_KEY_CLIENT_NAME));
-    assertEquals(TEST_CLIENT_GUID, o.getString(Constants.JSON_KEY_CLIENT_GUID));
-    assertEquals(Boolean.valueOf(true), o.get(Constants.JSON_KEY_SYNC_AUTOMATICALLY));
-    assertEquals(Long.valueOf(AccountPickler.VERSION), o.getLong(Constants.JSON_KEY_VERSION));
-    assertTrue(o.containsKey(Constants.JSON_KEY_TIMESTAMP));
-  }
-
-  public void testDeletePickle() throws Exception {
-    AccountPickler.pickle(context, TEST_FILENAME, params, false);
-
-    // Verify file is present.
-    final String s = Utils.readFile(context, TEST_FILENAME);
-    assertNotNull(s);
-    assertTrue(s.length() > 0);
-
-    AccountPickler.deletePickle(context, TEST_FILENAME);
-    assertFileNotPresent(context, TEST_FILENAME);
-  }
-
-  public Account deleteAccountsAndUnpickle(final Context context, final AccountManager accountManager, final String filename) {
-    deleteTestAccounts();
-    assertEquals(0, getTestAccounts().size());
-
-    return AccountPickler.unpickle(context, filename);
-  }
-
-  public void testUnpickleSuccess() throws Exception {
-    AccountPickler.pickle(context, TEST_FILENAME, params, true);
-
-    // Make sure we have no accounts hanging around.
-    final Account account = deleteAccountsAndUnpickle(context, accountManager, TEST_FILENAME);
-    assertNotNull(account);
-
-    try {
-      assertEquals(1, getTestAccounts().size());
-      assertTrue(ContentResolver.getSyncAutomatically(account, BrowserContract.AUTHORITY));
-      assertEquals(account.name, TEST_USERNAME);
-
-      // Verify Account parameters are in place.  Not testing clusterURL since it's stored in
-      // shared prefs and it's less critical.
-      final String password = accountManager.getPassword(account);
-      final String serverURL  = accountManager.getUserData(account, Constants.OPTION_SERVER);
-      final String syncKey    = accountManager.getUserData(account, Constants.OPTION_SYNCKEY);
-
-      assertEquals(TEST_PASSWORD, password);
-      assertEquals(TEST_SERVER_URL, serverURL);
-      assertEquals(TEST_SYNCKEY, syncKey);
-
-      // Verify shared prefs parameters are in place.
-      final SharedPreferences prefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME, TEST_SERVER_URL, TEST_PROFILE, TEST_VERSION);
-      final String clusterURL = prefs.getString(SyncConfiguration.PREF_CLUSTER_URL, null);
-      final String clientName = prefs.getString(SyncConfiguration.PREF_CLIENT_NAME, null);
-      final String clientGuid = prefs.getString(SyncConfiguration.PREF_ACCOUNT_GUID, null);
-
-      assertEquals(TEST_CLUSTER_URL, clusterURL);
-      assertEquals(TEST_CLIENT_NAME, clientName);
-      assertEquals(TEST_CLIENT_GUID, clientGuid);
-    } finally {
-      TestSyncAccounts.deleteAccount(this, accountManager, account);
-    }
-  }
-
-  public void testUnpickleNoAutomatic() throws Exception {
-    AccountPickler.pickle(context, TEST_FILENAME, params, false);
-
-    // Make sure we have no accounts hanging around.
-    final Account account = deleteAccountsAndUnpickle(context, accountManager, TEST_FILENAME);
-    assertNotNull(account);
-
-    try {
-      assertEquals(1, getTestAccounts().size());
-      assertFalse(ContentResolver.getSyncAutomatically(account, BrowserContract.AUTHORITY));
-    } finally {
-      TestSyncAccounts.deleteAccount(this, accountManager, account);
-    }
-  }
-
-  public void testUnpickleNoFile() {
-    // Just in case file is hanging around.
-    context.deleteFile(TEST_FILENAME);
-
-    final Account account = deleteAccountsAndUnpickle(context, accountManager, TEST_FILENAME);
-    assertNull(account);
-  }
-
-  public void testUnpickleIncompleteUserData() throws Exception {
-    final FileOutputStream fos = context.openFileOutput(TEST_FILENAME, Context.MODE_PRIVATE);
-    final PrintStream ps = (new PrintStream(fos));
-    ps.print("{}"); // Valid JSON, just missing everything.
-    ps.close();
-    fos.close();
-
-    final Account account = deleteAccountsAndUnpickle(context, accountManager, TEST_FILENAME);
-    assertNull(account);
-  }
-
-  public void testUnpickleMalformedFile() throws Exception {
-    final FileOutputStream fos = context.openFileOutput(TEST_FILENAME, Context.MODE_PRIVATE);
-    final PrintStream ps = (new PrintStream(fos));
-    ps.print("{1:!}"); // Not valid JSON.
-    ps.close();
-    fos.close();
-
-    final Account account = deleteAccountsAndUnpickle(context, accountManager, TEST_FILENAME);
-    assertNull(account);
-  }
-
-  public void testUnpickleAccountAlreadyExists() {
-    AccountPickler.pickle(context, TEST_FILENAME, params, false);
-
-    // Make sure we have no test accounts hanging around.
-    final Account account = deleteAccountsAndUnpickle(context, accountManager, TEST_FILENAME);
-    assertNotNull(account);
-    assertEquals(TEST_USERNAME, account.name);
-
-    // Now replace file with new username.
-    params = new SyncAccountParameters(context, accountManager,
-        TEST_USERNAME2, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVER_URL, null, TEST_CLIENT_NAME, TEST_CLIENT_GUID);
-    AccountPickler.pickle(context, TEST_FILENAME, params, false);
-
-    // Checking if sync accounts exist could try to unpickle. That unpickle
-    // would load an account with a different username, so we can check that
-    // nothing was unpickled by verifying that the username has not changed.
-    assertTrue(SyncAccounts.syncAccountsExist(context));
-
-    for (Account a : getTestAccounts()) {
-      assertEquals(TEST_USERNAME, a.name);
-    }
-  }
-}
deleted file mode 100644
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestConfigurationMigrator.java
+++ /dev/null
@@ -1,286 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko.background.sync;
-
-import java.util.Map;
-
-import org.mozilla.gecko.background.common.GlobalConstants;
-import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
-import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
-import org.mozilla.gecko.sync.ExtendedJSONObject;
-import org.mozilla.gecko.sync.PrefsBackoffHandler;
-import org.mozilla.gecko.sync.SyncConfiguration;
-import org.mozilla.gecko.sync.SyncConstants;
-import org.mozilla.gecko.sync.Utils;
-import org.mozilla.gecko.sync.config.ConfigurationMigrator;
-import org.mozilla.gecko.sync.setup.SyncAccounts;
-import org.mozilla.gecko.sync.setup.SyncAccounts.SyncAccountParameters;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-
-public class TestConfigurationMigrator extends AndroidSyncTestCase {
-  /**
-   * A migrator that makes public certain protected static functions for testing.
-   */
-  protected static class PublicMigrator extends ConfigurationMigrator {
-    public static int upgradeGlobals0to1(final SharedPreferences from, final SharedPreferences to) throws Exception {
-      return ConfigurationMigrator.upgradeGlobals0to1(from, to);
-    }
-
-    public static int downgradeGlobals1to0(final SharedPreferences from, final SharedPreferences to) throws Exception {
-      return ConfigurationMigrator.downgradeGlobals1to0(from, to);
-    }
-
-    public static int upgradeShared0to1(final SharedPreferences from, final SharedPreferences to) {
-      return ConfigurationMigrator.upgradeShared0to1(from, to);
-    }
-
-    public static int downgradeShared1to0(final SharedPreferences from, final SharedPreferences to) {
-      return ConfigurationMigrator.downgradeShared1to0(from, to);
-    }
-
-    public static int upgradeAndroidAccount0to1(final AccountManager accountManager, final Account account, final SharedPreferences to) throws Exception {
-      return ConfigurationMigrator.upgradeAndroidAccount0to1(accountManager, account, to);
-    }
-
-    public static int downgradeAndroidAccount1to0(final SharedPreferences from, final AccountManager accountManager, final Account account) throws Exception {
-      return ConfigurationMigrator.downgradeAndroidAccount1to0(from, accountManager, account);
-    }
-  };
-
-  public static final String TEST_USERNAME   = "test@mozilla.com";
-  public static final String TEST_SYNCKEY    = "testSyncKey";
-  public static final String TEST_PASSWORD   = "testPassword";
-  public static final String TEST_SERVERURL = null;
-  public static final String TEST_PROFILE   = "default";
-  public static final String TEST_PRODUCT   = GlobalConstants.BROWSER_INTENT_PACKAGE;
-
-  public static final String TEST_GUID = "testGuid";
-  public static final String TEST_CLIENT_NAME = "test's Nightly on test";
-  public static final long TEST_NUM_CLIENTS = 2;
-
-  protected static void putJSON(final Editor editor, final String name, final String JSON) throws Exception {
-    editor.putString(name, ExtendedJSONObject.parseJSONObject(JSON).toJSONString());
-  }
-
-  /**
-   * Write a complete set of unversioned account prefs suitable for testing forward migration.
-   * @throws Exception
-   */
-  public void populateAccountSharedPrefs(final SharedPreferences to) throws Exception {
-    final Editor editor = to.edit();
-
-    putJSON(editor, "forms.remote", "{\"timestamp\":1340402010180}");
-    putJSON(editor, "forms.local",  "{\"timestamp\":1340402018565}");
-    editor.putString("forms.syncID", "JKAkk-wUEUpX");
-
-    putJSON(editor, "tabs.remote", "{\"timestamp\":1340401964300}");
-    putJSON(editor, "tabs.local",  "{\"timestamp\":1340401970533}");
-    editor.putString("tabs.syncID", "604bXkw7dnUq");
-
-    putJSON(editor, "passwords.remote", "{\"timestamp\":1340401965150}");
-    putJSON(editor, "passwords.local",  "{\"timestamp\":1340402005243}");
-    editor.putString("passwords.syncID", "VkTH0QiVj6dD");
-
-    putJSON(editor, "history.remote", "{\"timestamp\":1340402003640}");
-    putJSON(editor, "history.local",  "{\"timestamp\":1340402015381}");
-    editor.putString("history.syncID", "fs1241n-JyWh");
-
-    putJSON(editor, "bookmarks.remote", "{\"timestamp\":1340402003370}");
-    putJSON(editor, "bookmarks.local",  "{\"timestamp\":1340402008397}");
-    editor.putString("bookmarks.syncID", "P8gG8ERuJ4H1");
-
-    editor.putLong("metaGlobalLastModified", 1340401961960L);
-    putJSON(editor, "metaGlobalServerResponseBody", "{\"ttl\":31536000,\"id\":\"global\",\"payload\":\"{\\\"storageVersion\\\":5,\\\"syncID\\\":\\\"Z2RopSDg-0bE\\\",\\\"engines\\\":{\\\"history\\\":{\\\"syncID\\\":\\\"fs1241n-JyWh\\\",\\\"version\\\":1},\\\"bookmarks\\\":{\\\"syncID\\\":\\\"P8gG8ERuJ4H1\\\",\\\"version\\\":2},\\\"passwords\\\":{\\\"syncID\\\":\\\"VkTH0QiVj6dD\\\",\\\"version\\\":1},\\\"prefs\\\":{\\\"syncID\\\":\\\"4lESgyoYPXYI\\\",\\\"version\\\":2},\\\"addons\\\":{\\\"syncID\\\":\\\"yCkJKkH-okoS\\\",\\\"version\\\":1},\\\"forms\\\":{\\\"syncID\\\":\\\"JKAkk-wUEUpX\\\",\\\"version\\\":1},\\\"clients\\\":{\\\"syncID\\\":\\\"KfANCdkZNOFJ\\\",\\\"version\\\":1},\\\"tabs\\\":{\\\"syncID\\\":\\\"604bXkw7dnUq\\\",\\\"version\\\":1}}}\"}");
-
-    editor.putLong("crypto5KeysLastModified", 1340401962760L);
-    putJSON(editor, "crypto5KeysServerResponseBody", "{\"ttl\":31536000,\"id\":\"keys\",\"payload\":\"{\\\"ciphertext\\\":\\\"+ZH6AaMhnKOWS7OzpdMfT5X2C7AYgax5JRd2HY4BHAFNPDv8\\\\\\/TwQIJgFDuNjASo0WEujjdkFot39qeQ24RLAz4D11rG\\\\\\/FZwo8FEUB9aSfec1N6sao6KzWkSamdqiJSRjpsUKexp2it1HvwqRDEBH\\\\\\/lgue11axv51u1MAV3ZfX2fdzVIiGTqF1YJAvENZtol3pyEh2HI4FZlv+oLW250nV4w1vAfDNGLVbbjXbdR+kec=\\\",\\\"IV\\\":\\\"bHqF\\\\\\/4PshKt2GQ\\\\\\/njGj2Jw==\\\",\\\"hmac\\\":\\\"f97c20d5c0a141f62a1571a108de1bad4b854b29c8d4b2b0d36da73421e4becc\\\"}\"}");
-
-    editor.putString("syncID", "Z2RopSDg-0bE");
-    editor.putString("clusterURL", "https://scl2-sync3.services.mozilla.com/");
-    putJSON(editor, "enabledEngineNames", "{\"history\":0,\"bookmarks\":0,\"passwords\":0,\"prefs\":0,\"addons\":0,\"forms\":0,\"clients\":0,\"tabs\":0}");
-
-    editor.putLong("serverClientsTimestamp", 1340401963950L);
-    editor.putLong("serverClientRecordTimestamp", 1340401963950L);
-
-    editor.commit();
-  }
-
-  /**
-   * Write a complete set of unversioned global prefs suitable for testing forward migration.
-   * @throws Exception
-   */
-  public void populateGlobalSharedPrefs(final SharedPreferences to) throws Exception {
-    final Editor editor = to.edit();
-
-    editor.putLong("earliestnextsync", 1340402318649L);
-    editor.putBoolean("clusterurlisstale", false);
-
-    editor.commit();
-  }
-
-  /**
-   * Write a complete set of unversioned Account data suitable for testing forward migration.
-   * @throws Exception
-   */
-  public void populateAccountData(final AccountManager accountManager, final Account account) throws Exception {
-    accountManager.setUserData(account, "account.guid", TEST_GUID);
-    accountManager.setUserData(account, "account.clientName", TEST_CLIENT_NAME);
-    accountManager.setUserData(account, "account.numClients", Long.valueOf(TEST_NUM_CLIENTS).toString());
-  }
-
-  public void testMigrateGlobals0and1() throws Exception {
-    final SharedPreferences v0a = new MockSharedPreferences();
-    final SharedPreferences v1a = new MockSharedPreferences();
-    final SharedPreferences v0b = new MockSharedPreferences();
-    final SharedPreferences v1b = new MockSharedPreferences();
-
-    populateGlobalSharedPrefs(v0a);
-
-    final int NUM_GLOBALS = 2;
-    assertEquals(NUM_GLOBALS, v0a.getAll().size());
-    assertEquals(NUM_GLOBALS, PublicMigrator.upgradeGlobals0to1(v0a, v1a));
-    assertEquals(NUM_GLOBALS, PublicMigrator.downgradeGlobals1to0(v1a, v0b));
-    assertEquals(NUM_GLOBALS, PublicMigrator.upgradeGlobals0to1(v0b, v1b));
-    assertEquals(v0a.getAll(), v0b.getAll());
-    assertEquals(v1a.getAll(), v1b.getAll());
-  }
-
-  public void testMigrateShared0and1() throws Exception {
-    final SharedPreferences v0a = new MockSharedPreferences();
-    final SharedPreferences v1a = new MockSharedPreferences();
-    final SharedPreferences v0b = new MockSharedPreferences();
-    final SharedPreferences v1b = new MockSharedPreferences();
-
-    populateAccountSharedPrefs(v0a);
-
-    final int NUM_GLOBALS = 24;
-    assertEquals(NUM_GLOBALS, v0a.getAll().size());
-    assertEquals(NUM_GLOBALS, PublicMigrator.upgradeShared0to1(v0a, v1a));
-    assertEquals(NUM_GLOBALS, PublicMigrator.downgradeShared1to0(v1a, v0b));
-    assertEquals(NUM_GLOBALS, PublicMigrator.upgradeShared0to1(v0b, v1b));
-    assertEquals(v0a.getAll(), v0b.getAll());
-    assertEquals(v1a.getAll(), v1b.getAll());
-  }
-
-  public void testMigrateAccount0and1() throws Exception {
-    final Context context = getApplicationContext();
-    final AccountManager accountManager = AccountManager.get(context);
-    final SyncAccountParameters syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, null);
-
-    Account account = null;
-    try {
-      account = SyncAccounts.createSyncAccount(syncAccount, false);
-      populateAccountData(accountManager, account);
-
-      final int NUM_ACCOUNTS = 3;
-      final SharedPreferences a = new MockSharedPreferences();
-      final SharedPreferences b = new MockSharedPreferences();
-
-      assertEquals(NUM_ACCOUNTS, PublicMigrator.upgradeAndroidAccount0to1(accountManager, account, a));
-      assertEquals(NUM_ACCOUNTS, a.getAll().size());
-      assertEquals(NUM_ACCOUNTS, PublicMigrator.downgradeAndroidAccount1to0(a, accountManager, account));
-
-      TestSyncAccounts.deleteAccount(this, accountManager, account);
-      account = SyncAccounts.createSyncAccount(syncAccount, false);
-
-      assertEquals(NUM_ACCOUNTS, PublicMigrator.downgradeAndroidAccount1to0(a, accountManager, account));
-      assertEquals(NUM_ACCOUNTS, PublicMigrator.upgradeAndroidAccount0to1(accountManager, account, b));
-      assertEquals(a.getAll(), b.getAll());
-    } finally {
-      if (account != null) {
-        TestSyncAccounts.deleteAccount(this, accountManager, account);
-      }
-    }
-  }
-
-  public void testMigrate0to1() throws Exception {
-    final Context context = getApplicationContext();
-
-    final String ACCOUNT_SHARED_PREFS_NAME = "sync.prefs.3qyu5zoqpuu4zhdiv5l2qthsiter3vop";
-    final String GLOBAL_SHARED_PREFS_NAME = "sync.prefs.global";
-
-    final String path = Utils.getPrefsPath(TEST_PRODUCT, TEST_USERNAME, TEST_SERVERURL, TEST_PROFILE, 0);
-    assertEquals(ACCOUNT_SHARED_PREFS_NAME, path);
-    final SharedPreferences accountPrefs = context.getSharedPreferences(ACCOUNT_SHARED_PREFS_NAME, Utils.SHARED_PREFERENCES_MODE);
-    final SharedPreferences globalPrefs = context.getSharedPreferences(GLOBAL_SHARED_PREFS_NAME, Utils.SHARED_PREFERENCES_MODE);
-
-    accountPrefs.edit().clear().commit();
-    globalPrefs.edit().clear().commit();
-    // Clear prefs we're about to write into.
-    final SharedPreferences existingPrefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME, TEST_SERVERURL, TEST_PROFILE, 1);
-    existingPrefs.edit().clear().commit();
-
-    final AccountManager accountManager = AccountManager.get(context);
-    final SyncAccountParameters syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, null);
-
-    Account account = null;
-    try {
-      account = SyncAccounts.createSyncAccount(syncAccount, false); // Wipes prefs.
-
-      populateAccountSharedPrefs(accountPrefs);
-      populateGlobalSharedPrefs(globalPrefs);
-      populateAccountData(accountManager, account);
-
-      ConfigurationMigrator.upgrade0to1(context, accountManager, account, TEST_PRODUCT, TEST_USERNAME, TEST_SERVERURL, TEST_PROFILE);
-    } finally {
-      if (account != null) {
-        TestSyncAccounts.deleteAccount(this, accountManager, account);
-      }
-    }
-
-    Map<String, ?> origAccountPrefs = accountPrefs.getAll();
-    Map<String, ?> origGlobalPrefs = globalPrefs.getAll();
-    assertFalse(origAccountPrefs.isEmpty());
-    assertFalse(origGlobalPrefs.isEmpty());
-
-    final SharedPreferences newPrefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME, TEST_SERVERURL, TEST_PROFILE, 1);
-
-    // Some global stuff.
-    assertEquals(false, newPrefs.getBoolean(SyncConfiguration.PREF_CLUSTER_URL_IS_STALE, true));
-    assertEquals(1340402318649L, newPrefs.getLong(PrefsBackoffHandler.PREF_EARLIEST_NEXT + SyncConstants.BACKOFF_PREF_SUFFIX_11, 111));
-    // Some per-Sync account stuff.
-    assertEquals("{\"timestamp\":1340402003370}", newPrefs.getString("bookmarks.remote", null));
-    assertEquals("{\"timestamp\":1340402008397}", newPrefs.getString("bookmarks.local", null));
-    assertEquals("P8gG8ERuJ4H1", newPrefs.getString("bookmarks.syncID", null));
-    assertEquals(1340401961960L, newPrefs.getLong("metaGlobalLastModified", 0));
-    // Some per-Android account stuff.
-    assertEquals(TEST_GUID, newPrefs.getString(SyncConfiguration.PREF_ACCOUNT_GUID, null));
-    assertEquals(TEST_CLIENT_NAME, newPrefs.getString(SyncConfiguration.PREF_CLIENT_NAME, null));
-    assertEquals(TEST_NUM_CLIENTS, newPrefs.getLong(SyncConfiguration.PREF_NUM_CLIENTS, -1L));
-
-    // Now try to downgrade.
-    accountPrefs.edit().clear().commit();
-    globalPrefs.edit().clear().commit();
-
-    account = null;
-    try {
-      account = SyncAccounts.createSyncAccount(syncAccount, false);
-
-      ConfigurationMigrator.downgrade1to0(context, accountManager, account, TEST_PRODUCT, TEST_USERNAME, TEST_SERVERURL, TEST_PROFILE);
-
-      final String V0_PREF_ACCOUNT_GUID = "account.guid";
-      final String V0_PREF_CLIENT_NAME = "account.clientName";
-      final String V0_PREF_NUM_CLIENTS = "account.numClients";
-
-      assertEquals(TEST_GUID, accountManager.getUserData(account, V0_PREF_ACCOUNT_GUID));
-      assertEquals(TEST_CLIENT_NAME, accountManager.getUserData(account, V0_PREF_CLIENT_NAME));
-      assertEquals(Long.valueOf(TEST_NUM_CLIENTS).toString(), accountManager.getUserData(account, V0_PREF_NUM_CLIENTS));
-    } finally {
-      if (account != null) {
-        TestSyncAccounts.deleteAccount(this, accountManager, account);
-      }
-    }
-
-    // Check re-constituted prefs against old prefs.
-    assertEquals(origAccountPrefs, accountPrefs.getAll());
-    assertEquals(origGlobalPrefs, globalPrefs.getAll());
-  }
-}
deleted file mode 100644
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestSyncAccounts.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko.background.sync;
-
-import java.io.UnsupportedEncodingException;
-import java.security.NoSuchAlgorithmException;
-import java.util.concurrent.TimeUnit;
-
-import org.mozilla.gecko.background.common.GlobalConstants;
-import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
-import org.mozilla.gecko.sync.ExtendedJSONObject;
-import org.mozilla.gecko.sync.SyncConfiguration;
-import org.mozilla.gecko.sync.SyncConstants;
-import org.mozilla.gecko.sync.Utils;
-import org.mozilla.gecko.sync.setup.Constants;
-import org.mozilla.gecko.sync.setup.SyncAccounts;
-import org.mozilla.gecko.sync.setup.SyncAccounts.SyncAccountParameters;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.test.InstrumentationTestCase;
-
-/**
- * We can use <code>performWait</code> and <code>performNotify</code> here if we
- * are careful about threading issues with <code>AsyncTask</code>. We need to
- * take some care to both create and run certain tasks on the main thread --
- * moving the object allocation out of the UI thread causes failures!
- * <p>
- * @see "<a href='http://stackoverflow.com/questions/2321829/android-asynctask-testing-problem-with-android-test-framework'>
- * http://stackoverflow.com/questions/2321829/android-asynctask-testing-problem-with-android-test-framework</a>."
- */
-public class TestSyncAccounts extends AndroidSyncTestCase {
-  private static final String TEST_USERNAME   = "testAccount@mozilla.com";
-  private static final String TEST_SYNCKEY    = "testSyncKey";
-  private static final String TEST_PASSWORD   = "testPassword";
-  private static final String TEST_SERVERURL  = "test.server.url/";
-  private static final String TEST_CLUSTERURL = "test.cluster.url/";
-
-  public static final String TEST_ACCOUNTTYPE = SyncConstants.ACCOUNTTYPE_SYNC;
-
-  public static final String TEST_PRODUCT = GlobalConstants.BROWSER_INTENT_PACKAGE;
-  public static final String TEST_PROFILE = Constants.DEFAULT_PROFILE;
-  public static final long TEST_VERSION = SyncConfiguration.CURRENT_PREFS_VERSION;
-
-  public static final String TEST_PREFERENCE = "testPreference";
-  public static final String TEST_SYNC_ID = "testSyncID";
-
-  private Account account;
-  private Context context;
-  private AccountManager accountManager;
-  private SyncAccountParameters syncAccount;
-
-  public void setUp() {
-    account = null;
-    context = getApplicationContext();
-    accountManager = AccountManager.get(context);
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, null);
-  }
-
-  public static void deleteAccount(final InstrumentationTestCase test, final AccountManager accountManager, final Account account) {
-    performWait(new Runnable() {
-      @Override
-      public void run() {
-        try {
-          test.runTestOnUiThread(new Runnable() {
-            final AccountManagerCallback<Boolean> callback = new AccountManagerCallback<Boolean>() {
-              @Override
-              public void run(AccountManagerFuture<Boolean> future) {
-                try {
-                  future.getResult(5L, TimeUnit.SECONDS);
-                } catch (Exception e) {
-                }
-                performNotify();
-              }
-            };
-
-            @Override
-            public void run() {
-              accountManager.removeAccount(account, callback, null);
-            }
-          });
-        } catch (Throwable e) {
-          performNotify(e);
-        }
-      }
-    });
-  }
-
-  public void tearDown() {
-    if (account == null) {
-      return;
-    }
-    deleteAccount(this, accountManager, account);
-    account = null;
-  }
-
-  public void testSyncAccountParameters() {
-    assertEquals(TEST_USERNAME, syncAccount.username);
-    assertNull(syncAccount.accountManager);
-    assertNull(syncAccount.serverURL);
-
-    try {
-      syncAccount = new SyncAccountParameters(context, null,
-          null, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL);
-    } catch (IllegalArgumentException e) {
-      return;
-    } catch (Exception e) {
-      fail("Did not expect exception: " + e);
-    }
-    fail("Expected IllegalArgumentException.");
-  }
-
-  public void testCreateAccount() {
-    int before = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    int afterCreate = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    assertTrue(afterCreate > before);
-    deleteAccount(this, accountManager, account);
-    account = null;
-    int afterDelete = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    assertEquals(before, afterDelete);
-  }
-
-  public void testCreateSecondAccount() {
-    int before = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    int afterFirst = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    assertTrue(afterFirst > before);
-
-    SyncAccountParameters secondSyncAccount = new SyncAccountParameters(context, null,
-        "second@username.com", TEST_SYNCKEY, TEST_PASSWORD, null);
-
-    Account second = SyncAccounts.createSyncAccount(secondSyncAccount, false);
-    assertNotNull(second);
-    int afterSecond = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    assertTrue(afterSecond > afterFirst);
-
-    deleteAccount(this, accountManager, second);
-    deleteAccount(this, accountManager, account);
-    account = null;
-
-    int afterDelete = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    assertEquals(before, afterDelete);
-  }
-
-  public void testCreateDuplicateAccount() {
-    int before = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    int afterCreate = accountManager.getAccountsByType(TEST_ACCOUNTTYPE).length;
-    assertTrue(afterCreate > before);
-
-    Account dupe = SyncAccounts.createSyncAccount(syncAccount, false);
-    assertNull(dupe);
-  }
-
-  public void testClientRecord() throws NoSuchAlgorithmException, UnsupportedEncodingException {
-    final String TEST_NAME = "testName";
-    final String TEST_GUID = "testGuid";
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, null, null, TEST_NAME, TEST_GUID);
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    assertNotNull(account);
-
-    SharedPreferences prefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME,
-        SyncConstants.DEFAULT_AUTH_SERVER, TEST_PROFILE, TEST_VERSION);
-
-    // Verify that client record is set.
-    assertEquals(TEST_GUID, prefs.getString(SyncConfiguration.PREF_ACCOUNT_GUID, null));
-    assertEquals(TEST_NAME, prefs.getString(SyncConfiguration.PREF_CLIENT_NAME, null));
-
-    // Let's verify that clusterURL is correctly not set.
-    String clusterURL = prefs.getString(SyncConfiguration.PREF_CLUSTER_URL, null);
-    assertNull(clusterURL);
-  }
-
-  public void testClusterURL() throws NoSuchAlgorithmException, UnsupportedEncodingException {
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL, TEST_CLUSTERURL, null, null);
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    assertNotNull(account);
-
-    SharedPreferences prefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME,
-        TEST_SERVERURL, TEST_PROFILE, TEST_VERSION);
-    String clusterURL = prefs.getString(SyncConfiguration.PREF_CLUSTER_URL, null);
-    assertNotNull(clusterURL);
-    assertEquals(TEST_CLUSTERURL, clusterURL);
-
-    // Let's verify that client name and GUID are not set.
-    assertNull(prefs.getString(SyncConfiguration.PREF_ACCOUNT_GUID, null));
-    assertNull(prefs.getString(SyncConfiguration.PREF_CLIENT_NAME, null));
-  }
-
-  /**
-   * Verify that creating an account wipes stale settings in Shared Preferences.
-   */
-  public void testCreatingWipesSharedPrefs() throws Exception {
-    final String TEST_PREFERENCE = "testPreference";
-    final String TEST_SYNC_ID = "testSyncID";
-
-    SharedPreferences prefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME,
-        TEST_SERVERURL, TEST_PROFILE, TEST_VERSION);
-    prefs.edit().putString(SyncConfiguration.PREF_SYNC_ID, TEST_SYNC_ID).commit();
-    prefs.edit().putString(TEST_PREFERENCE, TEST_SYNC_ID).commit();
-
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL);
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    assertNotNull(account);
-
-    // All values deleted (known and unknown).
-    assertNull(prefs.getString(SyncConfiguration.PREF_SYNC_ID, null));
-    assertNull(prefs.getString(TEST_SYNC_ID, null));
-  }
-
-  /**
-   * Verify that creating an account preserves settings in Shared Preferences when asked.
-   */
-  public void testCreateSyncAccountWithExistingPreferences() throws Exception {
-
-    SharedPreferences prefs = Utils.getSharedPreferences(context, TEST_PRODUCT, TEST_USERNAME,
-        TEST_SERVERURL, TEST_PROFILE, TEST_VERSION);
-
-    prefs.edit().putString(SyncConfiguration.PREF_SYNC_ID, TEST_SYNC_ID).commit();
-    prefs.edit().putString(TEST_PREFERENCE, TEST_SYNC_ID).commit();
-
-    assertNotNull(prefs.getString(TEST_PREFERENCE, null));
-    assertNotNull(prefs.getString(SyncConfiguration.PREF_SYNC_ID, null));
-
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL);
-    account = SyncAccounts.createSyncAccountPreservingExistingPreferences(syncAccount, false);
-    assertNotNull(account);
-
-    // All values remain (known and unknown).
-    assertNotNull(prefs.getString(TEST_PREFERENCE, null));
-    assertNotNull(prefs.getString(SyncConfiguration.PREF_SYNC_ID, null));
-  }
-
-  protected void assertParams(final SyncAccountParameters params) throws Exception {
-    assertNotNull(params);
-    assertEquals(context, params.context);
-    assertEquals(Utils.usernameFromAccount(TEST_USERNAME), params.username);
-    assertEquals(TEST_PASSWORD, params.password);
-    assertEquals(TEST_SERVERURL, params.serverURL);
-    assertEquals(TEST_SYNCKEY, params.syncKey);
-  }
-
-  public void testBlockingFromAndroidAccountV0() throws Throwable {
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL, TEST_CLUSTERURL, null, null);
-    try {
-      account = SyncAccounts.createSyncAccount(syncAccount);
-      assertNotNull(account);
-
-      // Test fetching parameters multiple times. Historically, we needed to
-      // invalidate this token type every fetch; now we don't, but we'd like
-      // to ensure multiple fetches work.
-      SyncAccountParameters params = SyncAccounts.blockingFromAndroidAccountV0(context, accountManager, account);
-      assertParams(params);
-
-      params = SyncAccounts.blockingFromAndroidAccountV0(context, accountManager, account);
-      assertParams(params);
-
-      // Test this works on the main thread.
-      this.runTestOnUiThread(new Runnable() {
-        @Override
-        public void run() {
-          SyncAccountParameters params;
-          try {
-            params = SyncAccounts.blockingFromAndroidAccountV0(context, accountManager, account);
-            assertParams(params);
-          } catch (Exception e) {
-            fail("Fetching Sync account parameters failed on UI thread.");
-          }
-        }
-      });
-    } finally {
-      if (account != null) {
-        deleteAccount(this, accountManager, account);
-        account = null;
-      }
-    }
-  }
-
-  public void testMakeSyncAccountDeletedIntent() throws Throwable {
-    syncAccount = new SyncAccountParameters(context, null,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL, TEST_CLUSTERURL, null, null);
-    try {
-      account = SyncAccounts.createSyncAccount(syncAccount);
-      assertNotNull(account);
-
-      Intent intent = SyncAccounts.makeSyncAccountDeletedIntent(context, accountManager, account);
-      assertEquals(SyncConstants.SYNC_ACCOUNT_DELETED_ACTION, intent.getAction());
-      assertEquals(SyncConstants.SYNC_ACCOUNT_DELETED_INTENT_VERSION, intent.getLongExtra(Constants.JSON_KEY_VERSION, 0));
-      assertEquals(TEST_USERNAME, intent.getStringExtra(Constants.JSON_KEY_ACCOUNT));
-      assertTrue(Math.abs(intent.getLongExtra(Constants.JSON_KEY_TIMESTAMP, 0) - System.currentTimeMillis()) < 1000);
-
-      String payload = intent.getStringExtra(Constants.JSON_KEY_PAYLOAD);
-      assertNotNull(payload);
-
-      SyncAccountParameters params = new SyncAccountParameters(context, accountManager, ExtendedJSONObject.parseJSONObject(payload));
-      // Can't use assertParams because Sync key is deleted.
-      assertNotNull(params);
-      assertEquals(context, params.context);
-      assertEquals(Utils.usernameFromAccount(TEST_USERNAME), params.username);
-      assertEquals(TEST_PASSWORD, params.password);
-      assertEquals(TEST_SERVERURL, params.serverURL);
-      assertEquals("", params.syncKey);
-    } finally {
-      if (account != null) {
-        deleteAccount(this, accountManager, account);
-        account = null;
-      }
-    }
-  }
-
-  public void testBlockingPrefsFromAndroidAccountV0() throws Exception {
-    // Create test account with prefs. We use a different username to avoid a
-    // timing issue, where the delayed clean-up of the account created by the
-    // previous test deletes the preferences for this account.
-    SharedPreferences prefs = Utils.getSharedPreferences(context, TEST_PRODUCT,
-        TEST_USERNAME + "2", TEST_SERVERURL, TEST_PROFILE, TEST_VERSION);
-    prefs.edit().putString(TEST_PREFERENCE, TEST_SYNC_ID).commit();
-
-    syncAccount = new SyncAccountParameters(context, null,
-      TEST_USERNAME + "2", TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL);
-    account = SyncAccounts.createSyncAccountPreservingExistingPreferences(syncAccount, false);
-    assertNotNull(account);
-
-    // Fetch account and check prefs.
-    SharedPreferences sharedPreferences = SyncAccounts.blockingPrefsFromAndroidAccountV0(context, accountManager,
-        account, TEST_PRODUCT, TEST_PROFILE, TEST_VERSION);
-    assertNotNull(sharedPreferences);
-    assertEquals(TEST_SYNC_ID, sharedPreferences.getString(TEST_PREFERENCE, null));
-  }
-}
deleted file mode 100644
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestSyncAuthenticatorService.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko.background.sync;
-
-import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
-import org.mozilla.gecko.sync.SyncConstants;
-import org.mozilla.gecko.sync.Utils;
-import org.mozilla.gecko.sync.setup.Constants;
-import org.mozilla.gecko.sync.setup.SyncAccounts;
-import org.mozilla.gecko.sync.setup.SyncAccounts.SyncAccountParameters;
-import org.mozilla.gecko.sync.setup.SyncAuthenticatorService;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.Context;
-import android.os.Bundle;
-
-public class TestSyncAuthenticatorService extends AndroidSyncTestCase {
-  private static final String TEST_USERNAME   = "testAccount@mozilla.com";
-  private static final String TEST_SYNCKEY    = "testSyncKey";
-  private static final String TEST_PASSWORD   = "testPassword";
-  private static final String TEST_SERVERURL  = "test.server.url/";
-
-  private Account account;
-  private Context context;
-  private AccountManager accountManager;
-  private SyncAccountParameters syncAccount;
-
-  public void setUp() {
-    account = null;
-    context = getApplicationContext();
-    accountManager = AccountManager.get(context);
-    syncAccount = new SyncAccountParameters(context, accountManager,
-        TEST_USERNAME, TEST_SYNCKEY, TEST_PASSWORD, TEST_SERVERURL);
-  }
-
-  public void tearDown() {
-    if (account == null) {
-      return;
-    }
-    TestSyncAccounts.deleteAccount(this, accountManager, account);
-    account = null;
-  }
-
-  public void testGetPlainAuthToken() throws Exception {
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    assertNotNull(account);
-
-    final Bundle bundle = SyncAuthenticatorService.getPlainAuthToken(context, account);
-
-    assertEquals(TEST_USERNAME, bundle.getString(AccountManager.KEY_ACCOUNT_NAME));
-    assertEquals(SyncConstants.ACCOUNTTYPE_SYNC, bundle.getString(AccountManager.KEY_ACCOUNT_TYPE));
-    assertEquals(Utils.usernameFromAccount(TEST_USERNAME), bundle.getString(Constants.OPTION_USERNAME));
-    assertEquals(TEST_PASSWORD, bundle.getString(AccountManager.KEY_AUTHTOKEN));
-    assertEquals(TEST_SYNCKEY, bundle.getString(Constants.OPTION_SYNCKEY));
-    assertEquals(TEST_SERVERURL, bundle.getString(Constants.OPTION_SERVER));
-  }
-
-  public void testGetBadTokenType() throws Exception {
-    account = SyncAccounts.createSyncAccount(syncAccount, false);
-    assertNotNull(account);
-
-    assertNull(accountManager.blockingGetAuthToken(account, "BAD_TOKEN_TYPE", false));
-  }
-}
deleted file mode 100644
--- a/mobile/android/tests/background/junit3/src/org/mozilla/gecko/background/sync/TestUpgradeRequired.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko.background.sync;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-import org.json.simple.parser.ParseException;
-import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
-import org.mozilla.gecko.background.testhelpers.DefaultGlobalSessionCallback;
-import org.mozilla.gecko.background.testhelpers.MockGlobalSession;
-import org.mozilla.gecko.background.testhelpers.MockSharedPreferences;
-import org.mozilla.gecko.db.BrowserContract;
-import org.mozilla.gecko.sync.GlobalSession;
-import org.mozilla.gecko.sync.NonObjectJSONException;
-import org.mozilla.gecko.sync.SyncConfiguration;
-import org.mozilla.gecko.sync.SyncConfigurationException;
-import org.mozilla.gecko.sync.SyncConstants;
-import org.mozilla.gecko.sync.crypto.CryptoException;
-import org.mozilla.gecko.sync.crypto.KeyBundle;
-import org.mozilla.gecko.sync.delegates.GlobalSessionCallback;
-import org.mozilla.gecko.sync.net.BasicAuthHeaderProvider;
-import org.mozilla.gecko.sync.setup.Constants;
-import org.mozilla.gecko.sync.setup.SyncAccounts;
-import org.mozilla.gecko.sync.setup.SyncAccounts.SyncAccountParameters;
-import org.mozilla.gecko.sync.syncadapter.SyncAdapter;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.ContentResolver;
-import android.content.Context;
-import ch.boye.httpclientandroidlib.HttpEntity;
-import ch.boye.httpclientandroidlib.HttpResponse;
-import ch.boye.httpclientandroidlib.ProtocolVersion;
-import ch.boye.httpclientandroidlib.entity.StringEntity;
-import ch.boye.httpclientandroidlib.message.BasicHttpResponse;
-
-/**
- * When syncing and a server responds with a 400 "Upgrade Required," Sync
- * accounts should be disabled.
- *
- * (We are not testing for package updating, because MY_PACKAGE_REPLACED
- * broadcasts can only be sent by the system. Testing for package replacement
- * needs to be done manually on a device.)
- *
- * @author liuche
- *
- */
-public class TestUpgradeRequired extends AndroidSyncTestCase {
-  private final String  TEST_SERVER      = "http://test.ser.ver/";
-
-  private static final String TEST_USERNAME     = "user1";
-  private static final String TEST_PASSWORD     = "pass1";
-  private static final String TEST_SYNC_KEY     = "abcdeabcdeabcdeabcdeabcdea";
-
-  private Context context;
-
-  public static boolean syncsAutomatically(Account a) {
-    return ContentResolver.getSyncAutomatically(a, BrowserContract.AUTHORITY);
-  }
-
-  public static boolean isSyncable(Account a) {
-    return 1 == ContentResolver.getIsSyncable(a, BrowserContract.AUTHORITY);
-  }
-
-  public static boolean willEnableOnUpgrade(Account a, AccountManager accountManager) {
-    return "1".equals(accountManager.getUserData(a, Constants.DATA_ENABLE_ON_UPGRADE));
-  }
-
-  private static Account getTestAccount(AccountManager accountManager) {
-    final String type = SyncConstants.ACCOUNTTYPE_SYNC;
-    Account[] existing = accountManager.getAccountsByType(type);
-    for (Account account : existing) {
-      if (account.name.equals(TEST_USERNAME)) {
-        return account;
-      }
-    }
-    return null;
-  }
-
-  private void deleteTestAccount() {
-    final AccountManager accountManager = AccountManager.get(context);
-    final Account found = getTestAccount(accountManager);
-    if (found == null) {
-      return;
-    }
-    TestSyncAccounts.deleteAccount(this, accountManager, found);
-  }
-
-  @Override
-  public void setUp() {
-    context = getApplicationContext();
-    final AccountManager accountManager = AccountManager.get(context);
-
-    deleteTestAccount();
-
-    // Set up and enable Sync accounts.
-    SyncAccountParameters syncAccountParams = new SyncAccountParameters(context, accountManager, TEST_USERNAME, TEST_PASSWORD, TEST_SYNC_KEY, TEST_SERVER, null, null, null);
-    final Account account = SyncAccounts.createSyncAccount(syncAccountParams, true);
-    assertNotNull(account);
-    assertTrue(syncsAutomatically(account));
-    assertTrue(isSyncable(account));
-  }
-
-  private static class LeakySyncAdapter extends SyncAdapter {
-    public LeakySyncAdapter(Context context, boolean autoInitialize, Account account) {
-      super(context, autoInitialize);
-      this.localAccount = account;
-    }
-  }
-
-  /**
-   * Verify that when SyncAdapter is informed of an Upgrade Required
-   * response, that it disables the account it's syncing.
-   */
-  public void testInformUpgradeRequired() {
-    final AccountManager accountManager = AccountManager.get(context);
-    final Account account = getTestAccount(accountManager);
-
-    assertNotNull(account);
-    assertTrue(syncsAutomatically(account));
-    assertTrue(isSyncable(account));
-    assertFalse(willEnableOnUpgrade(account, accountManager));
-
-    LeakySyncAdapter adapter = new LeakySyncAdapter(context, true, account);
-    adapter.informUpgradeRequiredResponse(null);
-
-    // Oh god.
-    try {
-      Thread.sleep(1000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-
-    // We have disabled the account, but it's still syncable.
-    assertFalse(syncsAutomatically(account));
-    assertTrue(isSyncable(account));
-    assertTrue(willEnableOnUpgrade(account, accountManager));
-  }
-
-  private class Result {
-    public boolean called = false;
-  }
-
-  public static HttpResponse simulate400() {
-    HttpResponse response = new BasicHttpResponse(new ProtocolVersion("HTTP", 1, 1), 400, "Bad Request") {
-      @Override
-      public HttpEntity getEntity() {
-        try {
-          return new StringEntity("16");
-        } catch (UnsupportedEncodingException e) {
-          // Never happens.
-          return null;
-        }
-      }
-    };
-    return response;
-  }
-
-  /**
-   * Verify that when a 400 response is received with an
-   * "Upgrade Required" response code body, we call
-   * informUpgradeRequiredResponse on the delegate.
-   */
-  public void testUpgradeResponse() throws SyncConfigurationException, IllegalArgumentException, NonObjectJSONException, IOException, ParseException, CryptoException {
-    final Result calledUpgradeRequired = new Result();
-    final GlobalSessionCallback callback = new DefaultGlobalSessionCallback() {
-      @Override
-      public void informUpgradeRequiredResponse(final GlobalSession session) {
-        calledUpgradeRequired.called = true;
-      }
-    };
-
-    MockSharedPreferences prefs = new MockSharedPreferences();
-    SyncConfiguration config = new SyncConfiguration(TEST_USERNAME, new BasicAuthHeaderProvider(TEST_USERNAME, TEST_PASSWORD), prefs);
-    config.syncKeyBundle = new KeyBundle(TEST_USERNAME, TEST_SYNC_KEY);
-    final GlobalSession session = new MockGlobalSession(config, callback);
-
-    session.interpretHTTPFailure(simulate400());
-    assertTrue(calledUpgradeRequired.called);
-  }
-
-  @Override
-  public void tearDown() {
-    deleteTestAccount();
-  }
-}