use of org.robolectric.shadows.ShadowContentResolver in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrateWhenRingPreferenceControllerTest method testObserver_onPause_shouldUnregisterObserver.
@Test
public void testObserver_onPause_shouldUnregisterObserver() {
final ShadowContentResolver shadowContentResolver = Shadow.extract(mContentResolver);
mController.displayPreference(mScreen);
mController.onResume();
mController.onPause();
assertThat(shadowContentResolver.getContentObservers(Settings.System.getUriFor(VIBRATE_WHEN_RINGING))).isEmpty();
}
use of org.robolectric.shadows.ShadowContentResolver in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class VibrateWhenRingPreferenceControllerTest method testObserver_onResume_shouldRegisterObserver.
@Test
public void testObserver_onResume_shouldRegisterObserver() {
final ShadowContentResolver shadowContentResolver = Shadow.extract(mContentResolver);
mController.displayPreference(mScreen);
mController.onResume();
assertThat(shadowContentResolver.getContentObservers(Settings.System.getUriFor(VIBRATE_WHEN_RINGING))).isNotEmpty();
}
use of org.robolectric.shadows.ShadowContentResolver in project android_packages_apps_Settings by omnirom.
the class BrightnessLevelPreferenceControllerTest method onStart_shouldRegisterObserver.
@Test
public void onStart_shouldRegisterObserver() {
BrightnessLevelPreferenceController controller = new BrightnessLevelPreferenceController(mContext, null);
ShadowContentResolver shadowContentResolver = Shadow.extract(mContentResolver);
controller.onStart();
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 AmazeFileManager by TeamAmaze.
the class TextEditorActivityTest method testOpenContentUri.
@Test
public void testOpenContentUri() throws Exception {
Uri uri = Uri.parse("content://foo.bar.test.streamprovider/temp/thisisatest.txt");
ContentResolver contentResolver = ApplicationProvider.getApplicationContext().getContentResolver();
ShadowContentResolver shadowContentResolver = Shadows.shadowOf(contentResolver);
shadowContentResolver.registerInputStream(uri, new ByteArrayInputStream(fileContents.getBytes("UTF-8")));
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setType("text/plain");
intent.setData(uri);
generateActivity(intent);
assertEquals(fileContents, text.getText().toString().trim());
}
use of org.robolectric.shadows.ShadowContentResolver in project AmazeFileManager by TeamAmaze.
the class TestArchives method readArchive.
private static void readArchive(Context context, String type) {
try {
Uri uri = Uri.parse("content://foo.bar.test.streamprovider/temp/test-archive." + type);
ContentResolver contentResolver = context.getContentResolver();
ShadowContentResolver shadowContentResolver = Shadows.shadowOf(contentResolver);
shadowContentResolver.registerInputStream(uri, new ByteArrayInputStream(readArchive(type)));
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations