Bug 1260478 - Fixed review nits from previous commits. r=me
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 14 Apr 2016 14:38:43 -0700
changeset 331291 90a025addc58d0bbbbcde962f209dfea1dde81da
parent 331290 534d3392d794f3d885348bc0998b9751027012c7
child 331292 55f774304456fba311e048824adf6df207c5d760
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1260478
milestone48.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 1260478 - Fixed review nits from previous commits. r=me Taking over this bug as nalexander is not available. MozReview-Commit-ID: 2Vkv4U6anyD
mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/db/DelegatingTestContentProvider.java
mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/db/TestTabsProvider.java
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/db/DelegatingTestContentProvider.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/db/DelegatingTestContentProvider.java
@@ -1,8 +1,12 @@
+/* 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/. */
+
 package org.mozilla.gecko.background.db;
 
 import android.content.ContentProvider;
 import android.content.ContentProviderOperation;
 import android.content.ContentProviderResult;
 import android.content.ContentValues;
 import android.content.OperationApplicationException;
 import android.database.Cursor;
@@ -23,22 +27,17 @@ public class DelegatingTestContentProvid
     }
 
     public DelegatingTestContentProvider(ContentProvider targetProvider) {
         super();
         mTargetProvider = targetProvider;
     }
 
     private Uri appendTestParam(Uri uri) {
-        try {
-            return appendUriParam(uri, BrowserContract.PARAM_IS_TEST, "1");
-        } catch (Exception e) {
-        }
-
-        return null;
+        return appendUriParam(uri, BrowserContract.PARAM_IS_TEST, "1");
     }
 
     @Override
     public boolean onCreate() {
         return mTargetProvider.onCreate();
     }
 
     @Override
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/db/TestTabsProvider.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/db/TestTabsProvider.java
@@ -57,26 +57,26 @@ public class TestTabsProvider {
 
     protected ContentProviderClient getTabsClient() {
         final ShadowContentResolver cr = new ShadowContentResolver();
         return cr.acquireContentProviderClient(BrowserContractHelpers.TABS_CONTENT_URI);
     }
 
     protected int deleteTestClient(final ContentProviderClient clientsClient) throws RemoteException {
         if (clientsClient == null) {
-            return -1;
+            throw new IllegalStateException("Provided ContentProviderClient is null");
         }
         return clientsClient.delete(BrowserContractHelpers.CLIENTS_CONTENT_URI, CLIENTS_GUID_IS, new String[] { TEST_CLIENT_GUID });
     }
 
     protected int deleteAllTestTabs(final ContentProviderClient tabsClient) throws RemoteException {
         if (tabsClient == null) {
-            return -1;
+            throw new IllegalStateException("Provided ContentProviderClient is null");
         }
-        return tabsClient.delete(BrowserContractHelpers.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 });
     }
 
     protected void insertTestClient(final ContentProviderClient clientsClient) throws RemoteException {
         ContentValues cv = new ContentValues();
         cv.put(BrowserContract.Clients.GUID, TEST_CLIENT_GUID);
         cv.put(BrowserContract.Clients.NAME, TEST_CLIENT_NAME);
         clientsClient.insert(BrowserContractHelpers.CLIENTS_CONTENT_URI, cv);
     }
@@ -111,29 +111,29 @@ public class TestTabsProvider {
         clientsClient.release();
 
         final ContentProviderClient tabsClient = getTabsClient();
         Assert.assertNotNull(tabsClient);
         tabsClient.release();
     }
 
     @Test
-    public void testWipeClients() throws RemoteException {
+    public void testDeleteEmptyClients() throws RemoteException {
         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);
         Assert.assertEquals(0, deleted);
     }
 
     @Test
-    public void testWipeTabs() throws RemoteException {
+    public void testDeleteEmptyTabs() throws RemoteException {
         final ContentProviderClient tabsClient = getTabsClient();
 
         // Have to ensure that it's empty…
         deleteAllTestTabs(tabsClient);
 
         int deleted = deleteAllTestTabs(tabsClient);
         Assert.assertEquals(0, deleted);
     }