From 11ca9cc450797435424fbf68797cb9d4f687e58c Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Tue, 18 Dec 2012 15:02:50 -0800 Subject: [PATCH] Update MyTracksProviderUtils api to make it clear the valid values that can be used. --- MyTracks/.classpath | 2 +- .../apps/mytracks/content/TrackDataHub.java | 2 +- .../mytracks/io/file/TrackWriterImpl.java | 4 +-- .../SendFusionTablesAsyncTask.java | 4 +-- .../mytracks/io/maps/SendMapsAsyncTask.java | 4 +-- .../services/TrackRecordingService.java | 2 +- .../apps/mytracks/util/StringUtils.java | 27 ++++++++++++++++++- .../content/MyTracksProviderUtils.java | 27 +++++++++---------- .../content/MyTracksProviderUtilsImpl.java | 11 ++++---- .../.settings/org.eclipse.jdt.core.prefs | 1 - MyTracksTest/AndroidManifest.xml | 2 +- .../MyTracksProviderUtilsImplTest.java | 10 +++---- .../mytracks/content/TrackDataHubTest.java | 6 ++--- .../io/maps/SendMapsAsyncTaskTest.java | 16 +++++------ .../services/TrackRecordingServiceTest.java | 2 +- 15 files changed, 72 insertions(+), 48 deletions(-) diff --git a/MyTracks/.classpath b/MyTracks/.classpath index 76278ed08..1b279c5c2 100644 --- a/MyTracks/.classpath +++ b/MyTracks/.classpath @@ -2,8 +2,8 @@ + - diff --git a/MyTracks/src/com/google/android/apps/mytracks/content/TrackDataHub.java b/MyTracks/src/com/google/android/apps/mytracks/content/TrackDataHub.java index 65bee0266..ad07b897c 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/content/TrackDataHub.java +++ b/MyTracks/src/com/google/android/apps/mytracks/content/TrackDataHub.java @@ -565,7 +565,7 @@ public class TrackDataHub implements DataSourceListener { Cursor cursor = null; try { cursor = myTracksProviderUtils.getWaypointCursor( - selectedTrackId, 0L, MAX_DISPLAYED_WAYPOINTS_POINTS); + selectedTrackId, -1L, MAX_DISPLAYED_WAYPOINTS_POINTS); if (cursor != null && cursor.moveToFirst()) { do { Waypoint waypoint = myTracksProviderUtils.createWaypoint(cursor); diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriterImpl.java b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriterImpl.java index b45be01c8..a97d07431 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriterImpl.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/file/TrackWriterImpl.java @@ -242,7 +242,7 @@ class TrackWriterImpl implements TrackWriter { // problem because we don't try to load them into objects all at the // same time. Cursor cursor = null; - cursor = providerUtils.getWaypointCursor(trackId, 0, + cursor = providerUtils.getWaypointCursor(trackId, -1L, Constants.MAX_LOADED_WAYPOINTS_POINTS); boolean hasWaypoints = false; if (cursor != null) { @@ -311,7 +311,7 @@ class TrackWriterImpl implements TrackWriter { }; TrackWriterLocationFactory locationFactory = new TrackWriterLocationFactory(); - LocationIterator it = providerUtils.getTrackPointLocationIterator(track.getId(), 0, false, + LocationIterator it = providerUtils.getTrackPointLocationIterator(track.getId(), -1L, false, locationFactory); try { int pointNumber = 0; diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesAsyncTask.java b/MyTracks/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesAsyncTask.java index 22b0f1ea5..114e5726d 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesAsyncTask.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/fusiontables/SendFusionTablesAsyncTask.java @@ -210,7 +210,7 @@ public class SendFusionTablesAsyncTask extends AbstractSendAsyncTask { private boolean uploadAllTrackPoints(Track track) { Cursor cursor = null; try { - cursor = myTracksProviderUtils.getTrackPointCursor(trackId, 0, -1, false); + cursor = myTracksProviderUtils.getTrackPointCursor(trackId, -1L, -1, false); if (cursor == null) { Log.d(TAG, "Location cursor is null"); return false; @@ -329,7 +329,7 @@ public class SendFusionTablesAsyncTask extends AbstractSendAsyncTask { Cursor cursor = null; try { cursor = myTracksProviderUtils.getWaypointCursor( - trackId, 0, Constants.MAX_LOADED_WAYPOINTS_POINTS); + trackId, -1L, Constants.MAX_LOADED_WAYPOINTS_POINTS); if (cursor != null && cursor.moveToFirst()) { // This will skip the first waypoint (it carries the stats for the // track). diff --git a/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTask.java b/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTask.java index 0dfab09ce..6a7ff7a73 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTask.java +++ b/MyTracks/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTask.java @@ -253,7 +253,7 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask { boolean uploadAllTrackPoints(Track track) { Cursor cursor = null; try { - cursor = myTracksProviderUtils.getTrackPointCursor(trackId, 0, -1, false); + cursor = myTracksProviderUtils.getTrackPointCursor(trackId, -1L, -1, false); if (cursor == null) { Log.d(TAG, "Location cursor is null"); return false; @@ -437,7 +437,7 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask { Cursor cursor = null; try { cursor = myTracksProviderUtils.getWaypointCursor( - trackId, 0, Constants.MAX_LOADED_WAYPOINTS_POINTS); + trackId, -1L, Constants.MAX_LOADED_WAYPOINTS_POINTS); if (cursor != null && cursor.moveToFirst()) { // This will skip the first waypoint (it carries the stats for the // track). diff --git a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java index 4c078c775..cea1615be 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java +++ b/MyTracks/src/com/google/android/apps/mytracks/services/TrackRecordingService.java @@ -604,7 +604,7 @@ public class TrackRecordingService extends Service { try { // TODO: how to handle very long track. cursor = myTracksProviderUtils.getTrackPointCursor( - recordingTrackId, -1, Constants.MAX_LOADED_TRACK_POINTS, true); + recordingTrackId, -1L, Constants.MAX_LOADED_TRACK_POINTS, true); if (cursor == null) { Log.e(TAG, "Cursor is null."); } else { diff --git a/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java b/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java index 0c75d84a3..65f26834e 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java +++ b/MyTracks/src/com/google/android/apps/mytracks/util/StringUtils.java @@ -27,6 +27,7 @@ import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import java.util.Locale; import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -96,7 +97,31 @@ public class StringUtils { * @param time the time in milliseconds */ public static String formatElapsedTime(long time) { - return DateUtils.formatElapsedTime(time / 1000); + /* + * Temporary workaround for DateUtils.formatElapsedTime(time / 1000). In API + * level 17, it returns strings like "1:0:00" instead of "1:00:00", which + * breaks several unit tests. + */ + long elapsedSeconds = time / 1000; + long hours = 0; + long minutes = 0; + long seconds = 0; + + if (elapsedSeconds >= 3600) { + hours = elapsedSeconds / 3600; + elapsedSeconds -= hours * 3600; + } + if (elapsedSeconds >= 60) { + minutes = elapsedSeconds / 60; + elapsedSeconds -= minutes * 60; + } + seconds = elapsedSeconds; + + if (hours > 0) { + return String.format(Locale.US, "%d:%02d:%02d", hours, minutes, seconds); + } else { + return String.format(Locale.US, "%02d:%02d", minutes, seconds); + } } /** diff --git a/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtils.java b/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtils.java index 375e78394..9c101f386 100644 --- a/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtils.java +++ b/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtils.java @@ -82,9 +82,9 @@ public interface MyTracksProviderUtils { * Gets a track cursor. The caller owns the returned cursor and is responsible * for closing it. * - * @param selection the selection - * @param selectionArgs the selection arguments - * @param sortOrder the sort order + * @param selection the selection. Can be null + * @param selectionArgs the selection arguments. Can be null + * @param sortOrder the sort order. Can be null */ public Cursor getTrackCursor(String selection, String[] selectionArgs, String sortOrder); @@ -120,7 +120,7 @@ public interface MyTracksProviderUtils { * deletion. The generator is used to update the next statistics waypoint. * * @param waypointId the waypoint id - * @param descriptionGenerator the description generator + * @param descriptionGenerator the description generator. Can be null for waypoint marker */ public void deleteWaypoint(long waypointId, DescriptionGenerator descriptionGenerator); @@ -160,10 +160,10 @@ public interface MyTracksProviderUtils { * Gets a waypoint cursor. The caller owns the returned cursor and is * responsible for closing it. * - * @param selection the selection - * @param selectionArgs the selection arguments - * @param sortOrder the sort order - * @param maxWaypoints the maximum number of waypoints to return + * @param selection the selection. Can be null + * @param selectionArgs the selection arguments. Can be null + * @param sortOrder the sort order. Can be null + * @param maxWaypoints the maximum number of waypoints to return. -1 for no limit */ public Cursor getWaypointCursor( String selection, String[] selectionArgs, String sortOrder, int maxWaypoints); @@ -173,8 +173,8 @@ public interface MyTracksProviderUtils { * is responsible for closing it. * * @param trackId the track id - * @param minWaypointId the minimum waypoint id - * @param maxWaypoints the maximum number of waypoints to return + * @param minWaypointId the minimum waypoint id. -1L to ignore + * @param maxWaypoints the maximum number of waypoints to return. -1 for no limit */ public Cursor getWaypointCursor(long trackId, long minWaypointId, int maxWaypoints); @@ -242,8 +242,8 @@ public interface MyTracksProviderUtils { * responsible for closing it. * * @param trackId the track id - * @param startTrackPointId the starting track point id - * @param maxLocations maximum number of locations to return + * @param startTrackPointId the starting track point id. -1L to ignore + * @param maxLocations maximum number of locations to return. -1 for no limit * @param descending true to sort the result in descending order (latest * location first) */ @@ -262,8 +262,7 @@ public interface MyTracksProviderUtils { * iteration, {@link LocationIterator#close()} must be called. * * @param trackId the track id - * @param startTrackPointId the start track point id or -1L to start from the - * first point + * @param startTrackPointId the starting track point id. -1L to ignore * @param descending true to sort the result in descending order (latest * location first) * @param locationFactory the location factory diff --git a/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImpl.java b/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImpl.java index 6f45d3931..8eabdf7f6 100644 --- a/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImpl.java +++ b/MyTracksLib/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImpl.java @@ -439,7 +439,8 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils { @Override public void deleteWaypoint(long waypointId, DescriptionGenerator descriptionGenerator) { final Waypoint waypoint = getWaypoint(waypointId); - if (waypoint != null && waypoint.getType() == Waypoint.TYPE_STATISTICS) { + if (waypoint != null && waypoint.getType() == Waypoint.TYPE_STATISTICS + && descriptionGenerator != null) { final Waypoint nextWaypoint = getNextStatisticsWaypointAfter(waypoint); if (nextWaypoint == null) { Log.d(TAG, "Unable to find the next statistics marker after deleting one."); @@ -510,7 +511,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils { String selection = WaypointsColumns.TRACKID + "=? AND " + WaypointsColumns.TYPE + "=?"; int type = statistics ? Waypoint.TYPE_STATISTICS : Waypoint.TYPE_WAYPOINT; String[] selectionArgs = new String[] { Long.toString(trackId), Integer.toString(type) }; - cursor = getWaypointCursor(projection, selection, selectionArgs, WaypointsColumns._ID, 0); + cursor = getWaypointCursor(projection, selection, selectionArgs, WaypointsColumns._ID, -1); if (cursor != null) { int count = cursor.getCount(); /* @@ -535,7 +536,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils { Cursor cursor = null; try { cursor = getWaypointCursor(null, WaypointsColumns._ID + "=?", - new String[] { Long.toString(waypointId) }, WaypointsColumns._ID, 0); + new String[] { Long.toString(waypointId) }, WaypointsColumns._ID, 1); if (cursor != null && cursor.moveToFirst()) { return createWaypoint(cursor); } @@ -672,7 +673,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils { if (sortOrder == null) { sortOrder = WaypointsColumns._ID; } - if (maxWaypoints > 0) { + if (maxWaypoints >= 0) { sortOrder += " LIMIT " + maxWaypoints; } return contentResolver.query( @@ -789,7 +790,7 @@ public class MyTracksProviderUtilsImpl implements MyTracksProviderUtils { if (descending) { sortOrder += " DESC"; } - if (maxLocations > 0) { + if (maxLocations >= 0) { sortOrder += " LIMIT " + maxLocations; } return getTrackPointCursor(null, selection, selectionArgs, sortOrder); diff --git a/MyTracksTest/.settings/org.eclipse.jdt.core.prefs b/MyTracksTest/.settings/org.eclipse.jdt.core.prefs index 4c42458af..2c72e774c 100644 --- a/MyTracksTest/.settings/org.eclipse.jdt.core.prefs +++ b/MyTracksTest/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,3 @@ -#Tue Jul 17 10:23:26 PDT 2012 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 diff --git a/MyTracksTest/AndroidManifest.xml b/MyTracksTest/AndroidManifest.xml index b8f77bb14..a0a248b95 100644 --- a/MyTracksTest/AndroidManifest.xml +++ b/MyTracksTest/AndroidManifest.xml @@ -29,7 +29,7 @@ limitations under the License. + android:targetSdkVersion="17" /> diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImplTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImplTest.java index 315dcf01f..ebb2721fc 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImplTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/content/MyTracksProviderUtilsImplTest.java @@ -128,7 +128,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase { ((MyTracksProviderUtilsImpl) providerUtils).setDefaultCursorBatchSize(batchSize); List locations = new ArrayList(numPoints); LocationIterator it = providerUtils.getTrackPointLocationIterator( - trackId, -1, descending, locationFactory); + trackId, -1L, descending, locationFactory); try { while (it.hasNext()) { Location loc = it.next(); @@ -168,7 +168,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase { // Load all inserted locations. long lastPointId = -1; int counter = 0; - LocationIterator it = providerUtils.getTrackPointLocationIterator(id, -1, false, + LocationIterator it = providerUtils.getTrackPointLocationIterator(id, -1L, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY); try { while (it.hasNext()) { @@ -645,9 +645,9 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase { insertTrackWithLocations(track); providerUtils.bulkInsertTrackPoint(track.getLocations().toArray(new Location[0]), -1, trackId); - assertEquals(20, providerUtils.getTrackPointCursor(trackId, 0, 1000, false).getCount()); + assertEquals(20, providerUtils.getTrackPointCursor(trackId, -1L, 1000, false).getCount()); providerUtils.bulkInsertTrackPoint(track.getLocations().toArray(new Location[0]), 8, trackId); - assertEquals(28, providerUtils.getTrackPointCursor(trackId, 0, 1000, false).getCount()); + assertEquals(28, providerUtils.getTrackPointCursor(trackId, -1L, 1000, false).getCount()); } /** @@ -728,7 +728,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase { insertTrackWithLocations(track); providerUtils.insertTrackPoint(createLocation(22), trackId); - assertEquals(11, providerUtils.getTrackPointCursor(trackId, 0, 1000, false).getCount()); + assertEquals(11, providerUtils.getTrackPointCursor(trackId, -1L, 1000, false).getCount()); } /** diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/content/TrackDataHubTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/content/TrackDataHubTest.java index 8b35a3f4d..bca727060 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/content/TrackDataHubTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/content/TrackDataHubTest.java @@ -204,7 +204,7 @@ public class TrackDataHubTest extends AndroidTestCase { // Register two listeners Capture contentObserverCapture = new Capture(); expect(myTracksProviderUtils.getWaypointCursor( - eq(TRACK_ID), AndroidMock.leq(0L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS))) + eq(TRACK_ID), AndroidMock.leq(-1L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS))) .andStubAnswer(new FixedSizeCursorAnswer(2)); expect(myTracksProviderUtils.createWaypoint(isA(Cursor.class))) .andReturn(waypoint1).andReturn(waypoint2).andReturn(waypoint1).andReturn(waypoint2); @@ -231,7 +231,7 @@ public class TrackDataHubTest extends AndroidTestCase { // Cause waypoints table update ContentObserver contentObserver = contentObserverCapture.getValue(); expect(myTracksProviderUtils.getWaypointCursor( - eq(TRACK_ID), AndroidMock.leq(0L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS))) + eq(TRACK_ID), AndroidMock.leq(-1L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS))) .andStubAnswer(new FixedSizeCursorAnswer(3)); expect(myTracksProviderUtils.createWaypoint(isA(Cursor.class))) .andReturn(waypoint1).andReturn(waypoint2).andReturn(waypoint3); @@ -252,7 +252,7 @@ public class TrackDataHubTest extends AndroidTestCase { // Unregister one listener expect(myTracksProviderUtils.getWaypointCursor( - eq(TRACK_ID), AndroidMock.leq(0L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS))) + eq(TRACK_ID), AndroidMock.leq(-1L), eq(Constants.MAX_DISPLAYED_WAYPOINTS_POINTS))) .andStubAnswer(new FixedSizeCursorAnswer(4)); expect(myTracksProviderUtils.createWaypoint(isA(Cursor.class))) .andReturn(waypoint1).andReturn(waypoint2).andReturn(waypoint3).andReturn(waypoint4); diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java index 61f35e6f3..05930134c 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/io/maps/SendMapsAsyncTaskTest.java @@ -144,7 +144,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { */ public void testUploadAllTrackPoints_nullCursor() { Track track = TrackStubUtils.createTrack(1); - AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, 0, -1, false)) + AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, -1L, -1, false)) .andReturn(null); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock); SendMapsAsyncTask sendMapsAsyncTask = new SendMapsAsyncTask(sendMapsActivityMock, @@ -166,7 +166,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { cursorMock.close(); AndroidMock.expect(myTracksProviderUtilsMock.createTrackPoint(cursorMock)).andReturn( new Location("1")); - AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, 0, -1, false)) + AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, -1L, -1, false)) .andReturn(cursorMock); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock, cursorMock); @@ -193,7 +193,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { cursorMock.close(); AndroidMock.expect(myTracksProviderUtilsMock.createTrackPoint(cursorMock)) .andReturn(new Location("1")).times(2); - AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, 0, -1, false)) + AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, -1L, -1, false)) .andReturn(cursorMock); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock, cursorMock); @@ -223,7 +223,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { cursorMock.close(); AndroidMock.expect(myTracksProviderUtilsMock.createTrackPoint(cursorMock)) .andReturn(new Location("1")).times(2); - AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, 0, -1, false)) + AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, -1L, -1, false)) .andReturn(cursorMock); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock, cursorMock); @@ -252,7 +252,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { cursorMock.close(); AndroidMock.expect(myTracksProviderUtilsMock.createTrackPoint(cursorMock)) .andReturn(new Location("1")).times(2); - AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, 0, -1, false)) + AndroidMock.expect(myTracksProviderUtilsMock.getTrackPointCursor(TRACK_ID, -1L, -1, false)) .andReturn(cursorMock); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock, cursorMock); @@ -274,7 +274,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { @UsesMocks(Cursor.class) public void testUploadWaypoints_nullCursor() { AndroidMock.expect( - myTracksProviderUtilsMock.getWaypointCursor(TRACK_ID, 0, + myTracksProviderUtilsMock.getWaypointCursor(TRACK_ID, -1L, Constants.MAX_LOADED_WAYPOINTS_POINTS)).andReturn(null); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock); SendMapsAsyncTask sendMapsAsyncTask = new SendMapsAsyncTask(sendMapsActivityMock, @@ -296,7 +296,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { cursorMock.close(); AndroidMock.expect( - myTracksProviderUtilsMock.getWaypointCursor(TRACK_ID, 0, + myTracksProviderUtilsMock.getWaypointCursor(TRACK_ID, -1L, Constants.MAX_LOADED_WAYPOINTS_POINTS)).andReturn(cursorMock); AndroidMock.replay(sendMapsActivityMock, myTracksProviderUtilsMock, cursorMock); @@ -323,7 +323,7 @@ public class SendMapsAsyncTaskTest extends AndroidTestCase { cursorMock.close(); AndroidMock.expect( - myTracksProviderUtilsMock.getWaypointCursor(TRACK_ID, 0, + myTracksProviderUtilsMock.getWaypointCursor(TRACK_ID, -1L, Constants.MAX_LOADED_WAYPOINTS_POINTS)).andReturn(cursorMock); Waypoint waypoint = new Waypoint(); waypoint.setLocation(TrackStubUtils.createMyTracksLocation()); diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java index d42eca220..fb8c96071 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/services/TrackRecordingServiceTest.java @@ -787,6 +787,6 @@ public class TrackRecordingServiceTest extends ServiceTestCase