diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 15 |
1 files changed, 15 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 1553f3a7e..3c8c9f03a 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -25,6 +25,7 @@ import static com.android.server.wifi.WifiController.CMD_WIFI_TOGGLED; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; @@ -701,6 +702,7 @@ public class WifiServiceImplTest { // allow test to proceed without a permission check failure when(mSettingsStore.getLocationModeSetting(mContext)) .thenReturn(LOCATION_MODE_HIGH_ACCURACY); + when(mWifiStateMachine.syncGetWifiApState()).thenReturn(WifiManager.WIFI_AP_STATE_DISABLED); mWifiServiceImpl.startLocalOnlyHotspot(mAppMessenger, mAppBinder); } @@ -740,6 +742,19 @@ public class WifiServiceImplTest { } /** + * Only start LocalOnlyHotspot if we are not tethering. + */ + @Test + public void testHotspotDoesNotStartWhenAlreadyTethering() { + when(mSettingsStore.getLocationModeSetting(mContext)) + .thenReturn(LOCATION_MODE_HIGH_ACCURACY); + when(mWifiStateMachine.syncGetWifiApState()).thenReturn(WifiManager.WIFI_AP_STATE_ENABLED); + WifiConfiguration hotspotConfig = + mWifiServiceImpl.startLocalOnlyHotspot(mAppMessenger, mAppBinder); + assertNull(hotspotConfig); + } + + /** * Verify that the call to stopLocalOnlyHotspot throws the UnsupportedOperationException until * the implementation is complete. */ |