diff options
author | Glen Kuhne <kuh@google.com> | 2017-05-12 07:25:41 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-12 07:25:41 +0000 |
commit | 7e672c90b423d9e49ed4ee56e1f49622a1e80e72 (patch) | |
tree | 91faf41581e297c4d2b66585b08e297a9d8e2a1d /tests | |
parent | 1743f340236aab0765776c911320c9f5f4e1c190 (diff) | |
parent | d8c6cda12ac48ab79c12898fa7391d3f1a98c41f (diff) |
Merge "P2P: handle null p2p_dev_address sta auth/deauth" into oc-dev am: 88d77863cb
am: d8c6cda12a
Change-Id: I8a96e11c00222db74ba6cf03bbeb4d00cdfabbbd
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceCallbackTest.java | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceCallbackTest.java b/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceCallbackTest.java index aada83410..65047a130 100644 --- a/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceCallbackTest.java +++ b/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceCallbackTest.java @@ -32,6 +32,8 @@ import android.net.wifi.p2p.WifiP2pDevice; import android.net.wifi.p2p.WifiP2pGroup; import android.net.wifi.p2p.WifiP2pProvDiscEvent; +import com.android.server.wifi.util.NativeUtil; + import org.junit.Assert.*; import org.junit.Before; import org.junit.Test; @@ -413,4 +415,32 @@ public class SupplicantP2pIfaceCallbackTest { anyString(), discEventCaptor.capture()); assertEquals(WifiP2pProvDiscEvent.PBC_REQ, discEventCaptor.getValue().event); } + + /** + * Test staAuth with device address, should trigger ApStaConnected broadcast + */ + @Test + public void testStaAuth_success() { + // Trigger onStaAuthorized callback, ensure wifimonitor broadcast is sent with WifiP2pDevice + // using the p2pDeviceAddress + ArgumentCaptor<WifiP2pDevice> p2pDeviceCaptor = + ArgumentCaptor.forClass(WifiP2pDevice.class); + mDut.onStaAuthorized(mDeviceAddress1Bytes, mDeviceAddress2Bytes); + verify(mMonitor).broadcastP2pApStaConnected(any(String.class), p2pDeviceCaptor.capture()); + assertEquals(mDeviceAddress2String, p2pDeviceCaptor.getValue().deviceAddress); + } + + /** + * Test staAuth without device address, should trigger ApStaConnected broadcast using srcAddress + */ + @Test + public void testStaAuth_noDeviceAddress_success() { + // Trigger onStaAuthorized callback, using a zero'd p2pDeviceAddress, ensure wifimonitor + // broadcast is sent with WifiP2pDevice using the srcAddress + ArgumentCaptor<WifiP2pDevice> p2pDeviceCaptor = + ArgumentCaptor.forClass(WifiP2pDevice.class); + mDut.onStaAuthorized(mDeviceAddress1Bytes, NativeUtil.ANY_MAC_BYTES); + verify(mMonitor).broadcastP2pApStaConnected(any(String.class), p2pDeviceCaptor.capture()); + assertEquals(mDeviceAddress1String, p2pDeviceCaptor.getValue().deviceAddress); + } } |