use of android.app.Instrumentation.ActivityResult in project android_packages_apps_Settings by omnirom.
the class FingerprintEnrollFinishTest method clickAddAnother_shouldPropagateResults.
@Test
public void clickAddAnother_shouldPropagateResults() {
final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_OK, null));
onView(withId(R.id.add_another_button)).perform(click());
intended(hasComponent(enrollingComponent));
assertTrue(mActivityRule.getActivity().isFinishing());
}
use of android.app.Instrumentation.ActivityResult in project orgzly-android by orgzly.
the class BooksTest method testExportWithFakeResponse.
@Test
public void testExportWithFakeResponse() {
// Only if DocumentsProvider is supported
assumeTrue(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT);
onBook(0).perform(longClick());
openContextualToolbarOverflowMenu();
Intents.init();
// Response to get after app sends Intent.ACTION_CREATE_DOCUMENT
Intent resultData = new Intent();
File file = new File(context.getCacheDir(), "book-1.org");
resultData.setData(DocumentFile.fromFile(file).getUri());
ActivityResult result = new ActivityResult(Activity.RESULT_OK, resultData);
intending(hasAction(Intent.ACTION_CREATE_DOCUMENT)).respondWith(result);
// Perform export
onView(withText(R.string.export)).perform(click());
// Check that app has sent intent
intended(allOf(hasAction(Intent.ACTION_CREATE_DOCUMENT), hasExtra(Intent.EXTRA_TITLE, "book-1.org")));
// Check that file was exported.
onSnackbar().check(matches(withText(startsWith(context.getString(R.string.book_exported, "")))));
// Delete exported file
file.delete();
Intents.release();
}
use of android.app.Instrumentation.ActivityResult in project android_packages_apps_Settings by SudaMod.
the class FingerprintEnrollFinishTest method clickAddAnother_shouldPropagateResults.
@Test
public void clickAddAnother_shouldPropagateResults() {
final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_OK, null));
onView(withId(R.id.add_another_button)).perform(click());
intended(hasComponent(enrollingComponent));
assertTrue(mActivityRule.getActivity().isFinishing());
}
use of android.app.Instrumentation.ActivityResult in project android_packages_apps_Settings by SudaMod.
the class FingerprintEnrollFinishTest method clickAddAnother_shouldLaunchEnrolling.
@Test
public void clickAddAnother_shouldLaunchEnrolling() {
final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_CANCELED, null));
onView(withId(R.id.add_another_button)).perform(click());
intended(hasComponent(enrollingComponent));
assertFalse(mActivityRule.getActivity().isFinishing());
}
use of android.app.Instrumentation.ActivityResult in project android_packages_apps_Settings by crdroidandroid.
the class FingerprintEnrollFinishTest method clickAddAnother_shouldPropagateResults.
@Test
public void clickAddAnother_shouldPropagateResults() {
final ComponentName enrollingComponent = new ComponentName(getTargetContext(), FingerprintEnrollEnrolling.class);
intending(hasComponent(enrollingComponent)).respondWith(new ActivityResult(Activity.RESULT_OK, null));
onView(withId(R.id.add_another_button)).perform(click());
intended(hasComponent(enrollingComponent));
assertTrue(mActivityRule.getActivity().isFinishing());
}
Aggregations