summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Stewart <pstew@google.com>2016-06-06 22:02:03 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-06 22:02:03 +0000
commit9fd75a2bc60145082c83664a4dbdd36a8f34c3e2 (patch)
tree6dd819a3a6b8ed4cda8afb332ae4f12ab820042e /tests
parentceac8162fc6874b2d7bb17ea42cc3c005a6ca721 (diff)
parent4f088ed037dc1ae22fb1a0dd5c88a25965167a90 (diff)
Merge "WCM: Periodic scan interval policy adjustment" into nyc-dev am: 2d7797eae8
am: 4f088ed037 * commit '4f088ed037dc1ae22fb1a0dd5c88a25965167a90': WCM: Periodic scan interval policy adjustment Change-Id: Ifb46e190264b2916c297326fa0b9e58a79f76dd8
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java41
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 aa48cadf5..2434c2db7 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java
@@ -695,6 +695,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.elapsedRealtime()).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.elapsedRealtime()).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.elapsedRealtime()).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.
*