Wake notifications to TogglePreferenceController
Convert Wake for new notifications to TogglePreferenceController Because Slice controller only support Constructor(context) Move other parameter to setAmbientDisplayConfiguration Change-Id: I01042b84217ad9592fece966374140dffaf813e4 Fixes:67997460 Test: make RunSettingsRoboTests -j
This commit is contained in:
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
|
||||
@@ -44,6 +45,7 @@ import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
import org.robolectric.util.ReflectionHelpers;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(shadows = ShadowSecureSettings.class)
|
||||
@@ -67,8 +69,10 @@ public class AmbientDisplayNotificationsPreferenceControllerTest {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mContentResolver = mContext.getContentResolver();
|
||||
mController = new AmbientDisplayNotificationsPreferenceController(mContext, mConfig,
|
||||
mMetricsFeatureProvider);
|
||||
mController = new AmbientDisplayNotificationsPreferenceController(mContext,
|
||||
AmbientDisplayNotificationsPreferenceController.KEY_AMBIENT_DISPLAY_NOTIFICATIONS);
|
||||
mController.setConfig(mConfig);
|
||||
ReflectionHelpers.setField(mController, "mMetricsFeatureProvider", mMetricsFeatureProvider);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -119,6 +123,20 @@ public class AmbientDisplayNotificationsPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_checked_shouldReturnTrue() {
|
||||
when(mConfig.pulseOnNotificationEnabled(UserHandle.myUserId())).thenReturn(true);
|
||||
|
||||
assertThat(mController.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isChecked_checked_shouldReturnFalse() {
|
||||
when(mConfig.pulseOnNotificationEnabled(UserHandle.myUserId())).thenReturn(false);
|
||||
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void handlePreferenceTreeClick_reportsEventForItsPreference() {
|
||||
when(mSwitchPreference.getKey()).thenReturn(
|
||||
|
Reference in New Issue
Block a user