diff options
author | Roshan Pius <rpius@google.com> | 2017-03-21 08:16:22 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-03-21 11:26:08 -0700 |
commit | 35c9c7f7a2f83d81b8d61da834b3960f5b9ffe19 (patch) | |
tree | 1c914286848be6d49f1ce204982ba4f43110f9e9 /tests | |
parent | 56ee240e9e4c6a4967f08faa50cef95bfd5c2949 (diff) |
SupplicantStaIfaceHal: Broadcast bssid change event
Bug: 36451639
Test: Unit tests
Change-Id: Id4dc17fc9b0af1145a264406bf5d540c60c511f2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java | 30 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java | 6 |
2 files changed, 31 insertions, 5 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java index d7c3b93e3..de96a7a2a 100644 --- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java @@ -28,6 +28,7 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; +import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -38,6 +39,7 @@ import android.hardware.wifi.supplicant.V1_0.ISupplicant; import android.hardware.wifi.supplicant.V1_0.ISupplicantIface; import android.hardware.wifi.supplicant.V1_0.ISupplicantStaIface; import android.hardware.wifi.supplicant.V1_0.ISupplicantStaIfaceCallback; +import android.hardware.wifi.supplicant.V1_0.ISupplicantStaIfaceCallback.BssidChangeReason; import android.hardware.wifi.supplicant.V1_0.ISupplicantStaNetwork; import android.hardware.wifi.supplicant.V1_0.IfaceType; import android.hardware.wifi.supplicant.V1_0.SupplicantStatus; @@ -879,8 +881,6 @@ public class SupplicantStaIfaceHalTest { verify(mWifiMonitor).broadcastSupplicantStateChangeEvent( eq(WLAN_IFACE_NAME), eq(frameworkNetworkId), any(WifiSsid.class), eq(BSSID), eq(SupplicantState.ASSOCIATED)); - verify(mWifiMonitor).broadcastAssociationSuccesfulEvent( - eq(WLAN_IFACE_NAME), eq(BSSID)); } /** @@ -1010,6 +1010,32 @@ public class SupplicantStaIfaceHalTest { } /** + * Tests the handling of bssid change notification. + */ + @Test + public void testBssidChangedCallback() throws Exception { + executeAndValidateInitializationSequence(); + assertNotNull(mISupplicantStaIfaceCallback); + + mISupplicantStaIfaceCallback.onBssidChanged( + BssidChangeReason.ASSOC_START, NativeUtil.macAddressToByteArray(BSSID)); + verify(mWifiMonitor).broadcastTargetBssidEvent(eq(WLAN_IFACE_NAME), eq(BSSID)); + verify(mWifiMonitor, never()).broadcastAssociatedBssidEvent(eq(WLAN_IFACE_NAME), eq(BSSID)); + + reset(mWifiMonitor); + mISupplicantStaIfaceCallback.onBssidChanged( + BssidChangeReason.ASSOC_COMPLETE, NativeUtil.macAddressToByteArray(BSSID)); + verify(mWifiMonitor, never()).broadcastTargetBssidEvent(eq(WLAN_IFACE_NAME), eq(BSSID)); + verify(mWifiMonitor).broadcastAssociatedBssidEvent(eq(WLAN_IFACE_NAME), eq(BSSID)); + + reset(mWifiMonitor); + mISupplicantStaIfaceCallback.onBssidChanged( + BssidChangeReason.DISASSOC, NativeUtil.macAddressToByteArray(BSSID)); + verify(mWifiMonitor, never()).broadcastTargetBssidEvent(eq(WLAN_IFACE_NAME), eq(BSSID)); + verify(mWifiMonitor, never()).broadcastAssociatedBssidEvent(eq(WLAN_IFACE_NAME), eq(BSSID)); + } + + /** * Tests the handling of EAP failure notification. */ @Test diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java index 873583954..e9424223d 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMonitorTest.java @@ -361,14 +361,14 @@ public class WifiMonitorTest { } /** - * Broadcast association successful test. + * Broadcast associated bssid test. */ @Test - public void testBroadcastAssociationSuccessfulEvent() { + public void testBroadcastAssociatedBssidEvent() { mWifiMonitor.registerHandler( WLAN_IFACE_NAME, WifiStateMachine.CMD_ASSOCIATED_BSSID, mHandlerSpy); String bssid = BSSID; - mWifiMonitor.broadcastAssociationSuccesfulEvent(WLAN_IFACE_NAME, bssid); + mWifiMonitor.broadcastAssociatedBssidEvent(WLAN_IFACE_NAME, bssid); mLooper.dispatchAll(); ArgumentCaptor<Message> messageCaptor = ArgumentCaptor.forClass(Message.class); |