Expose the notification-swipe controls.

Bug: 62022517
Test: Settings robotest
Change-Id: I41368a9e03f38052bb47d04f6b98d56808d07e48
This commit is contained in:
Daniel Nishi
2017-08-08 17:29:46 -07:00
parent a8db5ccea8
commit f89327aa88
2 changed files with 16 additions and 59 deletions

View File

@@ -129,46 +129,6 @@ public class SwipeToNotificationPreferenceControllerTest {
assertThat(mController.isSwitchPrefEnabled()).isFalse();
}
@Test
public void testPreferenceController_ProperResultPayloadType() {
when(mContext.getResources().
getBoolean(com.android.internal.R.bool.config_supportSystemNavigationKeys))
.thenReturn(true);
SwipeToNotificationPreferenceController controller =
new SwipeToNotificationPreferenceController(mContext, null /* lifecycle */,
SYSTEM_NAVIGATION_KEYS_ENABLED);
ResultPayload payload = controller.getResultPayload();
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
}
@Test
@Config(shadows = ShadowSecureSettings.class)
public void testSetValue_updatesCorrectly() {
int newValue = 1;
ContentResolver resolver = mContext.getContentResolver();
Settings.Secure.putInt(resolver, Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, 0);
((InlinePayload) mController.getResultPayload()).setValue(mContext, newValue);
int updatedValue = Settings.Secure.getInt(resolver,
Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, -1);
assertThat(updatedValue).isEqualTo(newValue);
}
@Test
@Config(shadows = ShadowSecureSettings.class)
public void testGetValue_correctValueReturned() {
int currentValue = 1;
ContentResolver resolver = mContext.getContentResolver();
Settings.Secure.putInt(resolver,
Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, currentValue);
int newValue = ((InlinePayload) mController.getResultPayload()).getValue(mContext);
assertThat(newValue).isEqualTo(currentValue);
}
private void stubFingerprintSupported(boolean enabled) {
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
.thenReturn(enabled);