Merge "Hide toggle to Turn on Wi-Fi automatically preference in Search settings" into tm-qpr-dev am: 06cc4ed4ab
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/19816198 Change-Id: I6b16ef9121b890647e1ff49ee6e380b8bbdaa832 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.settings.wifi;
|
||||
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
@@ -68,6 +71,41 @@ public class WifiWakeupPreferenceControllerTest {
|
||||
doReturn(true).when(mLocationManager).isLocationEnabled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_fragmentIsNotNull_returnAvailable() {
|
||||
mController.setFragment(mFragment);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_fragmentIsNullAndLocationDisabled_returnDisabled() {
|
||||
mController.setFragment(null);
|
||||
when(mLocationManager.isLocationEnabled()).thenReturn(false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_DEPENDENT_SETTING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailabilityStatus_fragmentIsNullAndWifiScanDisabled_returnDisabled() {
|
||||
mController.setFragment(null);
|
||||
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(false);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_DEPENDENT_SETTING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setChecked_mFragmentIsNullLocationEnable_wifiWakeupEnable() {
|
||||
mController.setFragment(null);
|
||||
when(mLocationManager.isLocationEnabled()).thenReturn(true);
|
||||
when(mWifiManager.isScanAlwaysAvailable()).thenReturn(true);
|
||||
when(mWifiManager.isAutoWakeupEnabled()).thenReturn(false);
|
||||
|
||||
mController.setChecked(true);
|
||||
|
||||
verify(mWifiManager).setAutoWakeupEnabled(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setChecked_scanEnableLocationEnable_wifiWakeupEnable() {
|
||||
when(mWifiManager.isAutoWakeupEnabled()).thenReturn(false);
|
||||
|
Reference in New Issue
Block a user