diff options
author | Roshan Pius <rpius@google.com> | 2018-02-15 13:53:55 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2018-03-06 16:21:36 -0800 |
commit | 18e1cad59b89b501c3c0c96188fcf62cd7884744 (patch) | |
tree | 073d8740090928dd9097954cd65c7261c64341fc /tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java | |
parent | a2e62c7f5bfb411ccead4eab0d435d50fcdd4909 (diff) | |
download | android_frameworks_opt_net_wifi-18e1cad59b89b501c3c0c96188fcf62cd7884744.tar.gz android_frameworks_opt_net_wifi-18e1cad59b89b501c3c0c96188fcf62cd7884744.tar.bz2 android_frameworks_opt_net_wifi-18e1cad59b89b501c3c0c96188fcf62cd7884744.zip |
SupplicantStaIfaceHal: Always check for existing ifaces
Couple of methods in SupplicantStaIfaceHal are missing checks to ensure
if the iface specified exists or not. Adding them.
Bug: 73496702
Test: Unit tests
Change-Id: I7e7f37683c8da60723dfa84f60c12e27538b7866
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java | 22 |
1 files changed, 22 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 */ |