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;
|
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.os.Bundle;
|
||||||
import android.test.InstrumentationTestRunner;
|
import android.test.InstrumentationTestRunner;
|
||||||
@@ -45,22 +45,22 @@ public class EndToEndTestRunner extends InstrumentationTestRunner {
|
|||||||
|
|
||||||
String isStressTest = arguments.getString("stress");
|
String isStressTest = arguments.getString("stress");
|
||||||
if (isStressTest != null && isStressTest.equalsIgnoreCase("true")) {
|
if (isStressTest != null && isStressTest.equalsIgnoreCase("true")) {
|
||||||
SecondaryTestUtils.runStressTest = true;
|
BigTestUtils.runStressTest = true;
|
||||||
} else {
|
} else {
|
||||||
SecondaryTestUtils.runStressTest = false;
|
BigTestUtils.runStressTest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String isSensorTest = arguments.getString("sensor");
|
String isSensorTest = arguments.getString("sensor");
|
||||||
if (isSensorTest != null && isSensorTest.equalsIgnoreCase("true")) {
|
if (isSensorTest != null && isSensorTest.equalsIgnoreCase("true")) {
|
||||||
SecondaryTestUtils.runSensorTest = true;
|
BigTestUtils.runSensorTest = true;
|
||||||
} else {
|
} else {
|
||||||
SecondaryTestUtils.runSensorTest = false;
|
BigTestUtils.runSensorTest = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.d(EndToEndTestUtils.LOG_TAG, "Use port number when run test on emulator:"
|
Log.d(EndToEndTestUtils.LOG_TAG, "Use port number when run test on emulator:"
|
||||||
+ EndToEndTestUtils.emulatorPort);
|
+ EndToEndTestUtils.emulatorPort);
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, "Run stress test:" + SecondaryTestUtils.runStressTest);
|
Log.i(EndToEndTestUtils.LOG_TAG, "Run stress test:" + BigTestUtils.runStressTest);
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, "Run sensor test:" + SecondaryTestUtils.runSensorTest);
|
Log.i(EndToEndTestUtils.LOG_TAG, "Run sensor test:" + BigTestUtils.runSensorTest);
|
||||||
|
|
||||||
super.onCreate(arguments);
|
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
|
* @param markerNumber of number of previous markers
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package com.google.android.apps.mytracks.endtoendtest.others;
|
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
|
* 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
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
runTest = SecondaryTestUtils.runSensorTest;
|
runTest = BigTestUtils.runSensorTest;
|
||||||
super.setUp();
|
super.setUp();
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
return;
|
return;
|
||||||
@@ -62,7 +62,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testConnectZephyrBluetoothSensor_notRecording() {
|
public void testConnectZephyrBluetoothSensor_notRecording() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bluetoothSensorTest(R.string.settings_sensor_type_zephyr, ZEPHYR_NAME, false);
|
bluetoothSensorTest(R.string.settings_sensor_type_zephyr, ZEPHYR_NAME, false);
|
||||||
@@ -74,7 +74,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testConnectZephyrBluetoothSensor_underRecording() {
|
public void testConnectZephyrBluetoothSensor_underRecording() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bluetoothSensorTest(R.string.settings_sensor_type_zephyr, ZEPHYR_NAME, true);
|
bluetoothSensorTest(R.string.settings_sensor_type_zephyr, ZEPHYR_NAME, true);
|
||||||
@@ -86,7 +86,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testConnectPolarBluetoothSensor_notRecording() {
|
public void testConnectPolarBluetoothSensor_notRecording() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bluetoothSensorTest(R.string.settings_sensor_type_polar, POLAR_NAME, false);
|
bluetoothSensorTest(R.string.settings_sensor_type_polar, POLAR_NAME, false);
|
||||||
@@ -98,7 +98,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testConnectPolarBluetoothSensor_underRecording() {
|
public void testConnectPolarBluetoothSensor_underRecording() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bluetoothSensorTest(R.string.settings_sensor_type_polar, POLAR_NAME, true);
|
bluetoothSensorTest(R.string.settings_sensor_type_polar, POLAR_NAME, true);
|
||||||
@@ -153,7 +153,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testConnectANTSensor_Cadence() {
|
public void testConnectANTSensor_Cadence() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
useANTSeonsor();
|
useANTSeonsor();
|
||||||
@@ -166,7 +166,7 @@ public class SensorTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testConnectTwoANTSensors() {
|
public void testConnectTwoANTSensors() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
useANTSeonsor();
|
useANTSeonsor();
|
||||||
|
|||||||
+10
-7
@@ -46,7 +46,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
runTest = SecondaryTestUtils.runStressTest;
|
runTest = BigTestUtils.runStressTest;
|
||||||
super.setUp();
|
super.setUp();
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
return;
|
return;
|
||||||
@@ -64,7 +64,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testRecordAndDeleteTracks() {
|
public void testRecordAndDeleteTracks() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; (System.currentTimeMillis() - startTime) < TEST_DURATION_IN_MILLISECONDS; i++) {
|
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() {
|
public void testRotateMapViewInTrackDetailActivity() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EndToEndTestUtils.startRecording();
|
EndToEndTestUtils.startRecording();
|
||||||
@@ -103,7 +103,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
*/
|
*/
|
||||||
public void testSwitchTabs() {
|
public void testSwitchTabs() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EndToEndTestUtils.startRecording();
|
EndToEndTestUtils.startRecording();
|
||||||
@@ -120,14 +120,16 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
logStatus(++i);
|
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() {
|
public void testSwitchTabs_wayPoints() {
|
||||||
if (!runTest) {
|
if (!runTest) {
|
||||||
Log.i(EndToEndTestUtils.LOG_TAG, SecondaryTestUtils.DISABLE_MESSAGE);
|
Log.i(EndToEndTestUtils.LOG_TAG, BigTestUtils.DISABLE_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EndToEndTestUtils.startRecording();
|
EndToEndTestUtils.startRecording();
|
||||||
@@ -151,6 +153,7 @@ public class StressTest extends ActivityInstrumentationTestCase2<TrackListActivi
|
|||||||
EndToEndTestUtils.resumeRecording();
|
EndToEndTestUtils.resumeRecording();
|
||||||
logStatus(++i);
|
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
|
* @param times the number of times this test has been run
|
||||||
*/
|
*/
|
||||||
private void logStatus(int times) {
|
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(
|
Log.i(EndToEndTestUtils.LOG_TAG, String.format(
|
||||||
"This test has run %d times and will be finished in %d minutes!", times, minutes));
|
"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));
|
Log.i(EndToEndTestUtils.LOG_TAG, String.format("There are %d tracks!", numberOfTracks));
|
||||||
|
|||||||
Reference in New Issue
Block a user