diff options
author | Paul Stewart <pstew@google.com> | 2016-06-06 17:16:57 -0700 |
---|---|---|
committer | Paul Stewart <pstew@google.com> | 2016-06-06 19:19:27 -0700 |
commit | 5967a15d36c76ba1aaeb89ce8bd66bb4bccfe998 (patch) | |
tree | 89f7d3f5de94df572e0fdfde223f925eae32dc61 /tests | |
parent | 154ddd645abbef3b58425184c5057867048a42d2 (diff) | |
parent | 9fd75a2bc60145082c83664a4dbdd36a8f34c3e2 (diff) |
resolve merge conflicts of 9fd75a2 to master
Change-Id: I5ac96f6035e3412e0dedba3a4869e9568047752d
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java index 8d9a7a764..42135e909 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java @@ -697,6 +697,47 @@ public class WifiConnectivityManagerTest { } /** + * When screen on trigger a connection state change event and a forced connectivity + * scan event back to back to verify that the minimum scan interval is not applied + * in this scenario. + * + * Expected behavior: WifiConnectivityManager starts the second periodic single + * scan immediately. + */ + @Test + public void checkMinimumPeriodicScanIntervalNotEnforced() { + long currentTimeStamp = CURRENT_SYSTEM_TIME_MS; + when(mClock.getElapsedSinceBootMillis()).thenReturn(currentTimeStamp); + + // Set screen to ON + mWifiConnectivityManager.handleScreenStateChanged(true); + + // Wait for MAX_PERIODIC_SCAN_INTERVAL_MS so that any impact triggered + // by screen state change can settle + currentTimeStamp += WifiConnectivityManager.MAX_PERIODIC_SCAN_INTERVAL_MS; + long firstScanTimeStamp = currentTimeStamp; + when(mClock.getElapsedSinceBootMillis()).thenReturn(currentTimeStamp); + + // Set WiFi to connected state to trigger the periodic scan + mWifiConnectivityManager.handleConnectionStateChanged( + WifiConnectivityManager.WIFI_STATE_CONNECTED); + + // Set the second scan attempt time stamp + currentTimeStamp += 2000; + when(mClock.getElapsedSinceBootMillis()).thenReturn(currentTimeStamp); + + // Force a connectivity scan + mWifiConnectivityManager.forceConnectivityScan(); + + // Get the second periodic scan actual time stamp. Note, this scan is not + // started from the AlarmManager. + long secondScanTimeStamp = mWifiConnectivityManager.getLastPeriodicSingleScanTimeStamp(); + + // Verify that the second scan is fired immediately + assertEquals(secondScanTimeStamp, currentTimeStamp); + } + + /** * Verify that we perform full band scan when the currently connected network's tx/rx success * rate is low. * |