Merge "Remove dead code from settings"

This commit is contained in:
TreeHugger Robot
2019-01-31 19:18:17 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 78 deletions

View File

@@ -141,57 +141,6 @@ public class LocationEnablerTest {
verify(mListener).onLocationModeChanged(anyInt(), anyBoolean());
}
@Test
public void setLocationMode_restricted_shouldSetCurrentMode() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(true);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
verify(mListener).onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, true);
}
@Test
public void setLocationMode_notRestricted_shouldUpdateSecureSettings() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING))
.isEqualTo(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
}
@Test
public void setLocationMode_notRestricted_shouldRefreshLocation() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
verify(mEnabler).refreshLocationMode();
}
@Test
public void setLocationMode_notRestricted_shouldBroadcastUpdateAndSetChanger() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_BATTERY_SAVING);
mEnabler.setLocationMode(Settings.Secure.LOCATION_MODE_HIGH_ACCURACY);
verify(mContext).sendBroadcastAsUser(
argThat(actionMatches(LocationManager.MODE_CHANGING_ACTION)),
eq(UserHandle.of(ActivityManager.getCurrentUser())),
eq(WRITE_SECURE_SETTINGS));
assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCATION_CHANGER, Settings.Secure.LOCATION_CHANGER_UNKNOWN))
.isEqualTo(Settings.Secure.LOCATION_CHANGER_SYSTEM_SETTINGS);
}
@Test
public void setLocationEnabled_notRestricted_shouldRefreshLocation() {
when(mUserManager.hasUserRestriction(anyString())).thenReturn(false);