diff options
author | Ahmed ElArabawy <arabawy@google.com> | 2020-05-31 13:20:35 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-05-31 13:20:35 +0000 |
commit | 3bd823f2ca68e508a8d406a85cdc46e2d905a7e1 (patch) | |
tree | de08b0786dfed400eef75fb8d1554d341b03b0b4 /tests | |
parent | 7c8441932eae9212fae6157d3ca07b480254cee1 (diff) | |
parent | 36ed29992b28fe9e313ec2818dae1b8c7d626f32 (diff) |
Merge "Handle failure in softAp start gracefully" into rvc-dev
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index d91dffbfb..603a4d8f5 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -1324,6 +1324,24 @@ public class WifiServiceImplTest extends WifiBaseTest { } /** + * Verify that startSoftAp() with valid config succeeds after a failed call + */ + @Test + public void testStartSoftApWithValidConfigSucceedsAfterFailure() { + // First initiate a failed call + assertFalse(mWifiServiceImpl.startSoftAp(mApConfig)); + verify(mActiveModeWarden, never()).startSoftAp(any()); + + // Next attempt a valid config + WifiConfiguration config = createValidWifiApConfiguration(); + assertTrue(mWifiServiceImpl.startSoftAp(config)); + verify(mActiveModeWarden).startSoftAp(mSoftApModeConfigCaptor.capture()); + WifiConfigurationTestUtil.assertConfigurationEqualForSoftAp( + config, + mSoftApModeConfigCaptor.getValue().getSoftApConfiguration().toWifiConfiguration()); + } + + /** * Verify caller with proper permission can call startTetheredHotspot. */ @Test @@ -1497,6 +1515,22 @@ public class WifiServiceImplTest extends WifiBaseTest { } /** + * Verify a valied call to startTetheredHotspot succeeds after a failed call. + */ + @Test + public void testStartTetheredHotspotWithValidConfigSucceedsAfterFailedCall() { + // First issue an invalid call + assertFalse(mWifiServiceImpl.startTetheredHotspot( + new SoftApConfiguration.Builder().build())); + verify(mActiveModeWarden, never()).startSoftAp(any()); + + // Now attempt a successful call + assertTrue(mWifiServiceImpl.startTetheredHotspot(null)); + verify(mActiveModeWarden).startSoftAp(mSoftApModeConfigCaptor.capture()); + assertNull(mSoftApModeConfigCaptor.getValue().getSoftApConfiguration()); + } + + /** * Verify caller with proper permission can call stopSoftAp. */ @Test |