Add a long track test case to stress test.

This commit is contained in:
youtaol
2012-12-14 15:58:20 +08:00
parent a90a2ec692
commit d88995e8b9
3 changed files with 20 additions and 3 deletions
@@ -77,7 +77,7 @@ public class BigTestUtils {
new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
int rawlevel = batteryIntent.getIntExtra("level", -1);
double scale = batteryIntent.getIntExtra("scale", -1);
return "Phone use " + rawlevel + " of " + scale + " battery";
return "Device has " + rawlevel + " of " + scale + " battery left";
}
/**
@@ -46,7 +46,7 @@ public class ResourceUsageTest extends ActivityInstrumentationTestCase2<TrackLis
private static boolean isUserConfirmed = false;
private Context context;
/**
* Default duration for each test is one hour.
* Default duration for each test is half one hour.
*/
private int TEST_DURATION_IN_MILLISECONDS = 30 * 60 * 1000;
private int INTERVALE_TO_CHECK = 5 * 60 * 1000;
@@ -81,7 +81,8 @@ public class ResourceUsageTest extends ActivityInstrumentationTestCase2<TrackLis
new AlertDialog.Builder(EndToEndTestUtils.SOLO.getCurrentActivity())
.setTitle("Confirm long time test.")
.setMessage(
"Each case need run " + TEST_DURATION_IN_MILLISECONDS / 1000 / 60
"Please disconnect the power cord of your device and click 'Start' button. Each case need run "
+ TEST_DURATION_IN_MILLISECONDS / 1000 / 60
+ " minutes, and the battery/memory usage will be recorded in every "
+ INTERVALE_TO_CHECK / 60 / 1000 + "minutes.")
.setPositiveButton("Start Test", new DialogInterface.OnClickListener() {
@@ -124,6 +124,22 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
}
EndToEndTestUtils.stopRecording(true);
}
/**
* Records a long track.
*/
public void testRecordLongTrack() {
if (!runTest) {
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
return;
}
EndToEndTestUtils.startRecording();
int gpsNumber = 5000;
for (int i = 0; i < gpsNumber / 10; i++) {
EndToEndTestUtils.sendGps(10, i * 10);
}
EndToEndTestUtils.stopRecording(true);
}
/**
* Switches view between MAP, CHART and STAT. And create way points, pause and