summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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.
*/