summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-04-22 23:03:19 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-04-22 23:03:19 +0000
commit0c488c357b945649e567d29b237b7e78ba5238bd (patch)
tree61ed11c6701c1847b5fd685a71a33ed148c9474a /tests
parent3c8a4edc74f6b8f09321a7d05d8fc649339a15f8 (diff)
parent2bdea8391e029b88e8d8fcce0f06205a9e000999 (diff)
Merge "[SupplicantHal] Check HAL version before setting GCMP_256" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
index 0e1c9806b..49ae7a756 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaNetworkHalTest.java
@@ -196,6 +196,14 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
public void testPskPassphraseNetworkWifiConfigurationSaveLoad() throws Exception {
WifiConfiguration config = WifiConfigurationTestUtil.createPskNetwork();
config.requirePmf = true;
+
+ // Set the new defaults
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
+ config.allowedGroupManagementCiphers
+ .set(WifiConfiguration.GroupMgmtCipher.BIP_GMAC_256);
testWifiConfigurationSaveLoad(config);
verify(mISupplicantStaNetworkMock).setPskPassphrase(anyString());
verify(mISupplicantStaNetworkMock)
@@ -203,6 +211,10 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
verify(mISupplicantStaNetworkMock, never()).setPsk(any(byte[].class));
verify(mISupplicantStaNetworkMock, never())
.getPsk(any(ISupplicantStaNetwork.getPskCallback.class));
+ verify(mISupplicantStaNetworkMock)
+ .setPairwiseCipher(ISupplicantStaNetwork.PairwiseCipherMask.CCMP);
+ verify(mISupplicantStaNetworkMock)
+ .setGroupCipher(ISupplicantStaNetwork.GroupCipherMask.CCMP);
}
/**
@@ -948,6 +960,12 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
}
private void testWifiConfigurationSaveLoad(WifiConfiguration config) {
+ if (mSupplicantNetwork.getSupplicantStaNetworkForV1_2Mockable() == null) {
+ // Clear unsupported settings in HAL v1.0
+ config.allowedPairwiseCiphers.clear(WifiConfiguration.PairwiseCipher.GCMP_256);
+ config.allowedGroupCiphers.clear(WifiConfiguration.GroupCipher.GCMP_256);
+ }
+ // Save the configuration using the default supplicant network HAL v1.0
assertTrue(mSupplicantNetwork.saveWifiConfiguration(config));
WifiConfiguration loadConfig = new WifiConfiguration();
Map<String, String> networkExtras = new HashMap<>();
@@ -1039,6 +1057,38 @@ public class SupplicantStaNetworkHalTest extends WifiBaseTest {
}
/**
+ * Tests the saving/loading of WifiConfiguration to wpa_supplicant with psk passphrase for
+ * HAL v1.2 or higher
+ */
+ @Test
+ public void testPskPassphraseNetworkWifiConfigurationSaveLoad1_2OrHigher() throws Exception {
+ createSupplicantStaNetwork(SupplicantStaNetworkVersion.V1_2);
+ WifiConfiguration config = WifiConfigurationTestUtil.createPskNetwork();
+ config.requirePmf = true;
+
+ // Set the new defaults
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.GCMP_256);
+ config.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.GCMP_256);
+ config.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
+ testWifiConfigurationSaveLoad(config);
+ verify(mISupplicantStaNetworkMock).setPskPassphrase(anyString());
+ verify(mISupplicantStaNetworkMock)
+ .getPskPassphrase(any(ISupplicantStaNetwork.getPskPassphraseCallback.class));
+ verify(mISupplicantStaNetworkMock, never()).setPsk(any(byte[].class));
+ verify(mISupplicantStaNetworkMock, never())
+ .getPsk(any(ISupplicantStaNetwork.getPskCallback.class));
+ verify(mISupplicantStaNetworkV12)
+ .setPairwiseCipher_1_2(ISupplicantStaNetwork.PairwiseCipherMask.CCMP
+ | android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .PairwiseCipherMask.GCMP_256);
+ verify(mISupplicantStaNetworkV12)
+ .setGroupCipher_1_2(ISupplicantStaNetwork.GroupCipherMask.CCMP
+ | android.hardware.wifi.supplicant.V1_2.ISupplicantStaNetwork
+ .GroupCipherMask.GCMP_256);
+ }
+
+ /**
* Sets up the HIDL interface mock with all the setters/getter values.
* Note: This only sets up the mock to return success on all methods.
*/