use of org.robolectric.shadows.ShadowContentResolver in project platform_packages_apps_Settings by BlissRoms.
the class BrightnessLevelPreferenceControllerTest method onStop_shouldUnregisterObserver.
@Test
public void onStop_shouldUnregisterObserver() {
Context context = RuntimeEnvironment.application;
BrightnessLevelPreferenceController controller = new BrightnessLevelPreferenceController(context, null, mPowerManager);
ShadowContentResolver shadowContentResolver = (ShadowContentResolver) ShadowExtractor.extract(context.getContentResolver());
controller.displayPreference(mScreen);
controller.onStart();
controller.onStop();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS_MODE))).isEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS))).isEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS_FOR_VR))).isEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_AUTO_BRIGHTNESS_ADJ))).isEmpty();
}
use of org.robolectric.shadows.ShadowContentResolver in project platform_packages_apps_Settings by BlissRoms.
the class BrightnessLevelPreferenceControllerTest method onStart_shouldRegisterObserver.
@Test
public void onStart_shouldRegisterObserver() {
Context context = RuntimeEnvironment.application;
BrightnessLevelPreferenceController controller = new BrightnessLevelPreferenceController(context, null, mPowerManager);
ShadowContentResolver shadowContentResolver = (ShadowContentResolver) ShadowExtractor.extract(context.getContentResolver());
controller.onStart();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS_MODE))).isNotEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS))).isNotEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS_FOR_VR))).isNotEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_AUTO_BRIGHTNESS_ADJ))).isNotEmpty();
}
use of org.robolectric.shadows.ShadowContentResolver in project android_packages_apps_Settings by omnirom.
the class BrightnessLevelPreferenceControllerTest method onStop_shouldUnregisterObserver.
@Test
public void onStop_shouldUnregisterObserver() {
BrightnessLevelPreferenceController controller = new BrightnessLevelPreferenceController(mContext, null);
ShadowContentResolver shadowContentResolver = Shadow.extract(mContext.getContentResolver());
controller.displayPreference(mScreen);
controller.onStart();
controller.onStop();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_BRIGHTNESS_FOR_VR_FLOAT))).isEmpty();
assertThat(shadowContentResolver.getContentObservers(System.getUriFor(System.SCREEN_AUTO_BRIGHTNESS_ADJ))).isEmpty();
}
Aggregations