summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAhmed ElArabawy <arabawy@google.com>2019-11-07 10:10:37 -0800
committerAhmed ElArabawy <arabawy@google.com>2019-11-14 07:46:48 -0800
commit128fdd286363ff98cad24da707d7124b12b47143 (patch)
tree63e1058fe297ddaff0848cddbaa0fb71f141677d /tests
parent76012840c6b576a75a42e26ffc15716e66bbfd0c (diff)
Support checking on device capability for 6GHZ
This commit implements support of checking whether device supports 6GHz band. Bug: 139354972 Test: atest com.android.wifi.server Change-Id: Ie2531ffb9abf50b891d5f5281e871b393bacaee4
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java143
1 files changed, 141 insertions, 2 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
index d44d63d1e..229c3d5e2 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiVendorHalTest.java
@@ -150,11 +150,15 @@ public class WifiVendorHalTest extends WifiBaseTest {
@Mock
private android.hardware.wifi.V1_3.IWifiChip mIWifiChipV13;
@Mock
+ private android.hardware.wifi.V1_4.IWifiChip mIWifiChipV14;
+ @Mock
private IWifiStaIface mIWifiStaIface;
@Mock
private android.hardware.wifi.V1_2.IWifiStaIface mIWifiStaIfaceV12;
@Mock
private android.hardware.wifi.V1_3.IWifiStaIface mIWifiStaIfaceV13;
+ @Mock
+ private android.hardware.wifi.V1_4.IWifiStaIface mIWifiStaIfaceV14;
private IWifiStaIfaceEventCallback mIWifiStaIfaceEventCallback;
private IWifiChipEventCallback mIWifiChipEventCallback;
private android.hardware.wifi.V1_2.IWifiChipEventCallback mIWifiChipEventCallbackV12;
@@ -188,6 +192,11 @@ public class WifiVendorHalTest extends WifiBaseTest {
}
@Override
+ protected android.hardware.wifi.V1_4.IWifiChip getWifiChipForV1_4Mockable() {
+ return null;
+ }
+
+ @Override
protected android.hardware.wifi.V1_2.IWifiStaIface getWifiStaIfaceForV1_2Mockable(
String ifaceName) {
return null;
@@ -198,6 +207,12 @@ public class WifiVendorHalTest extends WifiBaseTest {
String ifaceName) {
return null;
}
+
+ @Override
+ protected android.hardware.wifi.V1_4.IWifiStaIface getWifiStaIfaceForV1_4Mockable(
+ String ifaceName) {
+ return null;
+ }
}
/**
@@ -211,7 +226,7 @@ public class WifiVendorHalTest extends WifiBaseTest {
@Override
protected android.hardware.wifi.V1_1.IWifiChip getWifiChipForV1_1Mockable() {
- return null;
+ return mIWifiChipV11;
}
@Override
@@ -225,6 +240,11 @@ public class WifiVendorHalTest extends WifiBaseTest {
}
@Override
+ protected android.hardware.wifi.V1_4.IWifiChip getWifiChipForV1_4Mockable() {
+ return null;
+ }
+
+ @Override
protected android.hardware.wifi.V1_2.IWifiStaIface getWifiStaIfaceForV1_2Mockable(
String ifaceName) {
return mIWifiStaIfaceV12;
@@ -235,6 +255,12 @@ public class WifiVendorHalTest extends WifiBaseTest {
String ifaceName) {
return null;
}
+
+ @Override
+ protected android.hardware.wifi.V1_4.IWifiStaIface getWifiStaIfaceForV1_4Mockable(
+ String ifaceName) {
+ return null;
+ }
}
/**
@@ -248,20 +274,73 @@ public class WifiVendorHalTest extends WifiBaseTest {
@Override
protected android.hardware.wifi.V1_1.IWifiChip getWifiChipForV1_1Mockable() {
- return null;
+ return mIWifiChipV11;
}
@Override
protected android.hardware.wifi.V1_2.IWifiChip getWifiChipForV1_2Mockable() {
+ return mIWifiChipV12;
+ }
+
+ @Override
+ protected android.hardware.wifi.V1_3.IWifiChip getWifiChipForV1_3Mockable() {
+ return mIWifiChipV13;
+ }
+
+ @Override
+ protected android.hardware.wifi.V1_4.IWifiChip getWifiChipForV1_4Mockable() {
return null;
}
@Override
+ protected android.hardware.wifi.V1_2.IWifiStaIface getWifiStaIfaceForV1_2Mockable(
+ String ifaceName) {
+ return mIWifiStaIfaceV12;
+ }
+
+ @Override
+ protected android.hardware.wifi.V1_3.IWifiStaIface getWifiStaIfaceForV1_3Mockable(
+ String ifaceName) {
+ return mIWifiStaIfaceV13;
+ }
+
+ @Override
+ protected android.hardware.wifi.V1_4.IWifiStaIface getWifiStaIfaceForV1_4Mockable(
+ String ifaceName) {
+ return null;
+ }
+ }
+
+ /**
+ * Spy used to return the V1_4 IWifiChip and V1_4 IWifiStaIface mock objects to simulate
+ * the 1.4 HAL running on the device.
+ */
+ private class WifiVendorHalSpyV1_4 extends WifiVendorHal {
+ WifiVendorHalSpyV1_4(HalDeviceManager halDeviceManager, Handler handler) {
+ super(halDeviceManager, handler);
+ }
+
+ @Override
+ protected android.hardware.wifi.V1_1.IWifiChip getWifiChipForV1_1Mockable() {
+ return mIWifiChipV11;
+ }
+
+ @Override
+ protected android.hardware.wifi.V1_2.IWifiChip getWifiChipForV1_2Mockable() {
+ return mIWifiChipV12;
+ }
+
+ @Override
protected android.hardware.wifi.V1_3.IWifiChip getWifiChipForV1_3Mockable() {
return mIWifiChipV13;
}
@Override
+ protected android.hardware.wifi.V1_4.IWifiChip getWifiChipForV1_4Mockable() {
+ return mIWifiChipV14;
+ }
+
+ @Override
protected android.hardware.wifi.V1_2.IWifiStaIface getWifiStaIfaceForV1_2Mockable(
String ifaceName) {
return mIWifiStaIfaceV12;
@@ -272,6 +351,12 @@ public class WifiVendorHalTest extends WifiBaseTest {
String ifaceName) {
return mIWifiStaIfaceV13;
}
+
+ @Override
+ protected android.hardware.wifi.V1_4.IWifiStaIface getWifiStaIfaceForV1_4Mockable(
+ String ifaceName) {
+ return mIWifiStaIfaceV14;
+ }
}
/**
@@ -820,6 +905,60 @@ public class WifiVendorHalTest extends WifiBaseTest {
}
/**
+ * Test get supported features on HAL V1_4.
+ * Tests whether we coalesce information from different sources
+ * (IWifiStaIface, IWifiChip and HalDeviceManager) into the bitmask of supported features
+ * correctly.
+ */
+ @Test
+ public void testGetSupportedFeaturesV1_4() throws Exception {
+ mWifiVendorHal = new WifiVendorHalSpyV1_4(mHalDeviceManager, mHandler);
+ assertTrue(mWifiVendorHal.startVendorHalSta());
+
+ int staIfaceHidlCaps = (
+ IWifiStaIface.StaIfaceCapabilityMask.BACKGROUND_SCAN
+ | IWifiStaIface.StaIfaceCapabilityMask.LINK_LAYER_STATS
+ | android.hardware.wifi.V1_4.IWifiStaIface.StaIfaceCapabilityMask.STA_6G
+ );
+ int chipHidlCaps =
+ android.hardware.wifi.V1_1.IWifiChip.ChipCapabilityMask.SET_TX_POWER_LIMIT;
+ Set<Integer> halDeviceManagerSupportedIfaces = new HashSet<Integer>() {{
+ add(IfaceType.STA);
+ add(IfaceType.P2P);
+ }};
+ long expectedFeatureSet = (
+ WifiManager.WIFI_FEATURE_SCANNER
+ | WifiManager.WIFI_FEATURE_LINK_LAYER_STATS
+ | WifiManager.WIFI_FEATURE_TX_POWER_LIMIT
+ | WifiManager.WIFI_FEATURE_INFRA
+ | WifiManager.WIFI_FEATURE_P2P
+ | WifiManager.WIFI_FEATURE_INFRA_6G
+ );
+
+ doAnswer(new AnswerWithArguments() {
+ public void answer(
+ android.hardware.wifi.V1_4.IWifiStaIface.getCapabilities_1_4Callback cb)
+ throws RemoteException {
+ cb.onValues(mWifiStatusSuccess, staIfaceHidlCaps);
+ }
+ }).when(mIWifiStaIfaceV14).getCapabilities_1_4(
+ any(android.hardware.wifi.V1_4.IWifiStaIface.getCapabilities_1_4Callback.class));
+
+ doAnswer(new AnswerWithArguments() {
+ public void answer(android.hardware.wifi.V1_3.IWifiChip.getCapabilities_1_3Callback cb)
+ throws RemoteException {
+ cb.onValues(mWifiStatusSuccess, chipHidlCaps);
+ }
+ }).when(mIWifiChipV13).getCapabilities_1_3(
+ any(android.hardware.wifi.V1_3.IWifiChip.getCapabilities_1_3Callback.class));
+
+ when(mHalDeviceManager.getSupportedIfaceTypes())
+ .thenReturn(halDeviceManagerSupportedIfaces);
+
+ assertEquals(expectedFeatureSet, mWifiVendorHal.getSupportedFeatureSet(TEST_IFACE_NAME));
+ }
+
+ /**
* Test |getFactoryMacAddress| gets called when the hal version is V1_3
* @throws Exception
*/