Delete tracks on Google Maps

This commit is contained in:
youtaol
2013-04-17 13:32:46 +08:00
parent e80b8b19c4
commit 3d6f9a1a2d
2 changed files with 25 additions and 3 deletions
@@ -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<MapsMapMetadata> 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.
*
@@ -48,7 +48,8 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2<TrackList
super.setUp();
instrumentation = getInstrumentation();
activityMyTracks = getActivity();
GoogleUtils.deleteTracksOnGoogleMaps(activityMyTracks);
GoogleUtils.deleteTestTracksOnGoogleDrive(activityMyTracks, GoogleUtils.ACCOUNT_NAME_1);
EndToEndTestUtils.setupForAllTest(instrumentation, activityMyTracks);
}
@@ -117,8 +118,8 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2<TrackList
assertTrue(SyncTestUtils.checkFile(EndToEndTestUtils.trackName, true,
SyncTestUtils.getGoogleDrive(activityMyTracks.getApplicationContext())));
assertTrue(GoogleUtils.deleteMap(EndToEndTestUtils.trackName, activityMyTracks));
assertTrue(GoogleUtils.searchFusionTableByTitle(EndToEndTestUtils.trackName,
activityMyTracks,GoogleUtils.ACCOUNT_NAME_1,true));
assertTrue(GoogleUtils.searchFusionTableByTitle(EndToEndTestUtils.trackName, activityMyTracks,
GoogleUtils.ACCOUNT_NAME_1, true));
assertTrue(GoogleUtils.deleteTrackInSpreadSheet(EndToEndTestUtils.trackName, activityMyTracks,
GoogleUtils.ACCOUNT_NAME_1));
}