diff --git a/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/GoogleUtils.java b/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/GoogleUtils.java index 8bdcd410c..03ce8363e 100644 --- a/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/GoogleUtils.java +++ b/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/GoogleUtils.java @@ -209,6 +209,27 @@ public class GoogleUtils { } } + /** + * Removes old tracks on Google Maps created by MyTracks test. + * + * @param activity + */ + public static void deleteTracksOnGoogleMaps(Activity activity) { + Context context = activity.getApplicationContext(); + MapsClient mapsClient = new MapsClient(GDataClientFactory.getGDataClient(context), + new XmlMapsGDataParserFactory(new AndroidXmlParserFactory())); + ArrayList mapData = getMaps(context, mapsClient); + for (MapsMapMetadata oneData : mapData) { + + try { + mapsClient.deleteEntry(oneData.getGDataEditUri(), AccountManager.get(context) + .blockingGetAuthToken(getAccount(context), MapsConstants.SERVICE_NAME, false)); + } catch (Exception e) { + Log.d(EndToEndTestUtils.LOG_TAG, "Unable to drop map", e); + } + } + } + /** * Delete spreadsheet which name is title. * diff --git a/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/SendToGoogleTest.java b/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/SendToGoogleTest.java index f4774c32c..6f32965a5 100644 --- a/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/SendToGoogleTest.java +++ b/MyTracksTest_E2E/src/com/google/android/apps/mytracks/endtoendtest/SendToGoogleTest.java @@ -48,7 +48,8 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2