summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNingyuan Wang <nywang@google.com>2017-05-24 17:59:03 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-05-24 17:59:03 +0000
commit9158c11a7af31aef7f1c115af53949397208bddc (patch)
treeed7a9f20d63075a517a3f9eb7a2edea96621794b /tests
parent4ebb0d3daedb29cb47ec34f670e97580d41e2dcc (diff)
parentb4a6453d37b24671a586508a66d1f3cd456d5f30 (diff)
Merge "Abort scan before connection" into oc-dev am: 48807b36bc
am: b4a6453d37 Change-Id: I106ba573c782c1a29633e622fe54b5fa51fb3f30
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java26
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WificondControlTest.java11
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.
*/