diff options
author | Ahmed ElArabawy <arabawy@google.com> | 2019-11-20 17:44:17 -0800 |
---|---|---|
committer | Ahmed ElArabawy <arabawy@google.com> | 2019-11-22 23:37:31 +0000 |
commit | ca845b488900d7d8ddc2fac7b4e61185e69f3649 (patch) | |
tree | afa8dbfa818c172df2c96403cf3fd7e4c8bfd70c /tests | |
parent | 890b3372d493c5f19101c163faaa54ef73282857 (diff) |
Allow scan hidden networks during scan-only mode
In current implementation, hidden networks were not scanned
during scan only mode.
This commit add an option to include them in the scan, with default
similar to existing behavior.
Bug: 143588535
Test: atest com.android.wifi.server
Change-Id: I9bb4ecbe232f222b331f3c031cd803109beb7860
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java b/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java index 4ec6b8575..e681534ca 100644 --- a/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ActiveModeWardenTest.java @@ -141,6 +141,8 @@ public class ActiveModeWardenTest extends WifiBaseTest { .thenReturn("AndroidShare"); when(mResources.getInteger(R.integer.config_wifi_framework_recovery_timeout_delay)) .thenReturn(TEST_WIFI_RECOVERY_DELAY_MS); + when(mResources.getBoolean(R.bool.config_wifiScanHiddenNetworksScanOnlyMode)) + .thenReturn(false); when(mSettingsStore.isWifiToggleEnabled()).thenReturn(false); when(mSettingsStore.isAirplaneModeOn()).thenReturn(false); @@ -449,6 +451,33 @@ public class ActiveModeWardenTest extends WifiBaseTest { } /** + * Test that ActiveModeWarden enables hidden network scanning in scan-only-mode + * if configured to do. + */ + @Test + public void testScanOnlyModeScanHiddenNetworks() throws Exception { + when(mResources.getBoolean(R.bool.config_wifiScanHiddenNetworksScanOnlyMode)) + .thenReturn(true); + + mActiveModeWarden = createActiveModeWarden(); + mActiveModeWarden.start(); + mLooper.dispatchAll(); + + when(mClientModeManager.getRole()).thenReturn(ROLE_CLIENT_SCAN_ONLY); + when(mSettingsStore.isScanAlwaysAvailable()).thenReturn(true); + when(mSettingsStore.isWifiToggleEnabled()).thenReturn(false); + mActiveModeWarden.wifiToggled(); + mLooper.dispatchAll(); + mClientListener.onStarted(); + mLooper.dispatchAll(); + + assertInEnabledState(); + verify(mClientModeManager).start(); + verify(mClientModeManager).setRole(ROLE_CLIENT_SCAN_ONLY); + verify(mScanRequestProxy).enableScanning(true, true); + } + + /** * Test that ActiveModeWarden properly starts the SoftApManager from the * DisabledState state. */ |