1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/tests/background/junit3/src/sync/helpers/HistoryHelpers.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,90 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +package org.mozilla.gecko.background.sync.helpers; 1.8 + 1.9 +import org.json.simple.JSONArray; 1.10 +import org.json.simple.JSONObject; 1.11 +import org.mozilla.gecko.sync.repositories.domain.HistoryRecord; 1.12 + 1.13 +public class HistoryHelpers { 1.14 + 1.15 + @SuppressWarnings("unchecked") 1.16 + private static JSONArray getVisits1() { 1.17 + JSONArray json = new JSONArray(); 1.18 + JSONObject obj = new JSONObject(); 1.19 + obj.put("date", 1320087601465600000L); 1.20 + obj.put("type", 2L); 1.21 + json.add(obj); 1.22 + obj = new JSONObject(); 1.23 + obj.put("date", 1320084970724990000L); 1.24 + obj.put("type", 1L); 1.25 + json.add(obj); 1.26 + obj = new JSONObject(); 1.27 + obj.put("date", 1319764134412287000L); 1.28 + obj.put("type", 1L); 1.29 + json.add(obj); 1.30 + obj = new JSONObject(); 1.31 + obj.put("date", 1319681306455594000L); 1.32 + obj.put("type", 2L); 1.33 + json.add(obj); 1.34 + return json; 1.35 + } 1.36 + 1.37 + @SuppressWarnings("unchecked") 1.38 + private static JSONArray getVisits2() { 1.39 + JSONArray json = new JSONArray(); 1.40 + JSONObject obj = new JSONObject(); 1.41 + obj = new JSONObject(); 1.42 + obj.put("date", 1319764134412345000L); 1.43 + obj.put("type", 4L); 1.44 + json.add(obj); 1.45 + obj = new JSONObject(); 1.46 + obj.put("date", 1319681306454321000L); 1.47 + obj.put("type", 3L); 1.48 + json.add(obj); 1.49 + return json; 1.50 + } 1.51 + 1.52 + public static HistoryRecord createHistory1() { 1.53 + HistoryRecord record = new HistoryRecord(); 1.54 + record.title = "History 1"; 1.55 + record.histURI = "http://history.page1.com"; 1.56 + record.visits = getVisits1(); 1.57 + return record; 1.58 + } 1.59 + 1.60 + 1.61 + public static HistoryRecord createHistory2() { 1.62 + HistoryRecord record = new HistoryRecord(); 1.63 + record.title = "History 2"; 1.64 + record.histURI = "http://history.page2.com"; 1.65 + record.visits = getVisits2(); 1.66 + return record; 1.67 + } 1.68 + 1.69 + public static HistoryRecord createHistory3() { 1.70 + HistoryRecord record = new HistoryRecord(); 1.71 + record.title = "History 3"; 1.72 + record.histURI = "http://history.page3.com"; 1.73 + record.visits = getVisits2(); 1.74 + return record; 1.75 + } 1.76 + 1.77 + public static HistoryRecord createHistory4() { 1.78 + HistoryRecord record = new HistoryRecord(); 1.79 + record.title = "History 4"; 1.80 + record.histURI = "http://history.page4.com"; 1.81 + record.visits = getVisits1(); 1.82 + return record; 1.83 + } 1.84 + 1.85 + public static HistoryRecord createHistory5() { 1.86 + HistoryRecord record = new HistoryRecord(); 1.87 + record.title = "History 5"; 1.88 + record.histURI = "http://history.page5.com"; 1.89 + record.visits = getVisits2(); 1.90 + return record; 1.91 + } 1.92 + 1.93 +} 1.94 \ No newline at end of file