Fix LocationForWorkPreferenceControllerTest
* If the location is disabled by admin, then the
preference is disabled and the toggle is no
longer shown. This means that setChecked is no
longer called and the verify statement can be removed.
* If the location is off, the summary should be
'Location is off' rather than 'off'. The verify
statement is now updated with the correct summary.
Bug: 148755845
Test: atest com.android.settings.location.LocationForWorkPreferenceControllerTest
Change-Id: I089be0c4f8e8ec8c10160771055730289d72c8ed
diff --git a/tests/robotests/src/com/android/settings/location/LocationForWorkPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/location/LocationForWorkPreferenceControllerTest.java
index 4b0df98..b4bda14 100644
--- a/tests/robotests/src/com/android/settings/location/LocationForWorkPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/location/LocationForWorkPreferenceControllerTest.java
@@ -38,7 +38,6 @@
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -114,7 +113,6 @@
}
@Test
- @Ignore
public void onLocationModeChanged_disabledByAdmin_shouldDisablePreference() {
mController.displayPreference(mScreen);
final EnforcedAdmin admin = mock(EnforcedAdmin.class);
@@ -124,11 +122,9 @@
mController.onLocationModeChanged(Settings.Secure.LOCATION_MODE_BATTERY_SAVING, false);
verify(mPreference).setDisabledByAdmin(any());
- verify(mPreference).setChecked(false);
}
@Test
- @Ignore
public void onLocationModeChanged_locationOff_shouldDisablePreference() {
mController.displayPreference(mScreen);
doReturn(null).when(mEnabler).getShareLocationEnforcedAdmin(anyInt());
@@ -138,7 +134,7 @@
verify(mPreference).setEnabled(false);
verify(mPreference).setChecked(false);
- verify(mPreference).setSummary(R.string.switch_off_text);
+ verify(mPreference).setSummary(R.string.location_app_permission_summary_location_off);
}
@Test