Skip to content

Commit 10a3e8f

Browse files
author
Xia Wang
committed
Add extra 2 minute for wifi to shutdown
Change-Id: I3cf2fbf5de8b96b75d5e460e4ad822a1947ff6e7
1 parent 0516061 commit 10a3e8f

File tree

1 file changed

+8
-6
lines changed
  • core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress

1 file changed

+8
-6
lines changed

core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ public class WifiStressTest
6363
private final static long WIFI_IDLE_MS = 60 * 1000;
6464

6565
/**
66-
* The delay for Wi-Fi to get into idle, after screen off + WIFI_IDEL_MS + WIFI_IDLE_DELAY
67-
* the Wi-Fi should be in idle mode and device should be in cellular mode.
66+
* Delay after issuing wifi shutdown.
67+
* The framework keep driver up for at leat 2 minutes to avoid problems
68+
* that a quick shutdown could cause on wext driver and protentially
69+
* on cfg based driver
6870
*/
69-
private final static long WIFI_IDLE_DELAY = 3 * 1000;
71+
private final static long WIFI_SHUTDOWN_DELAY = 2 * 60 * 1000;
7072

7173
private final static String OUTPUT_FILE = "WifiStressTestOutput.txt";
7274
private ConnectivityManagerTestActivity mAct;
@@ -265,17 +267,17 @@ public void testWifiReconnectionAfterSleep() {
265267
PowerManager pm =
266268
(PowerManager)mRunner.getContext().getSystemService(Context.POWER_SERVICE);
267269
assertFalse(pm.isScreenOn());
268-
sleep(WIFI_IDLE_MS, "Interruped while wait for wifi to be idle");
270+
sleep(WIFI_IDLE_MS + WIFI_SHUTDOWN_DELAY, "Interruped while wait for wifi to be idle");
269271
assertTrue("Wait for Wi-Fi to idle timeout",
270272
mAct.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
271273
6 * ConnectivityManagerTestActivity.SHORT_TIMEOUT));
272274
if (!UtilHelper.isWifiOnly()) {
273275
// use long timeout as the pppd startup may take several retries.
274276
assertTrue("Wait for cellular connection timeout",
275277
mAct.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
276-
ConnectivityManagerTestActivity.LONG_TIMEOUT));
278+
2 * ConnectivityManagerTestActivity.LONG_TIMEOUT));
277279
}
278-
sleep(mWifiSleepTime + WIFI_IDLE_DELAY, "Interrupted while device is in sleep mode");
280+
sleep(mWifiSleepTime, "Interrupted while device is in sleep mode");
279281
// Verify the wi-fi is still off and data connection is on
280282
assertEquals("Wi-Fi is reconnected", State.DISCONNECTED,
281283
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState());

0 commit comments

Comments
 (0)