summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2018-03-06 16:21:56 -0800
committerRoshan Pius <rpius@google.com>2018-03-06 16:23:25 -0800
commit271fee2404caf4ef62a0ec17afbab24cfa0a895e (patch)
tree193db30a2177aa64a44e31a1c71a92a70eb9b316 /tests
parent18e1cad59b89b501c3c0c96188fcf62cd7884744 (diff)
SupplicantP2pIfaceHal: Always check for existing ifaces
Couple of methods in SupplicantP2pIfaceHal are missing checks to ensure if the iface specified exists or not. Adding them. Bug: 73496702 Test: Unit tests Change-Id: I86b0efdb099b58089f017b97508da4ec6aec5d65
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/p2p/SupplicantP2pIfaceHalTest.java23
1 files changed, 23 insertions, 0 deletions
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