mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-08 20:33:06 +02:00
Add retry for SyncAdapter.
This commit is contained in:
+2
-8
@@ -24,8 +24,6 @@ import com.google.api.services.drive.Drive;
|
||||
import android.app.Instrumentation;
|
||||
import android.test.ActivityInstrumentationTestCase2;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Tests the situation when user use multiple account in MyTracks.
|
||||
*
|
||||
@@ -63,10 +61,8 @@ public class MultiAccountsSyncTest extends ActivityInstrumentationTestCase2<Trac
|
||||
* <li>8. Enable sync with account2.</li>
|
||||
* <li>9. Check</li>
|
||||
* </ul>
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void testSyncTracksWithMultiAccounts() throws IOException {
|
||||
public void testSyncTracksWithMultiAccounts() throws Exception {
|
||||
if (!SyncTestUtils.runSyncTest) {
|
||||
return;
|
||||
}
|
||||
@@ -108,10 +104,8 @@ public class MultiAccountsSyncTest extends ActivityInstrumentationTestCase2<Trac
|
||||
* <li>5. Sync with account 1 (account 1 should have 1 file, account2 should
|
||||
* also have 1 file).</li>
|
||||
* </ul>
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
public void testDeleteTracksWithMultiAccounts() throws IOException {
|
||||
public void testDeleteTracksWithMultiAccounts() throws Exception {
|
||||
if (!SyncTestUtils.runSyncTest) {
|
||||
return;
|
||||
}
|
||||
|
||||
+7
-6
@@ -20,6 +20,7 @@ import com.google.android.apps.mytracks.endtoendtest.EndToEndTestUtils;
|
||||
import com.google.android.apps.mytracks.endtoendtest.GoogleUtils;
|
||||
import com.google.android.apps.mytracks.io.sync.SyncUtils;
|
||||
import com.google.android.apps.mytracks.util.PreferencesUtils;
|
||||
import com.google.android.gms.auth.GoogleAuthException;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
|
||||
import com.google.api.client.googleapis.json.GoogleJsonResponseException;
|
||||
@@ -61,10 +62,9 @@ public class SyncTestUtils {
|
||||
* @param instrumentation the instrumentation is used for test
|
||||
* @param trackListActivity the startup activity
|
||||
* @return a Google Drive object
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Drive setUpForSyncTest(Instrumentation instrumentation,
|
||||
TrackListActivity trackListActivity) throws IOException {
|
||||
TrackListActivity trackListActivity) throws IOException, GoogleAuthException {
|
||||
if (runSyncTest || !isCheckedRunSyncTest) {
|
||||
EndToEndTestUtils.setupForAllTest(instrumentation, trackListActivity);
|
||||
}
|
||||
@@ -116,10 +116,11 @@ public class SyncTestUtils {
|
||||
* @param context the context of application
|
||||
* @return a Google Drive object
|
||||
*/
|
||||
public static Drive getGoogleDrive(Context context) {
|
||||
String googleAccount = PreferencesUtils.getString(context, R.string.google_account_key,
|
||||
PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
||||
GoogleAccountCredential credential = SyncUtils.getCredential(context, googleAccount);
|
||||
public static Drive getGoogleDrive(Context context) throws IOException, GoogleAuthException {
|
||||
String googleAccount = PreferencesUtils.getString(
|
||||
context, R.string.google_account_key, PreferencesUtils.GOOGLE_ACCOUNT_DEFAULT);
|
||||
GoogleAccountCredential credential = SyncUtils.getGoogleAccountCredential(
|
||||
context, googleAccount);
|
||||
return SyncUtils.getDriveService(credential);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user