diff options
author | Ningyuan Wang <nywang@google.com> | 2017-05-24 17:28:36 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-05-24 17:28:37 +0000 |
commit | 48807b36bcc3d518ed12389e4889e5583fc8d672 (patch) | |
tree | c3d0a08961061a93828dff74ff4af003113fb9ab /tests | |
parent | 2bfc3924e0c811ac7771d76d6a5c3164205add33 (diff) | |
parent | c4ad341e844e88a34be7ed4c3c9509fb72608b37 (diff) |
Merge "Abort scan before connection" into oc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java | 26 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WificondControlTest.java | 11 |
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java index b1285042d..2f13baf7b 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java @@ -29,6 +29,7 @@ import static org.mockito.Mockito.when; import android.net.wifi.IApInterface; import android.net.wifi.IClientInterface; +import android.net.wifi.WifiConfiguration; import android.test.suitebuilder.annotation.SmallTest; import org.junit.Before; @@ -674,4 +675,29 @@ public class WifiNativeTest { mWifiNative.stopPnoScan(); verify(mWificondControl).stopPnoScan(); } + + /** + * Verifies that connectToNetwork() calls underlying WificondControl and SupplicantStaIfaceHal. + */ + @Test + public void testConnectToNetwork() throws Exception { + WifiConfiguration config = mock(WifiConfiguration.class); + mWifiNative.connectToNetwork(config); + // connectToNetwork() should abort ongoing scan before connection. + verify(mWificondControl).abortScan(); + verify(mStaIfaceHal).connectToNetwork(config); + } + + /** + * Verifies that roamToNetwork() calls underlying WificondControl and SupplicantStaIfaceHal. + */ + @Test + public void testRoamToNetwork() throws Exception { + WifiConfiguration config = mock(WifiConfiguration.class); + mWifiNative.roamToNetwork(config); + // roamToNetwork() should abort ongoing scan before connection. + verify(mWificondControl).abortScan(); + verify(mStaIfaceHal).roamToNetwork(config); + } + } diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java index 6d26c9b39..261733144 100644 --- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java @@ -597,6 +597,17 @@ public class WificondControlTest { } /** + * Verifies that abortScan() calls underlying wificond. + */ + @Test + public void testAbortScan() throws Exception { + IWifiScannerImpl scanner = setupClientInterfaceAndCreateMockWificondScanner(); + + mWificondControl.abortScan(); + verify(scanner).abortScan(); + } + + /** * Helper method: create a mock IClientInterface which mocks all neccessary operations. * Returns a mock IClientInterface. */ |