summaryrefslogtreecommitdiffstats
path: root/tests/wifitests/src/com/android/server/wifi
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2017-03-15 18:59:58 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-15 18:59:58 +0000
commita6c9196ab06177459471e7307415802ebb8fcafb (patch)
treeb0c862277d3b5ef2f10fbabef63e44122d5ce379 /tests/wifitests/src/com/android/server/wifi
parent3a861cce1ca6416175a1657c8c2b7ced3cc67fa5 (diff)
parent573be03ed27196845b173a5ff7136e7ee46aad67 (diff)
downloadandroid_frameworks_opt_net_wifi-a6c9196ab06177459471e7307415802ebb8fcafb.tar.gz
android_frameworks_opt_net_wifi-a6c9196ab06177459471e7307415802ebb8fcafb.tar.bz2
android_frameworks_opt_net_wifi-a6c9196ab06177459471e7307415802ebb8fcafb.zip
Merge "[SupplicantStaIfaceHal] Detect PSK mismatch" am: f1b57b5f1b am: 384f1e83f8
am: 573be03ed2 Change-Id: I728e8a18e5652656c4787c3d26f427136a7a3503
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
index 04ebf2200..bb5221730 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
@@ -926,6 +926,61 @@ public class SupplicantStaIfaceHalTest {
}
/**
+ * Tests the handling of incorrect network passwords.
+ */
+ @Test
+ public void testAuthFailurePassword() throws Exception {
+ executeAndValidateInitializationSequence();
+ assertNotNull(mISupplicantStaIfaceCallback);
+
+ int reasonCode = 3;
+ mISupplicantStaIfaceCallback.onDisconnected(
+ NativeUtil.macAddressToByteArray(BSSID), true, reasonCode);
+ verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt());
+
+ mISupplicantStaIfaceCallback.onDisconnected(
+ NativeUtil.macAddressToByteArray(BSSID), false, reasonCode);
+ verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt());
+
+ mISupplicantStaIfaceCallback.onStateChanged(
+ ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE,
+ NativeUtil.macAddressToByteArray(BSSID),
+ SUPPLICANT_NETWORK_ID,
+ NativeUtil.decodeSsid(SUPPLICANT_SSID));
+ mISupplicantStaIfaceCallback.onDisconnected(
+ NativeUtil.macAddressToByteArray(BSSID), true, reasonCode);
+ mISupplicantStaIfaceCallback.onDisconnected(
+ NativeUtil.macAddressToByteArray(BSSID), false, reasonCode);
+
+ verify(mWifiMonitor, times(2)).broadcastAuthenticationFailureEvent(eq(WLAN_IFACE_NAME),
+ eq(WifiMonitor.AUTHENTICATION_FAILURE_REASON_WRONG_PSWD));
+
+ }
+
+ /**
+ * Tests the handling of incorrect network passwords, edge case.
+ *
+ * If the disconnect reason is "IE in 4way differs", do not call it a password mismatch.
+ */
+ @Test
+ public void testIeDiffers() throws Exception {
+ executeAndValidateInitializationSequence();
+ assertNotNull(mISupplicantStaIfaceCallback);
+
+ int reasonCode = 17; // IEEE 802.11i WLAN_REASON_IE_IN_4WAY_DIFFERS
+
+ mISupplicantStaIfaceCallback.onStateChanged(
+ ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE,
+ NativeUtil.macAddressToByteArray(BSSID),
+ SUPPLICANT_NETWORK_ID,
+ NativeUtil.decodeSsid(SUPPLICANT_SSID));
+ mISupplicantStaIfaceCallback.onDisconnected(
+ NativeUtil.macAddressToByteArray(BSSID), true, reasonCode);
+ verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt());
+ }
+
+
+ /**
* Tests the handling of association rejection notification.
*/
@Test