Merge "Remove LockdownButtonPreferenceController from java"
This commit is contained in:
committed by
Android (Google) Code Review
commit
2bc391bb09
@@ -51,24 +51,24 @@ public class LockdownButtonPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mPreference = new SwitchPreference(mContext);
|
||||
|
||||
mController = spy(new LockdownButtonPreferenceController(mContext));
|
||||
mController = spy(new LockdownButtonPreferenceController(mContext, "TestKey"));
|
||||
ReflectionHelpers.setField(mController, "mLockPatternUtils", mLockPatternUtils);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_lockSet_shouldReturnTrue() throws Exception {
|
||||
public void isAvailable_lockSet_shouldReturnTrue() {
|
||||
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isAvailable_lockUnset_shouldReturnFalse() throws Exception {
|
||||
public void isAvailable_lockUnset_shouldReturnFalse() {
|
||||
when(mLockPatternUtils.isSecure(anyInt())).thenReturn(false);
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_settingIsUpdated() throws Exception {
|
||||
public void onPreferenceChange_settingIsUpdated() {
|
||||
boolean state = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.LOCKDOWN_IN_POWER_MENU, 0) != 0;
|
||||
assertThat(mController.onPreferenceChange(mPreference, !state)).isTrue();
|
||||
@@ -78,7 +78,7 @@ public class LockdownButtonPreferenceControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSettingChange_preferenceIsUpdated() throws Exception {
|
||||
public void onSettingChange_preferenceIsUpdated() {
|
||||
boolean state = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
Settings.Secure.LOCKDOWN_IN_POWER_MENU, 0) != 0;
|
||||
mController.updateState(mPreference);
|
||||
|
Reference in New Issue
Block a user