diff options
author | Ningyuan Wang <nywang@google.com> | 2017-05-18 20:30:32 -0700 |
---|---|---|
committer | Ningyuan Wang <nywang@google.com> | 2017-05-19 17:05:23 -0700 |
commit | c66d00cefbd32ec2fbefcf1fd54c1aaf50b5ce5a (patch) | |
tree | 334e1be069874ed0690f546faf2848bb1b283908 /tests | |
parent | 70df7749fe3dc574c1ef7713d48b51afc79787fb (diff) |
Support coexistence of wpa and wpa2 IEs in scan result
When there are both wpa1 and wpa2(rsn) ies in scan result,
InformationElementUtil.generateCapabilitiesString() should
handle it and generate capabilties string correctly.
Bug: 37653951
Test: compile, unit tests, manual test, integration test
Change-Id: I7160fcbbd75c07f4fe02de62a3e4539fa628eab3
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. |