diff options
author | Roshan Pius <rpius@google.com> | 2018-05-07 10:00:58 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-05-07 10:00:58 -0700 |
commit | 295227bcd260e615fd83e6f0bbabd5ac3b00685d (patch) | |
tree | 347339509e3bc1f50895036fac13f92dc9552024 /tests | |
parent | 775a6a720599afc92a118356c6953e2ddbb6c442 (diff) | |
parent | 80512c6070e4c2c84a2d7c58ad56d4f1ca3258ed (diff) |
WifiNative: Handle radio mode change callbacks
am: 80512c6070
Change-Id: I5c355c4a45b6dd6f2d6f7d2a30f6d27cdc80d529
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java index 13147ea4d..12ef6eccc 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeInterfaceManagementTest.java @@ -25,6 +25,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.inOrder; @@ -39,6 +40,7 @@ import android.net.InterfaceConfiguration; import android.net.wifi.IApInterface; import android.net.wifi.IClientInterface; import android.net.wifi.WifiConfiguration; +import android.net.wifi.WifiScanner; import android.os.INetworkManagementService; import android.os.RemoteException; import android.support.test.filters.SmallTest; @@ -84,6 +86,9 @@ public class WifiNativeInterfaceManagementTest { ArgumentCaptor.forClass(VendorHalDeathEventHandler.class); private ArgumentCaptor<WificondDeathEventHandler> mWificondDeathHandlerCaptor = ArgumentCaptor.forClass(WificondDeathEventHandler.class); + private ArgumentCaptor<WifiNative.VendorHalRadioModeChangeEventHandler> + mWifiVendorHalRadioModeChangeHandlerCaptor = + ArgumentCaptor.forClass(WifiNative.VendorHalRadioModeChangeEventHandler.class); private ArgumentCaptor<SupplicantDeathEventHandler> mSupplicantDeathHandlerCaptor = ArgumentCaptor.forClass(SupplicantDeathEventHandler.class); private ArgumentCaptor<WifiNative.HostapdDeathEventHandler> mHostapdDeathHandlerCaptor = @@ -107,6 +112,8 @@ public class WifiNativeInterfaceManagementTest { // mocks for negative or multi-interface tests. when(mWifiVendorHal.initialize(mWifiVendorHalDeathHandlerCaptor.capture())) .thenReturn(true); + doNothing().when(mWifiVendorHal).registerRadioModeChangeHandler( + mWifiVendorHalRadioModeChangeHandlerCaptor.capture()); when(mWifiVendorHal.isVendorHalSupported()).thenReturn(true); when(mWifiVendorHal.startVendorHal()).thenReturn(true); when(mWifiVendorHal.createStaIface(anyBoolean(), any())).thenReturn(IFACE_NAME_0); @@ -160,6 +167,7 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mWifiVendorHal).initialize(any()); mInOrder.verify(mWificondControl).initialize(any()); + mInOrder.verify(mWifiVendorHal).registerRadioModeChangeHandler(any()); } @After @@ -1140,6 +1148,27 @@ public class WifiNativeInterfaceManagementTest { mInOrder.verify(mNwManagementService).disableIpv6(IFACE_NAME_0); } + /** + * Verifies the handling of radio mode change callbacks. + */ + @Test + public void testRadioModeChangeCallback() { + WifiNative.VendorHalRadioModeChangeEventHandler handler = + mWifiVendorHalRadioModeChangeHandlerCaptor.getValue(); + + handler.onMcc(WifiScanner.WIFI_BAND_5_GHZ); + mInOrder.verify(mWifiMetrics).incrementNumRadioModeChangeToMcc(); + + handler.onScc(WifiScanner.WIFI_BAND_24_GHZ); + mInOrder.verify(mWifiMetrics).incrementNumRadioModeChangeToScc(); + + handler.onSbs(WifiScanner.WIFI_BAND_24_GHZ); + mInOrder.verify(mWifiMetrics).incrementNumRadioModeChangeToSbs(); + + handler.onDbs(); + mInOrder.verify(mWifiMetrics).incrementNumRadioModeChangeToDbs(); + } + private void executeAndValidateSetupClientInterface( boolean existingStaIface, boolean existingApIface, String ifaceName, @Mock WifiNative.InterfaceCallback callback, |