diff options
author | Roshan Pius <rpius@google.com> | 2017-03-21 21:36:45 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-03-21 21:36:46 +0000 |
commit | 168fba718720b54cf0a88cfad7f96948925fb1e3 (patch) | |
tree | 0d80f9127c3c8ef5e0700859ec30692b6c58b452 /tests | |
parent | 8e048dfa149e15cd7e0baf0d10ff4358e79e0dca (diff) | |
parent | 35c9c7f7a2f83d81b8d61da834b3960f5b9ffe19 (diff) |
Merge "SupplicantStaIfaceHal: Broadcast bssid change event"
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); |