forked from upstream-mirrors/OpenTracks
Change code style.
This commit is contained in:
+7
-7
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.endtoendtest;
|
||||
|
||||
import com.google.android.apps.mytracks.endtoendtest.others.SecondaryTestUtils;
|
||||
import com.google.android.apps.mytracks.endtoendtest.others.BigTestUtils;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.test.InstrumentationTestRunner;
|
||||
@@ -45,22 +45,22 @@ public class EndToEndTestRunner extends InstrumentationTestRunner {
|
||||
|
||||
String isStressTest = arguments.getString("stress");
|
||||
if (isStressTest != null && isStressTest.equalsIgnoreCase("true")) {
|
||||
SecondaryTestUtils.runStressTest = true;
|
||||
BigTestUtils.runStressTest = true;
|
||||
} else {
|
||||
SecondaryTestUtils.runStressTest = false;
|
||||
BigTestUtils.runStressTest = false;
|
||||
}
|
||||
|
||||
String isSensorTest = arguments.getString("sensor");
|
||||
if (isSensorTest != null && isSensorTest.equalsIgnoreCase("true")) {
|
||||
SecondaryTestUtils.runSensorTest = true;
|
||||
BigTestUtils.runSensorTest = true;
|
||||
} else {
|
||||
SecondaryTestUtils.runSensorTest = false;
|
||||
BigTestUtils.runSensorTest = false;
|
||||
}
|
||||
|
||||
Log.d(EndToEndTestUtils.LOG_TAG, "Use port number when run test on emulator:"
|
||||
+ EndToEndTestUtils.emulatorPort);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, "Run stress test:" + SecondaryTestUtils.runStressTest);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, "Run sensor test:" + SecondaryTestUtils.runSensorTest);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, "Run stress test:" + BigTestUtils.runStressTest);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, "Run sensor test:" + BigTestUtils.runSensorTest);
|
||||
|
||||
super.onCreate(arguments);
|
||||
}
|
||||
|
||||
+1
-1
@@ -942,7 +942,7 @@ public class EndToEndTestUtils {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a way point and a split maker during track recording.
|
||||
* Creates a way point during track recording.
|
||||
*
|
||||
* @param markerNumber of number of previous markers
|
||||
*/
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.google.android.apps.mytracks.endtoendtest.others;
|
||||
|
||||
public class SecondaryTestUtils {
|
||||
public class BigTestUtils {
|
||||
|
||||
/**
|
||||
* Set to false as default. True to run the test. Default to false since this
|
||||
+7
-7
@@ -46,7 +46,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
runTest = SecondaryTestUtils.runSensorTest;
|
||||
runTest = BigTestUtils.runSensorTest;
|
||||
super.setUp();
|
||||
if (!runTest) {
|
||||
return;
|
||||
@@ -62,7 +62,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testConnectZephyrBluetoothSensor_notRecording() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
bluetoothSensorTest(R.string.settings_sensor_type_zephyr, ZEPHYR_NAME, false);
|
||||
@@ -74,7 +74,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testConnectZephyrBluetoothSensor_underRecording() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
bluetoothSensorTest(R.string.settings_sensor_type_zephyr, ZEPHYR_NAME, true);
|
||||
@@ -86,7 +86,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testConnectPolarBluetoothSensor_notRecording() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
bluetoothSensorTest(R.string.settings_sensor_type_polar, POLAR_NAME, false);
|
||||
@@ -98,7 +98,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testConnectPolarBluetoothSensor_underRecording() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
bluetoothSensorTest(R.string.settings_sensor_type_polar, POLAR_NAME, true);
|
||||
@@ -153,7 +153,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testConnectANTSensor_Cadence() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
useANTSeonsor();
|
||||
@@ -166,7 +166,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testConnectTwoANTSensors() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
useANTSeonsor();
|
||||
|
||||
+11
-8
@@ -46,7 +46,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
runTest = SecondaryTestUtils.runStressTest;
|
||||
runTest = BigTestUtils.runStressTest;
|
||||
super.setUp();
|
||||
if (!runTest) {
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testRecordAndDeleteTracks() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; (System.currentTimeMillis() - startTime) < TEST_DURATION_IN_MILLISECONDS; i++) {
|
||||
@@ -88,7 +88,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testRotateMapViewInTrackDetailActivity() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
EndToEndTestUtils.startRecording();
|
||||
@@ -103,7 +103,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
*/
|
||||
public void testSwitchTabs() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
EndToEndTestUtils.startRecording();
|
||||
@@ -120,14 +120,16 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
instrumentation.waitForIdleSync();
|
||||
logStatus(++i);
|
||||
}
|
||||
EndToEndTestUtils.stopRecording(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switches view between MAP, CHART and STAT.
|
||||
* Switches view between MAP, CHART and STAT. And create way points, pause and
|
||||
* resume the track during recording.
|
||||
*/
|
||||
public void testSwitchTabs_wayPoints() {
|
||||
if (!runTest) {
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||
return;
|
||||
}
|
||||
EndToEndTestUtils.startRecording();
|
||||
@@ -138,7 +140,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
EndToEndTestUtils.sendGps(10, 10 * i);
|
||||
EndToEndTestUtils.createWaypoint(i);
|
||||
EndToEndTestUtils.pauseRecording();
|
||||
|
||||
|
||||
EndToEndTestUtils.SOLO
|
||||
.clickOnText(trackListActivity.getString(R.string.track_detail_map_tab));
|
||||
instrumentation.waitForIdleSync();
|
||||
@@ -151,6 +153,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
EndToEndTestUtils.resumeRecording();
|
||||
logStatus(++i);
|
||||
}
|
||||
EndToEndTestUtils.stopRecording(true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,7 +162,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
||||
* @param times the number of times this test has been run
|
||||
*/
|
||||
private void logStatus(int times) {
|
||||
int minutes = (int)(TEST_DURATION_IN_MILLISECONDS - (System.currentTimeMillis() - startTime)) / 60 / 1000;
|
||||
int minutes = (int) (TEST_DURATION_IN_MILLISECONDS - (System.currentTimeMillis() - startTime)) / 60 / 1000;
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, String.format(
|
||||
"This test has run %d times and will be finished in %d minutes!", times, minutes));
|
||||
Log.i(EndToEndTestUtils.LOG_TAG, String.format("There are %d tracks!", numberOfTracks));
|
||||
|
||||
Reference in New Issue
Block a user