summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGlen Kuhne <kuh@google.com>2017-04-07 13:49:18 -0700
committerGlen Kuhne <kuh@google.com>2017-04-10 13:39:02 -0700
commit781fa6d27f15a1e3b8cc3d3cd7aaa63b38c8d56e (patch)
tree3b7054cd0ee09f32fa847289ef2fe74ad4a92f0c /tests
parent5ed0a08cce018a10dce2b84f7d818e0f12c09f15 (diff)
Fix START_WPS null exception
Fixed an uncaught null being passed in through the startWps API. Bug: 36491634 Test: Added a unit test Change-Id: Ic8f5cec9d43332b4c8701582455e662a6f885f20
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index 5c3504906..f3cf0b888 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -1512,4 +1512,20 @@ public class WifiStateMachineTest {
addNetworkAndVerifySuccess(false);
verify(mWifiConnectivityManager, never()).setUserConnectChoice(eq(0));
}
+
+ /**
+ * Test START_WPS with a null wpsInfo object fails gracefully (No NPE)
+ */
+ @Test
+ public void testStartWps_nullWpsInfo() throws Exception {
+ loadComponentsInStaMode();
+ mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE);
+ assertEquals(WifiStateMachine.CONNECT_MODE, mWsm.getOperationalModeForTest());
+ assertEquals("DisconnectedState", getCurrentState().getName());
+ mLooper.startAutoDispatch();
+ Message reply = mWsmAsyncChannel.sendMessageSynchronously(WifiManager.START_WPS, 0, 0,
+ null);
+ mLooper.stopAutoDispatch();
+ assertEquals(WifiManager.WPS_FAILED, reply.what);
+ }
}