Skip to content

Commit 776cca3

Browse files
author
Xia Wang
committed
Allow CM/WIFI tests running with wifi-only flag.
Change-Id: I12ab8f6f0335574a5af6db497ed76e6d5fec3ab7
1 parent 21b4d6b commit 776cca3

File tree

6 files changed

+91
-120
lines changed

6 files changed

+91
-120
lines changed

core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,13 @@ public class ConnectivityManagerStressTestRunner extends InstrumentationTestRunn
4242
public int mSleepTime = 2 * 60 * 1000;
4343
public String mReconnectSsid = "securenetdhcp";
4444
public String mReconnectPassword = "androidwifi";
45+
public boolean mWifiOnlyFlag = false;
4546

4647
@Override
4748
public TestSuite getAllTests() {
4849
TestSuite suite = new InstrumentationTestSuite(this);
49-
if (!UtilHelper.isWifiOnly(getContext())) {
50-
suite.addTestSuite(WifiApStress.class);
51-
suite.addTestSuite(WifiStressTest.class);
52-
} else {
53-
// only the wifi stress tests
54-
suite.addTestSuite(WifiStressTest.class);
55-
}
50+
suite.addTestSuite(WifiApStress.class);
51+
suite.addTestSuite(WifiStressTest.class);
5652
return suite;
5753
}
5854

@@ -64,13 +60,11 @@ public ClassLoader getLoader() {
6460
@Override
6561
public void onCreate(Bundle icicle) {
6662
super.onCreate(icicle);
67-
if (!UtilHelper.isWifiOnly(getContext())) {
68-
String valueStr = (String) icicle.get("softap_iterations");
69-
if (valueStr != null) {
70-
int iteration = Integer.parseInt(valueStr);
71-
if (iteration > 0) {
72-
mSoftapIterations = iteration;
73-
}
63+
String valueStr = (String) icicle.get("softap_iterations");
64+
if (valueStr != null) {
65+
int iteration = Integer.parseInt(valueStr);
66+
if (iteration > 0) {
67+
mSoftapIterations = iteration;
7468
}
7569
}
7670

@@ -107,5 +101,10 @@ public void onCreate(Bundle icicle) {
107101
mSleepTime = 1000 * sleepTime;
108102
}
109103
}
104+
105+
String wifiOnlyFlag = (String) icicle.get("wifi-only");
106+
if (wifiOnlyFlag != null) {
107+
mWifiOnlyFlag = true;
108+
}
110109
}
111110
}

core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,13 @@
3535
*/
3636

3737
public class ConnectivityManagerTestRunner extends InstrumentationTestRunner {
38-
public String TEST_SSID = null;
38+
public boolean mWifiOnlyFlag = false;
39+
public String mTestSsid = null;
3940

4041
@Override
4142
public TestSuite getAllTests() {
4243
TestSuite suite = new InstrumentationTestSuite(this);
43-
if (!UtilHelper.isWifiOnly(getContext())) {
44-
suite.addTestSuite(ConnectivityManagerMobileTest.class);
45-
} else {
46-
// create a new test suite
47-
suite.setName("ConnectivityManagerWifiOnlyFunctionalTests");
48-
String[] methodNames = {"testConnectToWifi", "testConnectToWifWithKnownAP",
49-
"testDisconnectWifi", "testWifiStateChange"};
50-
Class<ConnectivityManagerMobileTest> testClass = ConnectivityManagerMobileTest.class;
51-
for (String method: methodNames) {
52-
suite.addTest(TestSuite.createTest(testClass, method));
53-
}
54-
}
44+
suite.addTestSuite(ConnectivityManagerMobileTest.class);
5545
suite.addTestSuite(WifiConnectionTest.class);
5646
return suite;
5747
}
@@ -66,7 +56,11 @@ public void onCreate(Bundle icicle) {
6656
super.onCreate(icicle);
6757
String testSSID = (String) icicle.get("ssid");
6858
if (testSSID != null) {
69-
TEST_SSID = testSSID;
59+
mTestSsid = testSSID;
60+
}
61+
String wifiOnlyFlag = (String) icicle.get("wifi-only");
62+
if (wifiOnlyFlag != null) {
63+
mWifiOnlyFlag = true;
7064
}
7165
}
7266
}

core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)