use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceContextualCardControllerTest method onDismissed_feedbackDisabled_shouldNotShowFeedbackDialog.
@Test
public void onDismissed_feedbackDisabled_shouldNotShowFeedbackDialog() {
mResolver.insert(CardContentProvider.REFRESH_CARD_URI, generateOneRow());
final ContextualCardsFragment fragment = FragmentController.of(new ContextualCardsFragment()).create().get();
final ShadowActivity shadowActivity = Shadows.shadowOf(fragment.getActivity());
doReturn(false).when(mController).isFeedbackEnabled(anyString());
mController.onDismissed(getTestSliceCard());
assertThat(shadowActivity.getNextStartedActivity()).isNull();
}
use of org.robolectric.shadows.ShadowActivity in project DeepLinkDispatch by airbnb.
the class MainActivityTest method testIntentViaMethodResult.
@Test
public void testIntentViaMethodResult() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("dld://host/methodResult/intent"));
DeepLinkActivity deepLinkActivity = Robolectric.buildActivity(DeepLinkActivity.class, intent).create().get();
ShadowActivity shadowActivity = shadowOf(deepLinkActivity);
Intent launchedIntent = shadowActivity.peekNextStartedActivityForResult().intent;
assertThat(launchedIntent.getComponent(), equalTo(new ComponentName(deepLinkActivity, SecondActivity.class)));
assertThat(launchedIntent.getBooleanExtra(DeepLink.IS_DEEP_LINK, false), equalTo(true));
assertThat(launchedIntent.getAction(), equalTo(MainActivity.ACTION_DEEP_LINK_INTENT));
}
use of org.robolectric.shadows.ShadowActivity in project DeepLinkDispatch by airbnb.
the class MainActivityTest method testQueryParams.
@Test
public void testQueryParams() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("dld://classDeepLink?foo=bar"));
DeepLinkActivity deepLinkActivity = Robolectric.buildActivity(DeepLinkActivity.class, intent).create().get();
ShadowActivity shadowActivity = shadowOf(deepLinkActivity);
Intent launchedIntent = shadowActivity.peekNextStartedActivityForResult().intent;
assertThat(launchedIntent.getComponent(), equalTo(new ComponentName(deepLinkActivity, MainActivity.class)));
assertThat(launchedIntent.getBooleanExtra(DeepLink.IS_DEEP_LINK, false), equalTo(true));
assertThat(launchedIntent.getStringExtra("foo"), equalTo("bar"));
assertThat(launchedIntent.getAction(), equalTo(Intent.ACTION_VIEW));
assertThat(launchedIntent.getStringExtra(DeepLink.URI), equalTo("dld://classDeepLink?foo=bar"));
}
use of org.robolectric.shadows.ShadowActivity in project DeepLinkDispatch by airbnb.
the class MainActivityTest method testNullIntent.
@Test
public void testNullIntent() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("dld://host/intent/null"));
DeepLinkActivity deepLinkActivity = Robolectric.buildActivity(DeepLinkActivity.class, intent).create().get();
ShadowActivity shadowActivity = shadowOf(deepLinkActivity);
assertNull(shadowActivity.peekNextStartedActivityForResult());
}
use of org.robolectric.shadows.ShadowActivity in project DeepLinkDispatch by airbnb.
the class MainActivityTest method testNullDeepLinkMethodResult.
@Test
public void testNullDeepLinkMethodResult() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("dld://host/methodResult/null"));
DeepLinkActivity deepLinkActivity = Robolectric.buildActivity(DeepLinkActivity.class, intent).create().get();
ShadowActivity shadowActivity = shadowOf(deepLinkActivity);
assertNull(shadowActivity.peekNextStartedActivityForResult());
}
Aggregations