summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2017-05-24 17:58:11 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-24 17:58:11 +0000
commit4ebb0d3daedb29cb47ec34f670e97580d41e2dcc (patch)
tree77dfafc6e981b8fb6cd5585a5a1b662b586a4749 /tests
parentd5451e3494151fb83773c31a4144be80f5358326 (diff)
parent4fb8b1a49da049cdbaf589c1904b456aebc4772e (diff)
Merge "Support coexistence of wpa and wpa2 IEs in scan result" into oc-dev am: 2bfc3924e0
am: 4fb8b1a49d Change-Id: I948d479981ffa92c7b7ecba196b6862f83e020cc
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java38
1 files changed, 38 insertions, 0 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 ae654468b..d94b54252 100644
--- a/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java
@@ -299,6 +299,44 @@ public class InformationElementUtilTest {
}
/**
+ * Test Capabilities.generateCapabilitiesString() with both RSN and WPA1 IE.
+ * Expect the function to return a string with the proper security information.
+ */
+ @Test
+ public void buildCapabilities_rsnAndWpaElement() {
+ InformationElement ieRsn = new InformationElement();
+ ieRsn.id = InformationElement.EID_RSN;
+ ieRsn.bytes = new byte[] { (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x0F,
+ (byte) 0xAC, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x04,
+ (byte) 0x00, (byte) 0x0F, (byte) 0xAC, (byte) 0x02,
+ (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x0F,
+ (byte) 0xAC, (byte) 0x02, (byte) 0x00, (byte) 0x00 };
+
+ InformationElement ieWpa = new InformationElement();
+ ieWpa.id = InformationElement.EID_VSA;
+ ieWpa.bytes = new byte[] { (byte) 0x00, (byte) 0x50, (byte) 0xF2, (byte) 0x01,
+ (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x50,
+ (byte) 0xF2, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+ (byte) 0x00, (byte) 0x50, (byte) 0xF2, (byte) 0x04,
+ (byte) 0x00, (byte) 0x50, (byte) 0xF2, (byte) 0x02,
+ (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x50,
+ (byte) 0xF2, (byte) 0x02, (byte) 0x00, (byte) 0x00 };
+
+ InformationElement[] ies = new InformationElement[] { ieWpa, ieRsn };
+
+ BitSet beaconCap = new BitSet(16);
+ beaconCap.set(4);
+
+ InformationElementUtil.Capabilities capabilities =
+ new InformationElementUtil.Capabilities();
+ capabilities.from(ies, beaconCap);
+ String result = capabilities.generateCapabilitiesString();
+
+ assertEquals("[WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP]", result);
+ }
+
+ /**
* Test Capabilities.generateCapabilitiesString() with a vendor specific element which
* is not WPA type 1. Beacon Capability Information field has the Privacy
* bit set.