summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-08-23 14:48:27 -0700
committerRoshan Pius <rpius@google.com>2019-08-28 07:14:47 -0700
commit4a3847085aa7b93ad53556c16a84afbebc23f7a6 (patch)
tree1b176b3aa63399cbcef8bdc0b549f21649010ac0 /tests
parent54584c1dc32464af1676d4a26fccacbda5af12c3 (diff)
WifiNative: Allow in-place switch from connectivity to scan only mode
This allows an in-place modification of the client interface type. This helps to get rid of the ScanOnlyModeManager. Also, stop requesting low priority STA iface from HalDeviceManager for ScanOnly mode. Bug: 139939529 Test: atest com.android.server.wifi.WifiNativeInterfaceManagementTest Test: Manual verification by hacking ScanOnlyModeManager & ClientModeManager to use the new transition API. Change-Id: I3b8ce63442a46f0f9927af238a1ac722fa13b2a5
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java58
1 files changed, 57 insertions, 1 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java
index c7a66e31a..a14c72acd 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java
@@ -1277,6 +1277,62 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWifiMetrics).incrementNumRadioModeChangeToDbs();
}
+ /**
+ * Verifies the switch of existing client interface in connectivity mode to scan mode.
+ */
+ @Test
+ public void testSwitchClientInterfaceToScanMode() throws Exception {
+ executeAndValidateSetupClientInterface(
+ false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0,
+ mNetworkObserverCaptor0);
+ assertTrue(mWifiNative.switchClientInterfaceToScanMode(IFACE_NAME_0));
+
+ mInOrder.verify(mSupplicantStaIfaceHal).teardownIface(IFACE_NAME_0);
+ mInOrder.verify(mSupplicantStaIfaceHal).deregisterDeathHandler();
+ mInOrder.verify(mSupplicantStaIfaceHal).terminate();
+ }
+
+ /**
+ * Verifies that a switch to scan mode when already in scan mode is rejected.
+ */
+ @Test
+ public void testSwitchClientInterfaceToScanModeFailsWhenAlreadyInScanMode() throws Exception {
+ executeAndValidateSetupClientInterfaceForScan(
+ false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0,
+ mNetworkObserverCaptor0);
+ assertTrue(mWifiNative.switchClientInterfaceToScanMode(IFACE_NAME_0));
+ }
+
+ /**
+ * Verifies the switch of existing client interface in scan mode to connectivity mode.
+ */
+ @Test
+ public void testSwitchClientInterfaceToConnectivityMode() throws Exception {
+ executeAndValidateSetupClientInterfaceForScan(
+ false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0,
+ mNetworkObserverCaptor0);
+ assertTrue(mWifiNative.switchClientInterfaceToConnectivityMode(IFACE_NAME_0));
+
+ mInOrder.verify(mSupplicantStaIfaceHal).isInitializationStarted();
+ mInOrder.verify(mSupplicantStaIfaceHal).initialize();
+ mInOrder.verify(mSupplicantStaIfaceHal).startDaemon();
+ mInOrder.verify(mSupplicantStaIfaceHal).isInitializationComplete();
+ mInOrder.verify(mSupplicantStaIfaceHal).registerDeathHandler(any());
+ mInOrder.verify(mSupplicantStaIfaceHal).setupIface(IFACE_NAME_0);
+ }
+
+ /**
+ * Verifies that a switch to connectivity mode when already in connectivity mode is rejected.
+ */
+ @Test
+ public void testSwitchClientInterfaceToConnectivityModeFailsWhenAlreadyInConnectivityMode()
+ throws Exception {
+ executeAndValidateSetupClientInterface(
+ false, false, IFACE_NAME_0, mIfaceCallback0, mIfaceDestroyedListenerCaptor0,
+ mNetworkObserverCaptor0);
+ assertTrue(mWifiNative.switchClientInterfaceToConnectivityMode(IFACE_NAME_0));
+ }
+
private void executeAndValidateSetupClientInterface(
boolean existingStaIface, boolean existingApIface,
String ifaceName, @Mock WifiNative.InterfaceCallback callback,
@@ -1382,7 +1438,7 @@ public class WifiNativeInterfaceManagementTest {
mInOrder.verify(mWifiVendorHal).startVendorHal();
}
mInOrder.verify(mWifiVendorHal).isVendorHalSupported();
- mInOrder.verify(mWifiVendorHal).createStaIface(eq(true),
+ mInOrder.verify(mWifiVendorHal).createStaIface(eq(false),
destroyedListenerCaptor.capture());
mInOrder.verify(mWificondControl).setupInterfaceForClientMode(ifaceName);
mInOrder.verify(mNwManagementService).registerObserver(networkObserverCaptor.capture());