diff options
author | Rebecca Silberstein <silberst@google.com> | 2017-05-01 22:52:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-01 22:52:07 +0000 |
commit | 710c5c8431be00839e1465a5262a90790969219b (patch) | |
tree | 4daebf62b2820457c388da4120790fab438134f7 /tests | |
parent | 8a0adb85524d01b5a235a9ae95154cbc389d4cf8 (diff) | |
parent | 909ad15e03f4145c444310498dcaf453bebf7f1f (diff) |
WifiServiceImpl: add tethering check for LOHS am: b09edccf20
am: 909ad15e03
Change-Id: I7446cf68df2b6b80f5976aaea96c7490e28afc34
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. */ |