summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2019-11-21 12:47:11 -0800
committerAhmed ElArabawy <arabawy@google.com>2019-12-04 17:57:34 -0800
commit116127c874cbbfbb0d3c9a32e3aae2cd58d4514c (patch)
treecc1ca2ad943d111a6ae19918f64ab03dff833c47 /tests
parent78686d95d0e41c2ce7cc75f633b24cbacf78d86f (diff)
Upgrade WifiChipEventCallback to handle 6GHz band
This commit adds support for changes in WifiEventCallback due to the support of 6GHz band. Bug: 139354972 Test: atest com.android.server.wifi Change-Id: I2bd854c80cb87e6546be3b5fe72ef3f838c7e2c4
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java54
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
index 229c3d5e2..3d290e450 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
@@ -162,6 +162,7 @@ public class WifiVendorHalTest extends WifiBaseTest {
private IWifiStaIfaceEventCallback mIWifiStaIfaceEventCallback;
private IWifiChipEventCallback mIWifiChipEventCallback;
private android.hardware.wifi.V1_2.IWifiChipEventCallback mIWifiChipEventCallbackV12;
+ private android.hardware.wifi.V1_4.IWifiChipEventCallback mIWifiChipEventCallbackV14;
@Mock
private WifiNative.VendorHalDeathEventHandler mVendorHalDeathHandler;
@Mock
@@ -436,6 +437,15 @@ public class WifiVendorHalTest extends WifiBaseTest {
return (mWifiStatusSuccess);
}));
+ when(mIWifiChipV14.registerEventCallback_1_4(
+ any(android.hardware.wifi.V1_4.IWifiChipEventCallback.class)))
+ .thenAnswer(answerWifiStatus((invocation) -> {
+ Object[] args = invocation.getArguments();
+ mIWifiChipEventCallbackV14 =
+ (android.hardware.wifi.V1_4.IWifiChipEventCallback) args[0];
+ return (mWifiStatusSuccess);
+ }));
+
doAnswer(new AnswerWithArguments() {
public void answer(IWifiIface.getNameCallback cb)
throws RemoteException {
@@ -3092,6 +3102,42 @@ public class WifiVendorHalTest extends WifiBaseTest {
}
/**
+ * Verifies radio mode change callback to indicate DBS mode using V1.4 callback.
+ */
+ @Test
+ public void testRadioModeChangeCallbackToDbsModeV14() throws Exception {
+ startHalInStaModeAndRegisterRadioModeChangeCallback14();
+
+ android.hardware.wifi.V1_4.IWifiChipEventCallback.RadioModeInfo radioModeInfo0 =
+ new android.hardware.wifi.V1_4.IWifiChipEventCallback.RadioModeInfo();
+ radioModeInfo0.bandInfo = WifiScanner.WIFI_BAND_6_GHZ;
+ android.hardware.wifi.V1_4.IWifiChipEventCallback.RadioModeInfo radioModeInfo1 =
+ new android.hardware.wifi.V1_4.IWifiChipEventCallback.RadioModeInfo();
+ radioModeInfo1.bandInfo = WifiScanner.WIFI_BAND_24_GHZ;
+
+ IfaceInfo ifaceInfo0 = new IfaceInfo();
+ ifaceInfo0.name = TEST_IFACE_NAME;
+ ifaceInfo0.channel = 34;
+ IfaceInfo ifaceInfo1 = new IfaceInfo();
+ ifaceInfo1.name = TEST_IFACE_NAME_1;
+ ifaceInfo1.channel = 1;
+
+ radioModeInfo0.ifaceInfos.add(ifaceInfo0);
+ radioModeInfo1.ifaceInfos.add(ifaceInfo1);
+
+ ArrayList<android.hardware.wifi.V1_4.IWifiChipEventCallback.RadioModeInfo> radioModeInfos =
+ new ArrayList<>();
+ radioModeInfos.add(radioModeInfo0);
+ radioModeInfos.add(radioModeInfo1);
+
+ mIWifiChipEventCallbackV14.onRadioModeChange_1_4(radioModeInfos);
+ mLooper.dispatchAll();
+ verify(mVendorHalRadioModeChangeHandler).onDbs();
+
+ verifyNoMoreInteractions(mVendorHalRadioModeChangeHandler);
+ }
+
+ /**
* Verifies radio mode change callback to indicate SBS mode.
*/
@Test
@@ -3223,6 +3269,14 @@ public class WifiVendorHalTest extends WifiBaseTest {
assertNotNull(mIWifiChipEventCallbackV12);
}
+ private void startHalInStaModeAndRegisterRadioModeChangeCallback14() {
+ // Expose the 1.4 IWifiChip.
+ mWifiVendorHal = new WifiVendorHalSpyV1_4(mHalDeviceManager, mHandler);
+ mWifiVendorHal.registerRadioModeChangeHandler(mVendorHalRadioModeChangeHandler);
+ assertTrue(mWifiVendorHal.startVendorHalSta());
+ assertNotNull(mIWifiChipEventCallbackV14);
+ }
+
private void testAlertCallbackUsingProvidedCallback(IWifiChipEventCallback chipCallback)
throws Exception {
when(mIWifiChip.enableDebugErrorAlerts(anyBoolean())).thenReturn(mWifiStatusSuccess);