merge branches

This commit is contained in:
Jimmy Shih
2013-02-22 11:07:53 -08:00
5 changed files with 17 additions and 18 deletions
@@ -146,11 +146,9 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
}
/**
* Tests the display of track start time. Use relative time (x mins ago) for
* the start time if it is within the past week. But only show the start time
* if it is different from the track name.
* Tests the display of track relative time.
*/
public void testTrackStartTime() {
public void testTrackRelativeTime() {
// Delete all track first.
EndToEndTestUtils.deleteAllTracks();
// Reset all settings.
@@ -167,12 +165,7 @@ public class CreateTrackTest extends ActivityInstrumentationTestCase2<TrackListA
instrumentation.waitForIdleSync();
EndToEndTestUtils.SOLO.goBack();
instrumentation.waitForIdleSync();
assertFalse(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.RELATIVE_STARTTIME_POSTFIX, 1, false, true));
// Test should show relative time for createSimpleTrack would save a track
// name that is different with the start time.
EndToEndTestUtils.createSimpleTrack(2, true);
assertTrue(EndToEndTestUtils.SOLO.waitForText(EndToEndTestUtils.RELATIVE_STARTTIME_POSTFIX, 1, EndToEndTestUtils.NORMAL_WAIT_TIME));
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.RELATIVE_STARTTIME_POSTFIX, 1, false, true));
}
/**
@@ -356,11 +356,11 @@ public class EndToEndTestUtils {
*/
private static void verifyFirstLaunch() {
getButtonOnScreen(activityMytracks.getString(R.string.eula_accept), true, true);
if (SOLO.waitForText(activityMytracks.getString(R.string.generic_ok))) {
if (SOLO.waitForText(activityMytracks.getString(R.string.welcome_title))) {
// Click for welcome.
getButtonOnScreen(activityMytracks.getString(R.string.generic_ok), true, true);
// Click for choose units.
getButtonOnScreen(activityMytracks.getString(R.string.generic_ok), true, true);
// Click for Sync with Google Drive(Don't enable sync as default).
getButtonOnScreen(activityMytracks.getString(R.string.generic_cancel), true, true);
instrumentation.waitForIdleSync();
}
}
@@ -59,7 +59,8 @@ public class SendToGoogleTest extends ActivityInstrumentationTestCase2<TrackList
* @throws IOException
*/
public void testCreateAndSendTrack_send() throws IOException, GoogleAuthException {
EndToEndTestUtils.createTrackIfEmpty(1, false);
// Create a new track.
EndToEndTestUtils.createSimpleTrack(1, false);
instrumentation.waitForIdleSync();
checkSendTrackToGoogle();
}
@@ -117,6 +117,7 @@ public class MultiAccountsSyncTest extends ActivityInstrumentationTestCase2<Trac
// Delete one track.
EndToEndTestUtils.SOLO.clickOnView(EndToEndTestUtils.SOLO.getCurrentListViews().get(0)
.getChildAt(0));
EndToEndTestUtils.instrumentation.waitForIdleSync();
EndToEndTestUtils.SOLO.clickOnMenuItem(EndToEndTestUtils.activityMytracks
.getString(R.string.menu_delete));
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
@@ -53,7 +53,7 @@ public class SyncTestUtils {
public static boolean isCheckedRunSyncTest = false;
public static final String KML_FILE_POSTFIX = ".kml";
public static final long MAX_TIME_TO_WAIT_SYNC = 50000;
public static final long MAX_TIME_TO_WAIT_SYNC = 100000;
/**
* Sets up sync tests.
@@ -64,7 +64,7 @@ public class SyncTestUtils {
*/
public static Drive setUpForSyncTest(Instrumentation instrumentation,
TrackListActivity trackListActivity) throws IOException, GoogleAuthException {
if (RunConfiguration.getInstance().runSyncTest || !isCheckedRunSyncTest) {
if (!isCheckedRunSyncTest || RunConfiguration.getInstance().runSyncTest) {
EndToEndTestUtils.setupForAllTest(instrumentation, trackListActivity);
}
if (!isCheckedRunSyncTest) {
@@ -171,20 +171,22 @@ public class SyncTestUtils {
* @param accountName the account which is used to sync with
*/
public static void enableSync(String accountName) {
EndToEndTestUtils.instrumentation.waitForIdleSync();
EndToEndTestUtils.findMenuItem(
EndToEndTestUtils.activityMytracks.getString(R.string.menu_settings), true);
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
.getString(R.string.settings_google));
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
.getString(R.string.settings_google_account_title));
EndToEndTestUtils.instrumentation.waitForIdleSync();
// Whether test account is bound.
if (EndToEndTestUtils.SOLO.waitForText(accountName, 1, EndToEndTestUtils.TINY_WAIT_TIME)) {
if (EndToEndTestUtils.SOLO.waitForText(accountName, 1, EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.SOLO.clickOnText(accountName);
EndToEndTestUtils.instrumentation.waitForIdleSync();
if (EndToEndTestUtils.SOLO.waitForText(
EndToEndTestUtils.activityMytracks.getString(
R.string.settings_google_account_confirm_message).split("%")[0], 1,
R.string.generic_confirm_title), 1,
EndToEndTestUtils.SHORT_WAIT_TIME)) {
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.activityMytracks
.getString(R.string.generic_ok));
@@ -210,6 +212,7 @@ public class SyncTestUtils {
}
EndToEndTestUtils.SOLO.goBack();
EndToEndTestUtils.SOLO.goBack();
EndToEndTestUtils.instrumentation.waitForIdleSync();
}
/**
@@ -222,6 +225,7 @@ public class SyncTestUtils {
long startTime = System.currentTimeMillis();
while (System.currentTimeMillis() - startTime < MAX_TIME_TO_WAIT_SYNC) {
try {
EndToEndTestUtils.sleep(EndToEndTestUtils.SHORT_WAIT_TIME);
int trackNumber = EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount();
List<File> files = getDriveFiles(
EndToEndTestUtils.activityMytracks.getApplicationContext(), drive);