summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java22
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WificondControlTest.java25
-rw-r--r--tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java23
3 files changed, 70 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
index e0e296fa5..d3f044f83 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
@@ -272,6 +272,19 @@ public class SupplicantStaIfaceHalTest {
}
/**
+ * Ensures that reject addition of an existing iface.
+ */
+ @Test
+ public void testDuplicateSetupIfaceV1_1_Fails() throws Exception {
+ mISupplicantMockV1_1 = mock(android.hardware.wifi.supplicant.V1_1.ISupplicant.class);
+ executeAndValidateInitializationSequenceV1_1(false, false);
+
+ // Trying setting up the wlan0 interface again & ensure it fails.
+ assertFalse(mDut.setupIface(WLAN0_IFACE_NAME));
+ verifyNoMoreInteractions(mISupplicantMockV1_1);
+ }
+
+ /**
* Sunny day scenario for SupplicantStaIfaceHal interface teardown.
*/
@Test
@@ -301,6 +314,15 @@ public class SupplicantStaIfaceHalTest {
}
/**
+ * Ensures that we reject removal of an invalid iface.
+ */
+ @Test
+ public void testInvalidTeardownInterfaceV1_1_Fails() throws Exception {
+ assertFalse(mDut.teardownIface(WLAN0_IFACE_NAME));
+ verifyNoMoreInteractions(mISupplicantMock);
+ }
+
+ /**
* Sunny day scenario for SupplicantStaIfaceHal initialization
* Asserts successful initialization of second interface
*/
diff --git a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
index bcb03b39a..8336c03eb 100644
--- a/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WificondControlTest.java
@@ -251,6 +251,19 @@ public class WificondControlTest {
* Verifies that tearDownClientInterface(TEST_INTERFACE_NAME) calls Wificond.
*/
@Test
+ public void testTeardownClientInterfaceOnInvalidIface() throws Exception {
+ when(mWificond.tearDownClientInterface(TEST_INTERFACE_NAME1)).thenReturn(true);
+
+ assertFalse(mWificondControl.tearDownClientInterface(TEST_INTERFACE_NAME1));
+ verify(mWifiScannerImpl, never()).unsubscribeScanEvents();
+ verify(mWifiScannerImpl, never()).unsubscribePnoScanEvents();
+ verify(mWificond, never()).tearDownClientInterface(any());
+ }
+
+ /**
+ * Verifies that tearDownClientInterface(TEST_INTERFACE_NAME) calls Wificond.
+ */
+ @Test
public void testTeardownClientInterfaceFailDueToExceptionScannerUnsubscribe() throws Exception {
when(mWificond.tearDownClientInterface(TEST_INTERFACE_NAME)).thenReturn(true);
doThrow(new RemoteException()).when(mWifiScannerImpl).unsubscribeScanEvents();
@@ -349,6 +362,18 @@ public class WificondControlTest {
}
/**
+ * Verifies that tearDownSoftapInterface(TEST_INTERFACE_NAME) calls Wificond.
+ */
+ @Test
+ public void testTeardownSoftApInterfaceOnInvalidIface() throws Exception {
+ testSetupInterfaceForSoftApMode();
+ when(mWificond.tearDownApInterface(TEST_INTERFACE_NAME1)).thenReturn(true);
+
+ assertFalse(mWificondControl.tearDownSoftApInterface(TEST_INTERFACE_NAME1));
+ verify(mWificond, never()).tearDownApInterface(any());
+ }
+
+ /**
* Verifies that tearDownClientInterface(TEST_INTERFACE_NAME) calls Wificond.
*/
@Test
diff --git a/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java b/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java
index 33dd4a659..cda1aae83 100644
--- a/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java
@@ -23,6 +23,7 @@ import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import android.app.test.MockAnswerUtil.AnswerWithArguments;
@@ -263,6 +264,19 @@ public class SupplicantP2pIfaceHalTest {
}
/**
+ * Ensures that reject addition of an existing iface.
+ */
+ @Test
+ public void testDuplicateSetupIfaceV1_1_Fails() throws Exception {
+ mISupplicantMockV1_1 = mock(android.hardware.wifi.supplicant.V1_1.ISupplicant.class);
+ executeAndValidateInitializationSequenceV1_1(false, false);
+
+ // Trying setting up the p2p0 interface again & ensure it fails.
+ assertFalse(mDut.setupIface(mIfaceName));
+ verifyNoMoreInteractions(mISupplicantMockV1_1);
+ }
+
+ /**
* Sunny day scenario for SupplicantStaIfaceHal teardown.
* Asserts successful teardown.
* Note: Only applicable for 1.1 supplicant HAL.
@@ -279,6 +293,15 @@ public class SupplicantP2pIfaceHalTest {
}
/**
+ * Ensures that we reject removal of an invalid iface.
+ */
+ @Test
+ public void testInvalidTeardownInterfaceV1_1_Fails() throws Exception {
+ assertFalse(mDut.teardownIface(mIfaceName));
+ verifyNoMoreInteractions(mISupplicantMock);
+ }
+
+ /**
* Sunny day scenario for getName()
*/
@Test