Bug 995157 - Specify default profile when syncing tabs and remote clients. r=rnewman
authorNick Alexander <nalexander@mozilla.com>
Sun, 20 Apr 2014 14:42:45 -0700
changeset 197876 f6b4679502a976c7b1ab5cfdd5524ce67aaf554d
parent 197875 53a7716781454e6ba40ac94d010b4809d5c09d95
child 197877 5010b38abf18590cb17cf35e0cfaa933579cd748
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs995157
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 995157 - Specify default profile when syncing tabs and remote clients. r=rnewman ======== https://github.com/mozilla-services/android-sync/commit/7fd50fef23eeb42b798c1afc3ebf557a32b29c5d Author: Nick Alexander <nalexander@mozilla.com> Date: Fri Apr 18 13:11:34 2014 -0700 Bug 995157 - Part 2: Specify default profile when syncing tabs and remote clients. ======== https://github.com/mozilla-services/android-sync/commit/79da665d744d3a0e4c9ad5fa0d53a3b441ae81e2 Author: Nick Alexander <nalexander@mozilla.com> Date: Fri Apr 18 15:22:02 2014 -0700 Bug 995157 - Part 1: Use FORM_HISTORY_AUTHORITY_URI.
mobile/android/base/sync/repositories/android/BrowserContractHelpers.java
mobile/android/base/sync/repositories/android/FennecTabsRepository.java
mobile/android/base/sync/repositories/android/FormHistoryRepositorySession.java
mobile/android/tests/background/junit3/src/db/TestFennecTabsRepositorySession.java
mobile/android/tests/background/junit3/src/db/TestFennecTabsStorage.java
mobile/android/tests/background/junit3/src/sync/TestTabsRecord.java
--- a/mobile/android/base/sync/repositories/android/BrowserContractHelpers.java
+++ b/mobile/android/base/sync/repositories/android/BrowserContractHelpers.java
@@ -33,16 +33,18 @@ public class BrowserContractHelpers exte
   public static final Uri BOOKMARKS_PARENTS_CONTENT_URI    = withSyncAndDeletedAndProfile(Bookmarks.PARENTS_CONTENT_URI);
   public static final Uri BOOKMARKS_POSITIONS_CONTENT_URI  = withSyncAndDeletedAndProfile(Bookmarks.POSITIONS_CONTENT_URI);
   public static final Uri HISTORY_CONTENT_URI              = withSyncAndDeletedAndProfile(History.CONTENT_URI);
   public static final Uri SCHEMA_CONTENT_URI               = withSyncAndDeletedAndProfile(Schema.CONTENT_URI);
   public static final Uri PASSWORDS_CONTENT_URI            = withSyncAndDeletedAndProfile(Passwords.CONTENT_URI);
   public static final Uri DELETED_PASSWORDS_CONTENT_URI    = withSyncAndDeletedAndProfile(DeletedPasswords.CONTENT_URI);
   public static final Uri FORM_HISTORY_CONTENT_URI         = withSyncAndProfile(FormHistory.CONTENT_URI);
   public static final Uri DELETED_FORM_HISTORY_CONTENT_URI = withSyncAndProfile(DeletedFormHistory.CONTENT_URI);
+  public static final Uri TABS_CONTENT_URI                 = withSyncAndProfile(Tabs.CONTENT_URI);
+  public static final Uri CLIENTS_CONTENT_URI              = withSyncAndProfile(Clients.CONTENT_URI);
 
   public static final String[] PasswordColumns = new String[] {
     Passwords.ID,
     Passwords.HOSTNAME,
     Passwords.HTTP_REALM,
     Passwords.FORM_SUBMIT_URL,
     Passwords.USERNAME_FIELD,
     Passwords.PASSWORD_FIELD,
--- a/mobile/android/base/sync/repositories/android/FennecTabsRepository.java
+++ b/mobile/android/base/sync/repositories/android/FennecTabsRepository.java
@@ -68,29 +68,29 @@ public class FennecTabsRepository extend
       } catch (Exception e) {}
       try {
         tabsProvider.release();
       } catch (Exception e) {}
     }
 
     public FennecTabsRepositorySession(Repository repository, Context context) throws NoContentProviderException {
       super(repository);
-      clientsProvider = getContentProvider(context, BrowserContract.Clients.CONTENT_URI);
+      clientsProvider = getContentProvider(context, BrowserContractHelpers.CLIENTS_CONTENT_URI);
       try {
-        tabsProvider = getContentProvider(context, BrowserContract.Tabs.CONTENT_URI);
+        tabsProvider = getContentProvider(context, BrowserContractHelpers.TABS_CONTENT_URI);
       } catch (NoContentProviderException e) {
         clientsProvider.release();
         throw e;
       } catch (Exception e) {
         clientsProvider.release();
         // Oh, Java.
         throw new RuntimeException(e);
       }
 
-      tabsHelper = new RepoUtils.QueryHelper(context, BrowserContract.Tabs.CONTENT_URI, LOG_TAG);
+      tabsHelper = new RepoUtils.QueryHelper(context, BrowserContractHelpers.TABS_CONTENT_URI, LOG_TAG);
     }
 
     @Override
     public void abort() {
       releaseProviders();
       super.abort();
     }
 
@@ -220,62 +220,62 @@ public class FennecTabsRepository extend
           }
 
           try {
             // This is nice and easy: we *always* store.
             final String[] selectionArgs = new String[] { tabsRecord.guid };
             if (tabsRecord.deleted) {
               try {
                 Logger.debug(LOG_TAG, "Clearing entry for client " + tabsRecord.guid);
-                clientsProvider.delete(BrowserContract.Clients.CONTENT_URI,
+                clientsProvider.delete(BrowserContractHelpers.CLIENTS_CONTENT_URI,
                                        CLIENT_GUID_IS,
                                        selectionArgs);
                 delegate.onRecordStoreSucceeded(record.guid);
               } catch (Exception e) {
                 delegate.onRecordStoreFailed(e, record.guid);
               }
               return;
             }
 
             // If it exists, update the client record; otherwise insert.
             final ContentValues clientsCV = tabsRecord.getClientsContentValues();
 
             Logger.debug(LOG_TAG, "Updating clients provider.");
-            final int updated = clientsProvider.update(BrowserContract.Clients.CONTENT_URI,
+            final int updated = clientsProvider.update(BrowserContractHelpers.CLIENTS_CONTENT_URI,
                 clientsCV,
                 CLIENT_GUID_IS,
                 selectionArgs);
             if (0 == updated) {
-              clientsProvider.insert(BrowserContract.Clients.CONTENT_URI, clientsCV);
+              clientsProvider.insert(BrowserContractHelpers.CLIENTS_CONTENT_URI, clientsCV);
             }
 
             // Now insert tabs.
             final ContentValues[] tabsArray = tabsRecord.getTabsContentValues();
             Logger.debug(LOG_TAG, "Inserting " + tabsArray.length + " tabs for client " + tabsRecord.guid);
 
-            tabsProvider.delete(BrowserContract.Tabs.CONTENT_URI, TABS_CLIENT_GUID_IS, selectionArgs);
-            final int inserted = tabsProvider.bulkInsert(BrowserContract.Tabs.CONTENT_URI, tabsArray);
+            tabsProvider.delete(BrowserContractHelpers.TABS_CONTENT_URI, TABS_CLIENT_GUID_IS, selectionArgs);
+            final int inserted = tabsProvider.bulkInsert(BrowserContractHelpers.TABS_CONTENT_URI, tabsArray);
             Logger.trace(LOG_TAG, "Inserted: " + inserted);
 
             delegate.onRecordStoreSucceeded(record.guid);
           } catch (Exception e) {
             Logger.warn(LOG_TAG, "Error storing tabs.", e);
             delegate.onRecordStoreFailed(e, record.guid);
           }
         }
       };
 
       storeWorkQueue.execute(command);
     }
 
     @Override
     public void wipe(RepositorySessionWipeDelegate delegate) {
       try {
-        tabsProvider.delete(BrowserContract.Tabs.CONTENT_URI, null, null);
-        clientsProvider.delete(BrowserContract.Clients.CONTENT_URI, null, null);
+        tabsProvider.delete(BrowserContractHelpers.TABS_CONTENT_URI, null, null);
+        clientsProvider.delete(BrowserContractHelpers.CLIENTS_CONTENT_URI, null, null);
       } catch (RemoteException e) {
         Logger.warn(LOG_TAG, "Got RemoteException in wipe.", e);
         delegate.onWipeFailed(e);
         return;
       }
       delegate.onWipeSucceeded();
     }
   }
--- a/mobile/android/base/sync/repositories/android/FormHistoryRepositorySession.java
+++ b/mobile/android/base/sync/repositories/android/FormHistoryRepositorySession.java
@@ -5,16 +5,17 @@
 package org.mozilla.gecko.sync.repositories.android;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.Callable;
 
 import org.mozilla.gecko.background.common.log.Logger;
+import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.db.BrowserContract.DeletedFormHistory;
 import org.mozilla.gecko.db.BrowserContract.FormHistory;
 import org.mozilla.gecko.sync.repositories.InactiveSessionException;
 import org.mozilla.gecko.sync.repositories.NoContentProviderException;
 import org.mozilla.gecko.sync.repositories.NoStoreDelegateException;
 import org.mozilla.gecko.sync.repositories.NullCursorException;
 import org.mozilla.gecko.sync.repositories.RecordFilter;
 import org.mozilla.gecko.sync.repositories.Repository;
@@ -70,17 +71,17 @@ public class FormHistoryRepositorySessio
    * The caller is responsible for releasing the client.
    *
    * @param context The application context.
    * @return The <code>ContentProviderClient</code>.
    * @throws NoContentProviderException
    */
   public static ContentProviderClient acquireContentProvider(final Context context)
       throws NoContentProviderException {
-    Uri uri = FormHistory.CONTENT_URI;
+    Uri uri = BrowserContract.FORM_HISTORY_AUTHORITY_URI;
     ContentProviderClient client = context.getContentResolver().acquireContentProviderClient(uri);
     if (client == null) {
       throw new NoContentProviderException(uri);
     }
     return client;
   }
 
   protected void releaseProviders() {
@@ -118,16 +119,17 @@ public class FormHistoryRepositorySessio
     super.finish(delegate);
   }
 
   protected static String[] GUID_COLUMNS = new String[] { FormHistory.GUID };
 
   @Override
   public void guidsSince(final long timestamp, final RepositorySessionGuidsSinceDelegate delegate) {
     Runnable command = new Runnable() {
+      @Override
       public void run() {
         if (!isActive()) {
           delegate.onGuidsSinceFailed(new InactiveSessionException(null));
           return;
         }
 
         ArrayList<String> guids = new ArrayList<String>();
 
@@ -698,16 +700,17 @@ public class FormHistoryRepositorySessio
       throws RemoteException {
     formsProvider.delete(FORM_HISTORY_CONTENT_URI, null, null);
     formsProvider.delete(DELETED_FORM_HISTORY_CONTENT_URI, null, null);
   }
 
   @Override
   public void wipe(final RepositorySessionWipeDelegate delegate) {
     Runnable command = new Runnable() {
+      @Override
       public void run() {
         if (!isActive()) {
           delegate.onWipeFailed(new InactiveSessionException(null));
           return;
         }
 
         try {
           Logger.debug(LOG_TAG, "Wiping form history and deleted form history...");
--- a/mobile/android/tests/background/junit3/src/db/TestFennecTabsRepositorySession.java
+++ b/mobile/android/tests/background/junit3/src/db/TestFennecTabsRepositorySession.java
@@ -5,16 +5,17 @@ package org.mozilla.gecko.background.db;
 
 import org.json.simple.JSONArray;
 import org.mozilla.gecko.background.helpers.AndroidSyncTestCase;
 import org.mozilla.gecko.background.sync.helpers.ExpectFetchDelegate;
 import org.mozilla.gecko.background.sync.helpers.SessionTestHelper;
 import org.mozilla.gecko.db.BrowserContract;
 import org.mozilla.gecko.sync.repositories.NoContentProviderException;
 import org.mozilla.gecko.sync.repositories.RepositorySession;
+import org.mozilla.gecko.sync.repositories.android.BrowserContractHelpers;
 import org.mozilla.gecko.sync.repositories.android.FennecTabsRepository;
 import org.mozilla.gecko.sync.repositories.android.FennecTabsRepository.FennecTabsRepositorySession;
 import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionCreationDelegate;
 import org.mozilla.gecko.sync.repositories.domain.Record;
 import org.mozilla.gecko.sync.repositories.domain.TabsRecord;
 
 import android.content.ContentProviderClient;
 import android.content.ContentResolver;
@@ -29,37 +30,39 @@ public class TestFennecTabsRepositorySes
   // Override these to test against data that is not live.
   public static final String TEST_TABS_CLIENT_GUID_IS_LOCAL_SELECTION = BrowserContract.Tabs.CLIENT_GUID + " IS ?";
   public static final String[] TEST_TABS_CLIENT_GUID_IS_LOCAL_SELECTION_ARGS = new String[] { TEST_CLIENT_GUID };
 
   protected ContentProviderClient tabsClient = null;
 
   protected ContentProviderClient getTabsClient() {
     final ContentResolver cr = getApplicationContext().getContentResolver();
-    return cr.acquireContentProviderClient(BrowserContract.Tabs.CONTENT_URI);
+    return cr.acquireContentProviderClient(BrowserContractHelpers.TABS_CONTENT_URI);
   }
 
   public TestFennecTabsRepositorySession() throws NoContentProviderException {
     super();
   }
 
+  @Override
   public void setUp() {
     if (tabsClient == null) {
       tabsClient = getTabsClient();
     }
   }
 
   protected int deleteAllTestTabs(final ContentProviderClient tabsClient) throws RemoteException {
     if (tabsClient == null) {
       return -1;
     }
-    return tabsClient.delete(BrowserContract.Tabs.CONTENT_URI,
+    return tabsClient.delete(BrowserContractHelpers.TABS_CONTENT_URI,
         TEST_TABS_CLIENT_GUID_IS_LOCAL_SELECTION, TEST_TABS_CLIENT_GUID_IS_LOCAL_SELECTION_ARGS);
   }
 
+  @Override
   protected void tearDown() throws Exception {
     if (tabsClient != null) {
       deleteAllTestTabs(tabsClient);
 
       tabsClient.release();
       tabsClient = null;
     }
   }
@@ -143,28 +146,28 @@ public class TestFennecTabsRepositorySes
     history2.add("http://test.com/test2.html#3");
     testTab2 = new Tab("test title 2", "http://test.com/test2.png", history2, 2000);
 
     final JSONArray history3 = new JSONArray();
     history3.add("http://test.com/test3.html#1");
     history3.add("http://test.com/test3.html#2");
     testTab3 = new Tab("test title 3", "http://test.com/test3.png", history3, 3000);
 
-    tabsClient.insert(BrowserContract.Tabs.CONTENT_URI, testTab1.toContentValues(TEST_CLIENT_GUID, 0));
-    tabsClient.insert(BrowserContract.Tabs.CONTENT_URI, testTab2.toContentValues(TEST_CLIENT_GUID, 1));
-    tabsClient.insert(BrowserContract.Tabs.CONTENT_URI, testTab3.toContentValues(TEST_CLIENT_GUID, 2));
+    tabsClient.insert(BrowserContractHelpers.TABS_CONTENT_URI, testTab1.toContentValues(TEST_CLIENT_GUID, 0));
+    tabsClient.insert(BrowserContractHelpers.TABS_CONTENT_URI, testTab2.toContentValues(TEST_CLIENT_GUID, 1));
+    tabsClient.insert(BrowserContractHelpers.TABS_CONTENT_URI, testTab3.toContentValues(TEST_CLIENT_GUID, 2));
   }
 
   protected TabsRecord insertTestTabsAndExtractTabsRecord() throws RemoteException {
     insertSomeTestTabs(tabsClient);
 
     final String positionAscending = BrowserContract.Tabs.POSITION + " ASC";
     Cursor cursor = null;
     try {
-      cursor = tabsClient.query(BrowserContract.Tabs.CONTENT_URI, null,
+      cursor = tabsClient.query(BrowserContractHelpers.TABS_CONTENT_URI, null,
           TEST_TABS_CLIENT_GUID_IS_LOCAL_SELECTION, TEST_TABS_CLIENT_GUID_IS_LOCAL_SELECTION_ARGS, positionAscending);
       CursorDumper.dumpCursor(cursor);
 
       final TabsRecord tabsRecord = FennecTabsRepository.tabsRecordFromCursor(cursor, TEST_CLIENT_GUID, TEST_CLIENT_NAME);
 
       assertEquals(TEST_CLIENT_GUID, tabsRecord.guid);
       assertEquals(TEST_CLIENT_NAME, tabsRecord.clientName);
 
--- a/mobile/android/tests/background/junit3/src/db/TestFennecTabsStorage.java
+++ b/mobile/android/tests/background/junit3/src/db/TestFennecTabsStorage.java
@@ -1,15 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 package org.mozilla.gecko.background.db;
 
 import org.json.simple.JSONArray;
 import org.mozilla.gecko.db.BrowserContract;
+import org.mozilla.gecko.sync.repositories.android.BrowserContractHelpers;
 
 import android.app.Activity;
 import android.content.ContentProviderClient;
 import android.content.ContentResolver;
 import android.content.ContentValues;
 import android.database.Cursor;
 import android.net.Uri;
 import android.os.RemoteException;
@@ -32,31 +33,32 @@ public class TestFennecTabsStorage exten
   protected Tab testTab3;
 
   public TestFennecTabsStorage() {
     super(Activity.class);
   }
 
   protected ContentProviderClient getClientsClient() {
     final ContentResolver cr = getInstrumentation().getTargetContext().getApplicationContext().getContentResolver();
-    return cr.acquireContentProviderClient(BrowserContract.Clients.CONTENT_URI);
+    return cr.acquireContentProviderClient(BrowserContractHelpers.CLIENTS_CONTENT_URI);
   }
 
   protected ContentProviderClient getTabsClient() {
     final ContentResolver cr = getInstrumentation().getTargetContext().getApplicationContext().getContentResolver();
-    return cr.acquireContentProviderClient(BrowserContract.Tabs.CONTENT_URI);
+    return cr.acquireContentProviderClient(BrowserContractHelpers.TABS_CONTENT_URI);
   }
 
   protected int deleteAllTestTabs(final ContentProviderClient tabsClient) throws RemoteException {
     if (tabsClient == null) {
       return -1;
     }
-    return tabsClient.delete(BrowserContract.Tabs.CONTENT_URI, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID });
+    return tabsClient.delete(BrowserContractHelpers.TABS_CONTENT_URI, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID });
   }
 
+  @Override
   protected void tearDown() throws Exception {
     deleteAllTestTabs(getTabsClient());
   }
 
   @SuppressWarnings("unchecked")
   protected void insertSomeTestTabs(ContentProviderClient tabsClient) throws RemoteException {
     final JSONArray history1 = new JSONArray();
     history1.add("http://test.com/test1.html");
@@ -68,34 +70,34 @@ public class TestFennecTabsStorage exten
     history2.add("http://test.com/test2.html#3");
     testTab2 = new Tab("test title 2", "http://test.com/test2.png", history2, 2000);
 
     final JSONArray history3 = new JSONArray();
     history3.add("http://test.com/test3.html#1");
     history3.add("http://test.com/test3.html#2");
     testTab3 = new Tab("test title 3", "http://test.com/test3.png", history3, 3000);
 
-    tabsClient.insert(BrowserContract.Tabs.CONTENT_URI, testTab1.toContentValues(TEST_CLIENT_GUID, 0));
-    tabsClient.insert(BrowserContract.Tabs.CONTENT_URI, testTab2.toContentValues(TEST_CLIENT_GUID, 1));
-    tabsClient.insert(BrowserContract.Tabs.CONTENT_URI, testTab3.toContentValues(TEST_CLIENT_GUID, 2));
+    tabsClient.insert(BrowserContractHelpers.TABS_CONTENT_URI, testTab1.toContentValues(TEST_CLIENT_GUID, 0));
+    tabsClient.insert(BrowserContractHelpers.TABS_CONTENT_URI, testTab2.toContentValues(TEST_CLIENT_GUID, 1));
+    tabsClient.insert(BrowserContractHelpers.TABS_CONTENT_URI, testTab3.toContentValues(TEST_CLIENT_GUID, 2));
   }
 
   // Sanity.
   public void testObtainCP() {
     final ContentProviderClient clientsClient = getClientsClient();
     assertNotNull(clientsClient);
     clientsClient.release();
 
     final ContentProviderClient tabsClient = getTabsClient();
     assertNotNull(tabsClient);
     tabsClient.release();
   }
 
   public void testWipeClients() throws RemoteException {
-    final Uri uri = BrowserContract.Clients.CONTENT_URI;
+    final Uri uri = BrowserContractHelpers.CLIENTS_CONTENT_URI;
     final ContentProviderClient clientsClient = getClientsClient();
 
     // Have to ensure that it's empty…
     clientsClient.delete(uri, null, null);
 
     int deleted = clientsClient.delete(uri, null, null);
     assertEquals(0, deleted);
   }
@@ -106,17 +108,17 @@ public class TestFennecTabsStorage exten
     // Have to ensure that it's empty…
     deleteAllTestTabs(tabsClient);
 
     int deleted = deleteAllTestTabs(tabsClient);
     assertEquals(0, deleted);
   }
 
   public void testStoreAndRetrieveClients() throws RemoteException {
-    final Uri uri = BrowserContract.Clients.CONTENT_URI;
+    final Uri uri = BrowserContractHelpers.CLIENTS_CONTENT_URI;
     final ContentProviderClient clientsClient = getClientsClient();
 
     // Have to ensure that it's empty…
     clientsClient.delete(uri, null, null);
 
     final long now = System.currentTimeMillis();
     final ContentValues first = new ContentValues();
     final ContentValues second = new ContentValues();
@@ -169,17 +171,17 @@ public class TestFennecTabsStorage exten
     final ContentProviderClient tabsClient = getTabsClient();
 
     deleteAllTestTabs(tabsClient);
     insertSomeTestTabs(tabsClient);
 
     final String positionAscending = BrowserContract.Tabs.POSITION + " ASC";
     Cursor cursor = null;
     try {
-      cursor = tabsClient.query(BrowserContract.Tabs.CONTENT_URI, null, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID }, positionAscending);
+      cursor = tabsClient.query(BrowserContractHelpers.TABS_CONTENT_URI, null, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID }, positionAscending);
       assertEquals(3, cursor.getCount());
 
       cursor.moveToFirst();
       final Tab parsed1 = Tab.fromCursor(cursor);
       assertEquals(testTab1, parsed1);
 
       cursor.moveToNext();
       final Tab parsed2 = Tab.fromCursor(cursor);
--- a/mobile/android/tests/background/junit3/src/sync/TestTabsRecord.java
+++ b/mobile/android/tests/background/junit3/src/sync/TestTabsRecord.java
@@ -1,33 +1,34 @@
 /* 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.db.CursorDumper;
 import org.mozilla.gecko.background.db.TestFennecTabsStorage;
 import org.mozilla.gecko.db.BrowserContract;
+import org.mozilla.gecko.sync.repositories.android.BrowserContractHelpers;
 import org.mozilla.gecko.sync.repositories.android.FennecTabsRepository;
 import org.mozilla.gecko.sync.repositories.domain.TabsRecord;
 
 import android.content.ContentProviderClient;
 import android.database.Cursor;
 
 public class TestTabsRecord extends TestFennecTabsStorage {
   public void testTabsRecordFromCursor() throws Exception {
     final ContentProviderClient tabsClient = getTabsClient();
 
     deleteAllTestTabs(tabsClient);
     insertSomeTestTabs(tabsClient);
 
     final String positionAscending = BrowserContract.Tabs.POSITION + " ASC";
     Cursor cursor = null;
     try {
-      cursor = tabsClient.query(BrowserContract.Tabs.CONTENT_URI, null, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID }, positionAscending);
+      cursor = tabsClient.query(BrowserContractHelpers.TABS_CONTENT_URI, null, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID }, positionAscending);
       assertEquals(3, cursor.getCount());
 
       cursor.moveToPosition(1);
 
       final TabsRecord tabsRecord = FennecTabsRepository.tabsRecordFromCursor(cursor, TEST_CLIENT_GUID, TEST_CLIENT_NAME);
 
       // Make sure we clean up after ourselves.
       assertEquals(1, cursor.getPosition());
@@ -50,17 +51,17 @@ public class TestTabsRecord extends Test
   public void testEmptyTabsRecordFromCursor() throws Exception {
     final ContentProviderClient tabsClient = getTabsClient();
 
     deleteAllTestTabs(tabsClient);
 
     final String positionAscending = BrowserContract.Tabs.POSITION + " ASC";
     Cursor cursor = null;
     try {
-      cursor = tabsClient.query(BrowserContract.Tabs.CONTENT_URI, null, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID }, positionAscending);
+      cursor = tabsClient.query(BrowserContractHelpers.TABS_CONTENT_URI, null, TABS_CLIENT_GUID_IS, new String[] { TEST_CLIENT_GUID }, positionAscending);
       assertEquals(0, cursor.getCount());
 
       final TabsRecord tabsRecord = FennecTabsRepository.tabsRecordFromCursor(cursor, TEST_CLIENT_GUID, TEST_CLIENT_NAME);
 
       assertEquals(TEST_CLIENT_GUID, tabsRecord.guid);
       assertEquals(TEST_CLIENT_NAME, tabsRecord.clientName);
 
       assertNotNull(tabsRecord.tabs);
@@ -76,17 +77,17 @@ public class TestTabsRecord extends Test
   // disk data and doubles as a database inspector.
   public void testLocalTabs() throws Exception {
     final ContentProviderClient tabsClient = getTabsClient();
 
     final String positionAscending = BrowserContract.Tabs.POSITION + " ASC";
     Cursor cursor = null;
     try {
       // Keep this in sync with the Fennec schema.
-      cursor = tabsClient.query(BrowserContract.Tabs.CONTENT_URI, null, BrowserContract.Tabs.CLIENT_GUID + " IS NULL", null, positionAscending);
+      cursor = tabsClient.query(BrowserContractHelpers.TABS_CONTENT_URI, null, BrowserContract.Tabs.CLIENT_GUID + " IS NULL", null, positionAscending);
       CursorDumper.dumpCursor(cursor);
 
       final TabsRecord tabsRecord = FennecTabsRepository.tabsRecordFromCursor(cursor, TEST_CLIENT_GUID, TEST_CLIENT_NAME);
 
       assertEquals(TEST_CLIENT_GUID, tabsRecord.guid);
       assertEquals(TEST_CLIENT_NAME, tabsRecord.clientName);
 
       assertNotNull(tabsRecord.tabs);