Java Code Examples for org.robolectric.shadows.ShadowActivity#getNextStartedActivityForResult()
The following examples show how to use
org.robolectric.shadows.ShadowActivity#getNextStartedActivityForResult() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormRecordListActivityTest.java From commcare-android with Apache License 2.0 | 6 votes |
private static void launchFormEntryForSavedForm(ShadowActivity homeActivityShadow, Intent savedFormsIntent, FormRecordListActivity savedFormsActivity) { ShadowActivity formRecordShadow = Shadows.shadowOf(savedFormsActivity); homeActivityShadow.receiveResult(savedFormsIntent, formRecordShadow.getResultCode(), formRecordShadow.getResultIntent()); ShadowActivity.IntentForResult formEntryIntent = homeActivityShadow.getNextStartedActivityForResult(); Robolectric.buildActivity(FormEntryActivity.class, formEntryIntent.intent) .create().start().resume().get(); Robolectric.flushBackgroundThreadScheduler(); Robolectric.flushForegroundThreadScheduler(); assertNotNull(FormEntryActivity.mFormController); }
Example 2
Source File: BaseFragmentActivityTest.java From edx-app-android with Apache License 2.0 | 5 votes |
/** * Generic method for asserting next started activity along with * the custom transition animation override * * @param currentActivity The current activity * @param nextActivityClass The class of the newly started activity * @param requestCode The request code */ protected Intent assertNextStartedActivityForResult( BaseFragmentActivity currentActivity, Class<? extends Activity> nextActivityClass, int requestCode) { ShadowActivity shadowActivity = Shadows.shadowOf(currentActivity); ShadowActivity.IntentForResult intentForResult = shadowActivity.getNextStartedActivityForResult(); assertNotNull(intentForResult); assertThat(intentForResult.intent).hasComponent( currentActivity, nextActivityClass); assertEquals(requestCode, intentForResult.requestCode); return intentForResult.intent; }
Example 3
Source File: FormRecordListActivityTest.java From commcare-android with Apache License 2.0 | 5 votes |
private static ShadowActivity prepSavedFormsActivity(Intent savedFormsIntent) { StandardHomeActivity homeActivity = Robolectric.buildActivity(StandardHomeActivity.class).create().get(); ShadowActivity homeActivityShadow = Shadows.shadowOf(homeActivity); homeActivity.startActivityForResult(savedFormsIntent, StandardHomeActivity.GET_INCOMPLETE_FORM); // Call this to remove activity from stack, so we can access future activities... homeActivityShadow.getNextStartedActivityForResult(); return homeActivityShadow; }