diff options
author | Ningyuan Wang <nywang@google.com> | 2017-05-24 17:49:22 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-24 17:49:22 +0000 |
commit | 4fb8b1a49da049cdbaf589c1904b456aebc4772e (patch) | |
tree | 4f457040fe132bf49d1dbbc7bad2d01aed023e45 /tests | |
parent | dd798b8777d21082ae75d6ea388c343a2572d8fc (diff) | |
parent | 2bfc3924e0c811ac7771d76d6a5c3164205add33 (diff) |
Merge "Support coexistence of wpa and wpa2 IEs in scan result" into oc-dev
am: 2bfc3924e0
Change-Id: I684404da371e52450f9b5ae18ab9e54c9c8ffbab
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/util/InformationElementUtilTest.java | 38 |
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. |