summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2016-10-27 15:01:09 -0700
committerNingyuan Wang <nywang@google.com>2016-10-31 10:28:46 -0700
commit4d11585ede6636fee294ffb89e832e2f7f271c12 (patch)
treef2433f56e82438dcdbc9a3ad01e8561c2cdad072 /tests
parent92f4d52b14d8847f6f81712bf3bbfa0f1203eef5 (diff)
Add group and pairwise cipher suite info to Capabilities object
This parses the group and pairwise cipher suite from IEs, and stores them in InformationElementUtil.Capabilities object. This repaces buildCapabilities() with from() and generateCpabilities String(). This decouples security capabilities information from the capabilities string, which is exposed to API and need to match supplicant format. This add the pairwise cipher to capabilities string to match the supplicant format. This also fixes the WPA IE structure in comments. Bug: 32481849 Change-Id: Iaf9ec222886375ed4e5ba66b1d8e0e408acd0a20 Test: compile, manual test, unit tests
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java51
1 files changed, 36 insertions, 15 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
index ef9e1200d..4c037ff6c 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
@@ -239,7 +239,7 @@ public class InformationElementUtilTest {
}
/**
- * Test Capabilities.buildCapabilities() with a RSN IE.
+ * Test Capabilities.generateCapabilitiesString() with a RSN IE.
* Expect the function to return a string with the proper security information.
*/
@Test
@@ -258,13 +258,16 @@ public class InformationElementUtilTest {
BitSet beaconCap = new BitSet(16);
beaconCap.set(4);
- String result = InformationElementUtil.Capabilities.buildCapabilities(ies, beaconCap);
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
- assertEquals("[WPA2-PSK]", result);
+ assertEquals("[WPA2-PSK-CCMP+TKIP]", result);
}
/**
- * Test Capabilities.buildCapabilities() with a WPA type 1 IE.
+ * Test Capabilities.generateCapabilitiesString() with a WPA type 1 IE.
* Expect the function to return a string with the proper security information.
*/
@Test
@@ -283,14 +286,16 @@ public class InformationElementUtilTest {
BitSet beaconCap = new BitSet(16);
beaconCap.set(4);
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
- String result = InformationElementUtil.Capabilities.buildCapabilities(ies, beaconCap);
-
- assertEquals("[WPA-PSK]", result);
+ assertEquals("[WPA-PSK-CCMP+TKIP]", result);
}
/**
- * Test Capabilities.buildCapabilities() with a vendor specific element which
+ * Test Capabilities.generateCapabilitiesString() with a vendor specific element which
* is not WPA type 1. Beacon Capability Information field has the Privacy
* bit set.
*
@@ -309,13 +314,17 @@ public class InformationElementUtilTest {
BitSet beaconCap = new BitSet(16);
beaconCap.set(4);
- String result = InformationElementUtil.Capabilities.buildCapabilities(ies, beaconCap);
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
assertEquals("[WEP]", result);
}
/**
- * Test Capabilities.buildCapabilities() with a vendor specific element which
+ * Test Capabilities.generateCapabilitiesString() with a vendor specific element which
* is not WPA type 1. Beacon Capability Information field doesn't have the
* Privacy bit set.
*
@@ -334,13 +343,17 @@ public class InformationElementUtilTest {
BitSet beaconCap = new BitSet(16);
beaconCap.clear(4);
- String result = InformationElementUtil.Capabilities.buildCapabilities(ies, beaconCap);
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
assertEquals("", result);
}
/**
- * Test Capabilities.buildCapabilities() with a vendor specific element which
+ * Test Capabilities.generateCapabilitiesString() with a vendor specific element which
* is not WPA type 1. Beacon Capability Information field has the ESS bit set.
*
* Expect the function to return a string with [ESS] there.
@@ -358,13 +371,17 @@ public class InformationElementUtilTest {
BitSet beaconCap = new BitSet(16);
beaconCap.set(0);
- String result = InformationElementUtil.Capabilities.buildCapabilities(ies, beaconCap);
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
assertEquals("[ESS]", result);
}
/**
- * Test Capabilities.buildCapabilities() with a vendor specific element which
+ * Test Capabilities.generateCapabilitiesString() with a vendor specific element which
* is not WPA type 1. Beacon Capability Information field doesn't have the
* ESS bit set.
*
@@ -383,7 +400,11 @@ public class InformationElementUtilTest {
BitSet beaconCap = new BitSet(16);
beaconCap.clear(0);
- String result = InformationElementUtil.Capabilities.buildCapabilities(ies, beaconCap);
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
assertEquals("", result);
}