summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java18
1 files changed, 18 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 abf533d1f..8a2ceaf08 100644
--- a/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/SupplicantStaIfaceHalTest.java
@@ -501,6 +501,24 @@ public class SupplicantStaIfaceHalTest {
}
/**
+ * Tests connection to a specified network failure due to exception in network save.
+ */
+ @Test
+ public void testConnectFailureDueToNetworkSaveException() throws Exception {
+ executeAndValidateInitializationSequence();
+ setupMocksForConnectSequence(true);
+
+ doThrow(new IllegalArgumentException("Some error!!!"))
+ .when(mSupplicantStaNetworkMock).saveWifiConfiguration(
+ any(WifiConfiguration.class));
+
+ assertFalse(mDut.connectToNetwork(new WifiConfiguration(), false));
+ // We should have removed the existing network once before connection and once more
+ // on failure to save network configuration.
+ verify(mISupplicantStaIfaceMock, times(2)).removeNetwork(anyInt());
+ }
+
+ /**
* Tests connection to a specified network failure due to network select.
*/
@Test