summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHai Shalom <haishalom@google.com>2019-12-03 08:32:14 -0800
committerandroid-build-merger <android-build-merger@google.com>2019-12-03 08:32:14 -0800
commit14253960c75e0e5abae57583a9b33ca66f8a1860 (patch)
tree9575f5bfb696b395d4ca5c6f7c469523bef90fdc /tests
parent3017569ad9a3ba65fe6401fe6dfd8e34929ddd19 (diff)
parentdafd07c544a9c17d0afb965184411a5644a77421 (diff)
Merge "Wifi: Fix connectivity issues with PSK-SHA256+SAE mode APs" into qt-qpr1-dev
am: dafd07c544 Change-Id: Ia45d9be99aff275c8a8c085c2ce98260a0fd35bf
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java76
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java
index 45adffd1d..266a2ce23 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/ScanResultUtilTest.java
@@ -116,6 +116,82 @@ public class ScanResultUtilTest {
assertTrue(config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.IEEE8021X));
}
+ /**
+ * Test that a PSK-SHA256+SAE network is detected as transition mode
+ */
+ @Test
+ public void testPskSha256SaeTransitionModeCheck() {
+ final String ssid = "WPA3-Transition";
+ String caps = "[WPA2-FT/PSK-CCMP][RSN-FT/PSK+PSK-SHA256+SAE+FT/SAE-CCMP][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertTrue(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
+ /**
+ * Test that a PSK+SAE network is detected as transition mode
+ */
+ @Test
+ public void testPskSaeTransitionModeCheck() {
+ final String ssid = "WPA3-Transition";
+ String caps = "[WPA2-FT/PSK+PSK+SAE+FT/SAE-CCMP][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertTrue(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
+ /**
+ * Test that a PSK network is not detected as transition mode
+ */
+ @Test
+ public void testPskNotInTransitionModeCheck() {
+ final String ssid = "WPA2-Network";
+ String caps = "[WPA2-FT/PSK+PSK][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertFalse(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
+ /**
+ * Test that an SAE network is not detected as transition mode
+ */
+ @Test
+ public void testSaeNotInTransitionModeCheck() {
+ final String ssid = "WPA3-Network";
+ String caps = "[WPA2-FT/SAE+SAE][ESS][WPS]";
+
+ ScanResult input = new ScanResult(WifiSsid.createFromAsciiEncoded(ssid), ssid,
+ "ab:cd:01:ef:45:89", 1245, 0, caps, -78, 2450, 1025, 22, 33, 20, 0,
+ 0, true);
+
+ input.informationElements = new InformationElement[] {
+ createIE(InformationElement.EID_SSID, ssid.getBytes(StandardCharsets.UTF_8))
+ };
+
+ assertFalse(ScanResultUtil.isScanResultForPskSaeTransitionNetwork(input));
+ }
+
private static InformationElement createIE(int id, byte[] bytes) {
InformationElement ie = new InformationElement();
ie.id = id;