summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Plass <mplass@google.com>2019-04-05 12:55:42 -0700
committerMichael Plass <mplass@google.com>2019-04-05 13:20:49 -0700
commitfccc779342f194fc287aa0acc33a3ea04a13ec9c (patch)
tree4dda8b7420a1cbcee26c945af8266f0c4da05212 /tests
parent91c8438e385089b3625a1dd969c674eeeb3ce9d2 (diff)
Improve SupplicantStaIfaceHal coverage
Also some style nits. Bug: 130023372 Test: atest SupplicantStaIfaceHalTest Change-Id: I7e82ca017f4081043b3be4701f0943bc21c1e8a7
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java34
1 files changed, 26 insertions, 8 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
index a63c84547..cae7e2dac 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
@@ -128,6 +128,7 @@ public class SupplicantStaIfaceHalTest {
private @Mock PropertyService mPropertyService;
private @Mock SupplicantStaNetworkHal mSupplicantStaNetworkMock;
private @Mock WifiNative.SupplicantDeathEventHandler mSupplicantHalDeathHandler;
+
SupplicantStatus mStatusSuccess;
SupplicantStatus mStatusFailure;
ISupplicant.IfaceInfo mStaIface0;
@@ -1247,11 +1248,13 @@ public class SupplicantStaIfaceHalTest {
int reasonCode = 3;
mISupplicantStaIfaceCallback.onDisconnected(
NativeUtil.macAddressToByteArray(BSSID), true, reasonCode);
- verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt(), anyInt());
+ verify(mWifiMonitor, times(0))
+ .broadcastAuthenticationFailureEvent(any(), anyInt(), anyInt());
mISupplicantStaIfaceCallback.onDisconnected(
NativeUtil.macAddressToByteArray(BSSID), false, reasonCode);
- verify(mWifiMonitor, times(0)).broadcastAuthenticationFailureEvent(any(), anyInt(), anyInt());
+ verify(mWifiMonitor, times(0))
+ .broadcastAuthenticationFailureEvent(any(), anyInt(), anyInt());
mISupplicantStaIfaceCallback.onStateChanged(
ISupplicantStaIfaceCallback.State.FOURWAY_HANDSHAKE,
@@ -1263,8 +1266,9 @@ public class SupplicantStaIfaceHalTest {
mISupplicantStaIfaceCallback.onDisconnected(
NativeUtil.macAddressToByteArray(BSSID), false, reasonCode);
- verify(mWifiMonitor, times(2)).broadcastAuthenticationFailureEvent(eq(WLAN0_IFACE_NAME),
- eq(WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD), eq(-1));
+ verify(mWifiMonitor, times(2))
+ .broadcastAuthenticationFailureEvent(eq(WLAN0_IFACE_NAME),
+ eq(WifiManager.ERROR_AUTH_FAILURE_WRONG_PSWD), eq(-1));
}
/**
@@ -1536,7 +1540,7 @@ public class SupplicantStaIfaceHalTest {
* and then the death notification.
*/
@Test
- public void testHandleRemoteExceptonAndDeathNotification() throws Exception {
+ public void testHandleRemoteExceptionAndDeathNotification() throws Exception {
executeAndValidateInitializationSequence();
assertTrue(mDut.registerDeathHandler(mSupplicantHalDeathHandler));
assertTrue(mDut.isInitializationComplete());
@@ -1550,7 +1554,7 @@ public class SupplicantStaIfaceHalTest {
// Check that remote exception cleared all internal state.
assertFalse(mDut.isInitializationComplete());
- // Ensure that futher calls fail because the remote exception clears any state.
+ // Ensure that further calls fail because the remote exception clears any state.
assertFalse(mDut.setPowerSave(WLAN0_IFACE_NAME, true));
//.. No call to ISupplicantStaIface object
@@ -1883,6 +1887,20 @@ public class SupplicantStaIfaceHalTest {
assertEquals(WIFI_FEATURE_DPP, mDut.getAdvancedKeyMgmtCapabilities(WLAN0_IFACE_NAME));
}
+ /**
+ * Test Easy Connect (DPP) calls return failure if hal version is less than 1_2
+ */
+ @Test
+ public void testDppFailsWithOldHal() throws Exception {
+ assertEquals(-1, mDut.addDppPeerUri(WLAN0_IFACE_NAME, "/blah"));
+ assertFalse(mDut.removeDppUri(WLAN0_IFACE_NAME, 0));
+ assertFalse(mDut.stopDppInitiator(WLAN0_IFACE_NAME));
+ assertFalse(mDut.startDppConfiguratorInitiator(WLAN0_IFACE_NAME,
+ 1, 2, "Buckle", "My", "Shoe",
+ 3, 4));
+ assertFalse(mDut.startDppEnrolleeInitiator(WLAN0_IFACE_NAME, 3, 14));
+ }
+
private WifiConfiguration createTestWifiConfiguration() {
WifiConfiguration config = new WifiConfiguration();
config.networkId = SUPPLICANT_NETWORK_ID;
@@ -1945,7 +1963,7 @@ public class SupplicantStaIfaceHalTest {
.when(mISupplicantMock).getInterface(any(ISupplicant.IfaceInfo.class),
any(ISupplicant.getInterfaceCallback.class));
}
- /** Callback registeration */
+ /** Callback registration */
if (causeCallbackRegFailure) {
doAnswer(new MockAnswerUtil.AnswerWithArguments() {
public SupplicantStatus answer(ISupplicantStaIfaceCallback cb)
@@ -1978,7 +1996,7 @@ public class SupplicantStaIfaceHalTest {
mServiceNotificationCaptor.getValue().onRegistration(ISupplicant.kInterfaceName, "", true);
assertTrue(mDut.isInitializationComplete());
- assertTrue(mDut.setupIface(WLAN0_IFACE_NAME) == shouldSucceed);
+ assertEquals(shouldSucceed, mDut.setupIface(WLAN0_IFACE_NAME));
mInOrder.verify(mISupplicantMock).linkToDeath(mSupplicantDeathCaptor.capture(),
mDeathRecipientCookieCaptor.capture());
// verify: listInterfaces is called