diff options
author | Kai Shi <kaishi@google.com> | 2020-04-16 19:57:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-16 19:57:04 +0000 |
commit | 656f7b75dcb6c972378235683d5653d8fd086c89 (patch) | |
tree | 61b122d1d70fdda550d3e021e6484b2983f31ba1 /tests | |
parent | bfe73b182d85930ea04d0c2cdce2c73674fc3b6f (diff) | |
parent | 2693c3a8265476521c5dbb599cab444268769c5b (diff) |
Merge "Check internet status for pre-scan sufficiency check" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java | 21 |
1 files changed, 21 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 f03c5360d..be6ee2622 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConnectivityManagerTest.java @@ -1756,6 +1756,8 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { * Verify that we perform full band scan in the following two cases * 1) Current RSSI is low, no active stream, network is insufficient * 2) Current RSSI is high, no active stream, and a long time since last network selection + * 3) Current RSSI is high, no active stream, and a short time since last network selection, + * internet status is not acceptable * * Expected behavior: WifiConnectivityManager does full band scan in both cases */ @@ -1768,6 +1770,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(false); when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(false); when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(false); + when(mWifiNS.hasInternetOrExpectNoInternet(eq(mWifiInfo))).thenReturn(true); final List<Integer> channelList = new ArrayList<>(); channelList.add(TEST_FREQUENCY_1); @@ -1803,6 +1806,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(true); when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(false); when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(true); + when(mWifiNS.hasInternetOrExpectNoInternet(eq(mWifiInfo))).thenReturn(true); when(mClock.getElapsedSinceBootMillis()).thenReturn(600_000L + 1L); mWifiConnectivityManager.handleScreenStateChanged(true); // Set WiFi to connected state to trigger periodic scan @@ -1810,6 +1814,19 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { WifiConnectivityManager.WIFI_STATE_CONNECTED); verify(mWifiScanner, times(2)).startScan(anyObject(), anyObject(), anyObject(), anyObject()); + + // Verify case 3 + when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(false); + when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(false); + when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(true); + when(mWifiNS.hasInternetOrExpectNoInternet(eq(mWifiInfo))).thenReturn(false); + when(mClock.getElapsedSinceBootMillis()).thenReturn(0L); + mWifiConnectivityManager.handleScreenStateChanged(true); + // Set WiFi to connected state to trigger periodic scan + mWifiConnectivityManager.handleConnectionStateChanged( + WifiConnectivityManager.WIFI_STATE_CONNECTED); + verify(mWifiScanner, times(2)).startScan(anyObject(), anyObject(), anyObject(), + anyObject()); } /** @@ -1825,6 +1842,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(false); when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(true); when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(false); + when(mWifiNS.hasInternetOrExpectNoInternet(eq(mWifiInfo))).thenReturn(true); mResources.setInteger( R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels, @@ -1879,6 +1897,7 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(false); when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(false); when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(true); + when(mWifiNS.hasInternetOrExpectNoInternet(eq(mWifiInfo))).thenReturn(true); mResources.setInteger( R.integer.config_wifi_framework_associated_partial_scan_max_num_active_channels, @@ -1932,6 +1951,8 @@ public class WifiConnectivityManagerTest extends WifiBaseTest { public void checkSingleScanSettingsWhenConnectedWithHighDataRateNotInCache() { when(mWifiNS.isNetworkSufficient(eq(mWifiInfo))).thenReturn(true); when(mWifiNS.hasActiveStream(eq(mWifiInfo))).thenReturn(true); + when(mWifiNS.hasSufficientLinkQuality(eq(mWifiInfo))).thenReturn(true); + when(mWifiNS.hasInternetOrExpectNoInternet(eq(mWifiInfo))).thenReturn(true); final List<Integer> channelList = new ArrayList<>(); channelList.add(TEST_FREQUENCY_1); |