Bug 1292359 - Treat visit type consistently as a Long while syncing. r=nalexander, a=gchang FIREFOX_49_0b2_BUILD1 FIREFOX_49_0b2_RELEASE
authorGrigory Kruglov <gkruglov@mozilla.com>
Fri, 05 Aug 2016 13:05:01 -0700
changeset 340240 b1bdd0f3482ae07d38a2ec5fbf190a2c4f2310ee
parent 340239 0c78321d9c7d4545f7cad617347c95a4f930d4bd
child 340241 efa6e16e9e4d3618728c76464b0c7c6c50640755
child 340258 ef8bd81c98485cffb40d7a5d092ab2d50de72e14
push id6274
push usercbook@mozilla.com
push dateMon, 08 Aug 2016 07:22:14 +0000
treeherdermozilla-beta@b1bdd0f3482a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, gchang
bugs1292359
milestone49.0
Bug 1292359 - Treat visit type consistently as a Long while syncing. r=nalexander, a=gchang MozReview-Commit-ID: ESn4t3lznNl
mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/VisitsHelper.java
mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/repositories/android/VisitsHelperTest.java
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/VisitsHelper.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/android/VisitsHelper.java
@@ -73,17 +73,17 @@ public class VisitsHelper {
                 return visits;
             }
 
             final int dateVisitedCol = cursor.getColumnIndexOrThrow(Visits.DATE_VISITED);
             final int visitTypeCol = cursor.getColumnIndexOrThrow(Visits.VISIT_TYPE);
 
             while (!cursor.isAfterLast()) {
                 insertTupleIntoVisitsUnchecked(visits,
-                        cursor.getInt(visitTypeCol),
+                        cursor.getLong(visitTypeCol),
                         cursor.getLong(dateVisitedCol)
                 );
                 cursor.moveToNext();
             }
         } finally {
             cursor.close();
         }
 
@@ -109,17 +109,17 @@ public class VisitsHelper {
         cv.put(Visits.IS_LOCAL, isLocal ? Visits.VISIT_IS_LOCAL : Visits.VISIT_IS_REMOTE);
         cv.put(Visits.VISIT_TYPE, (Long) visit.get(SYNC_TYPE_KEY));
         cv.put(Visits.DATE_VISITED, (Long) visit.get(SYNC_DATE_KEY));
 
         return cv;
     }
 
     @SuppressWarnings("unchecked")
-    private static void insertTupleIntoVisitsUnchecked(JSONArray visits, Integer type, Long date) {
+    private static void insertTupleIntoVisitsUnchecked(@NonNull final JSONArray visits, @NonNull Long type, @NonNull Long date) {
         final JSONObject visit = new JSONObject();
         visit.put(SYNC_TYPE_KEY, type);
         visit.put(SYNC_DATE_KEY, date);
         visits.add(visit);
     }
 
     private static Uri visitsUriWithLimit(int limit) {
         return BrowserContractHelpers.VISITS_CONTENT_URI
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/repositories/android/VisitsHelperTest.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/sync/repositories/android/VisitsHelperTest.java
@@ -80,19 +80,19 @@ public class VisitsHelperTest {
             }
 
             // test that limit worked, that sorting is correct, and that both date and type are present
             JSONArray recentVisits = VisitsHelper.getRecentHistoryVisitsForGUID(visitsClient, "testGUID", 10);
             Assert.assertEquals(10, recentVisits.size());
             for (int i = 0; i < recentVisits.size(); i++) {
                 JSONObject v = (JSONObject) recentVisits.get(i);
                 Long date = (Long) v.get("date");
-                Integer type = (Integer) v.get("type");
+                Long type = (Long) v.get("type");
                 Assert.assertEquals(Long.valueOf(baseDate - i * 100), date);
-                Assert.assertEquals(Integer.valueOf(1), type);
+                Assert.assertEquals(Long.valueOf(1), type);
             }
         } finally {
             provider.shutdown();
         }
     }
 
     @Test
     public void testGetVisitContentValues() throws Exception {