diff options
author | Roshan Pius <rpius@google.com> | 2018-04-24 16:08:33 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2018-04-30 14:17:23 -0700 |
commit | 80512c6070e4c2c84a2d7c58ad56d4f1ca3258ed (patch) | |
tree | 2a73bda0bfa07e1f79570f8d72ef67bf94fb4995 /tests | |
parent | f5749a73fe63a3e01db62a9752be365fb40ec633 (diff) |
WifiNative: Handle radio mode change callbacks
These currently invokes the corresponding metrics stub calls.
Note: The metrics stubs will be replaced in the next CL.
Bug: 69117051
Test: Unit tests
Change-Id: Ideb63bc8fc519898578f158894513a8f8d56e929
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, |