Move the code about checking status of GPS signal back to make the test runs well on real devices. Fix a warning in CreateAndSendTrackTest.

This commit is contained in:
youtaol
2012-08-15 15:51:43 +08:00
parent 532c7495e4
commit 302144d003
2 changed files with 10 additions and 12 deletions
@@ -262,9 +262,8 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
/**
* Tests whether the split marker is created as setting.
* @throws InterruptedException
*/
public void testSplitSetting() throws InterruptedException {
public void testSplitSetting() {
EndToEndTestUtils.startRecording();
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_split_frequency), true);
@@ -215,24 +215,15 @@ public class EndToEndTestUtils {
* @param activityMyTracks the startup activity
*/
static void setupForAllTest(Instrumentation instrumentation, TrackListActivity activityMyTracks) {
setIsEmulator();
EndToEndTestUtils.instrumentation = instrumentation;
EndToEndTestUtils.activityMytracks = activityMyTracks;
SOLO = new Solo(EndToEndTestUtils.instrumentation,
EndToEndTestUtils.activityMytracks);
// For emulator, we would fix GPS signal.
if(!isEmulator) {
GoToMyLocationTest.findAndClickMyLocation(activityMyTracks);
hasGpsSingal = !SOLO.waitForText(NO_GPS_MESSAGE_PREFIX, 1,
EndToEndTestUtils.SHORT_WAIT_TIME);
SOLO.goBack();
}
// Check if open MyTracks first time after install. If so, there would be a
// welcome view with accept buttons. And makes sure only check once.
if (!isCheckedFirstLaunch) {
setIsEmulator();
if ((getButtonOnScreen(EndToEndTestUtils.activityMytracks
.getString(R.string.eula_accept), false, false) != null)) {
verifyFirstLaunch();
@@ -246,6 +237,14 @@ public class EndToEndTestUtils {
isCheckedFirstLaunch = true;
deleteAllTracks();
resetAllSettings(activityMyTracks, false);
// Check the status of real phone. For emulator, we would fix GPS signal.
if(!isEmulator) {
GoToMyLocationTest.findAndClickMyLocation(activityMyTracks);
hasGpsSingal = !SOLO.waitForText(NO_GPS_MESSAGE_PREFIX, 1,
EndToEndTestUtils.SHORT_WAIT_TIME);
SOLO.goBack();
}
} else if (SOLO.waitForText(
// After reset setting, welcome page will show again.
activityMytracks.getString(R.string.welcome_title), 0, SHORT_WAIT_TIME)) {