diff options
author | Ningyuan Wang <nywang@google.com> | 2017-05-24 17:49:39 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-24 17:49:39 +0000 |
commit | b4a6453d37b24671a586508a66d1f3cd456d5f30 (patch) | |
tree | 4571a77f3328fb1cfa0156153dcab00696a682ea /tests | |
parent | 4fb8b1a49da049cdbaf589c1904b456aebc4772e (diff) | |
parent | 48807b36bcc3d518ed12389e4889e5583fc8d672 (diff) |
Merge "Abort scan before connection" into oc-dev
am: 48807b36bc
Change-Id: I9e41ba1e29d8c43fd4d2b3873b40e65156d05951
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. */ |