Merge "Add WifiStressTest to Wi-Fi only test suite." into honeycomb
This commit is contained in:
@ -49,13 +49,8 @@ public class ConnectivityManagerStressTestRunner extends InstrumentationTestRunn
|
||||
suite.addTestSuite(WifiApStress.class);
|
||||
suite.addTestSuite(WifiStressTest.class);
|
||||
} else {
|
||||
// create a new test suite
|
||||
suite.setName("WifiOnlyStressTests");
|
||||
String[] methodNames = {"testWifiScanning"};
|
||||
Class<WifiStressTest> testClass = WifiStressTest.class;
|
||||
for (String method: methodNames) {
|
||||
suite.addTest(TestSuite.createTest(testClass, method));
|
||||
}
|
||||
// only the wifi stress tests
|
||||
suite.addTestSuite(WifiStressTest.class);
|
||||
}
|
||||
return suite;
|
||||
}
|
||||
@ -68,11 +63,13 @@ public class ConnectivityManagerStressTestRunner extends InstrumentationTestRunn
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
String valueStr = (String) icicle.get("softap_iterations");
|
||||
if (valueStr != null) {
|
||||
int iteration = Integer.parseInt(valueStr);
|
||||
if (iteration > 0) {
|
||||
mSoftapIterations = iteration;
|
||||
if (!UtilHelper.isWifiOnly()) {
|
||||
String valueStr = (String) icicle.get("softap_iterations");
|
||||
if (valueStr != null) {
|
||||
int iteration = Integer.parseInt(valueStr);
|
||||
if (iteration > 0) {
|
||||
mSoftapIterations = iteration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@ package com.android.connectivitymanagertest.stress;
|
||||
|
||||
import com.android.connectivitymanagertest.ConnectivityManagerStressTestRunner;
|
||||
import com.android.connectivitymanagertest.ConnectivityManagerTestActivity;
|
||||
import com.android.connectivitymanagertest.UtilHelper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
@ -261,16 +262,20 @@ public class WifiStressTest
|
||||
assertTrue("Wait for Wi-Fi to idle timeout",
|
||||
mAct.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
|
||||
6 * ConnectivityManagerTestActivity.SHORT_TIMEOUT));
|
||||
// use long timeout as the pppd startup may take several retries.
|
||||
assertTrue("Wait for cellular connection timeout",
|
||||
mAct.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
|
||||
ConnectivityManagerTestActivity.LONG_TIMEOUT));
|
||||
if (!UtilHelper.isWifiOnly()) {
|
||||
// use long timeout as the pppd startup may take several retries.
|
||||
assertTrue("Wait for cellular connection timeout",
|
||||
mAct.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
|
||||
ConnectivityManagerTestActivity.LONG_TIMEOUT));
|
||||
}
|
||||
sleep(mWifiSleepTime + WIFI_IDLE_DELAY, "Interrupted while device is in sleep mode");
|
||||
// Verify the wi-fi is still off and data connection is on
|
||||
assertEquals("Wi-Fi is reconnected", State.DISCONNECTED,
|
||||
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState());
|
||||
assertEquals("Cellular connection is down", State.CONNECTED,
|
||||
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState());
|
||||
if (!UtilHelper.isWifiOnly()) {
|
||||
assertEquals("Cellular connection is down", State.CONNECTED,
|
||||
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState());
|
||||
}
|
||||
// Turn screen on again
|
||||
mAct.turnScreenOn();
|
||||
assertTrue("Wait for Wi-Fi enable timeout after wake up",
|
||||
|
Reference in New Issue
Block a user