summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-02-14 16:26:15 -0800
committerRoshan Pius <rpius@google.com>2017-02-15 16:38:38 -0800
commitc626bc21f7ebac14daa31ca7014767970127efee (patch)
tree7ba6bcb576deca55862dbed84df48175e23dfff4 /tests
parentef027b4240eb994976dc6173fa396fe10b45ae52 (diff)
WifiMonitor: Methods to broadcast remaining Wps events
Bug: 35357251 Test: Unit tests Change-Id: I27a3fb384dbb37fa6d1b8a4fd30f43be76e4e9aa
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java
index 623ec7ff4..f15e41628 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java
@@ -145,4 +145,49 @@ public class WifiMonitorTest {
assertEquals(WifiManager.ERROR, messageCaptor.getValue().arg1);
assertEquals(WpsConfigError.MSG_TIMEOUT, messageCaptor.getValue().arg2);
}
+
+ /**
+ * Broadcast WPS success event test.
+ */
+ @Test
+ public void testBroadcastWpsEventSuccess() {
+ mWifiMonitor.registerHandler(
+ WLAN_IFACE_NAME, WifiMonitor.WPS_SUCCESS_EVENT, mHandlerSpy);
+ mWifiMonitor.broadcastWpsSuccessEvent(WLAN_IFACE_NAME);
+ mLooper.dispatchAll();
+
+ ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class);
+ verify(mHandlerSpy).handleMessage(messageCaptor.capture());
+ assertEquals(WifiMonitor.WPS_SUCCESS_EVENT, messageCaptor.getValue().what);
+ }
+
+ /**
+ * Broadcast WPS overlap event test.
+ */
+ @Test
+ public void testBroadcastWpsEventOverlap() {
+ mWifiMonitor.registerHandler(
+ WLAN_IFACE_NAME, WifiMonitor.WPS_OVERLAP_EVENT, mHandlerSpy);
+ mWifiMonitor.broadcastWpsOverlapEvent(WLAN_IFACE_NAME);
+ mLooper.dispatchAll();
+
+ ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class);
+ verify(mHandlerSpy).handleMessage(messageCaptor.capture());
+ assertEquals(WifiMonitor.WPS_OVERLAP_EVENT, messageCaptor.getValue().what);
+ }
+
+ /**
+ * Broadcast WPS timeout event test.
+ */
+ @Test
+ public void testBroadcastWpsEventTimeout() {
+ mWifiMonitor.registerHandler(
+ WLAN_IFACE_NAME, WifiMonitor.WPS_TIMEOUT_EVENT, mHandlerSpy);
+ mWifiMonitor.broadcastWpsTimeoutEvent(WLAN_IFACE_NAME);
+ mLooper.dispatchAll();
+
+ ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class);
+ verify(mHandlerSpy).handleMessage(messageCaptor.capture());
+ assertEquals(WifiMonitor.WPS_TIMEOUT_EVENT, messageCaptor.getValue().what);
+ }
}