use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LocalePickerWithRegionActivityTest method onLocaleSelected_resultShouldBeOK.
@Test
public void onLocaleSelected_resultShouldBeOK() {
final ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
mActivity.onLocaleSelected(mock(LocaleStore.LocaleInfo.class));
assertEquals(Activity.RESULT_OK, shadowActivity.getResultCode());
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseLockSettingsHelperTest method testLaunchConfirmationActivity_internal_shouldPropagateTheme.
@Test
public void testLaunchConfirmationActivity_internal_shouldPropagateTheme() {
Intent intent = new Intent().putExtra(WizardManagerHelper.EXTRA_THEME, ThemeHelper.THEME_GLIF_V2);
Activity activity = Robolectric.buildActivity(Activity.class, intent).get();
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(activity);
helper.launchConfirmationActivity(123, "test title", true, 0);
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
IntentForResult startedActivity = shadowActivity.getNextStartedActivityForResult();
assertThat(startedActivity.requestCode).isEqualTo(123);
assertThat(startedActivity.intent.getStringExtra(WizardManagerHelper.EXTRA_THEME)).isEqualTo(ThemeHelper.THEME_GLIF_V2);
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseLockSettingsHelperTest method testLaunchConfirmationActivityWithExternalAndChallenge.
@Test
public void testLaunchConfirmationActivityWithExternalAndChallenge() {
final Activity activity = Robolectric.setupActivity(Activity.class);
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(activity);
helper.launchConfirmationActivityWithExternalAndChallenge(// request
100, "title", "header", "description", // external
true, 10000L, UserHandle.myUserId());
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
assertEquals(new ComponentName("com.android.settings", ConfirmLockPattern.InternalActivity.class.getName()), startedIntent.getComponent());
assertFalse(startedIntent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false));
assertTrue(startedIntent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false));
assertEquals(10000L, startedIntent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L));
assertTrue((startedIntent.getFlags() & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0);
assertFalse(startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.DARK_THEME, false));
assertFalse(startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.SHOW_CANCEL_BUTTON, false));
assertTrue(startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.SHOW_WHEN_LOCKED, false));
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseLockSettingsHelperTest method testLaunchConfirmationActivityInternalAndChallenge.
@Test
public void testLaunchConfirmationActivityInternalAndChallenge() {
final Activity activity = Robolectric.setupActivity(Activity.class);
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(activity);
helper.launchConfirmationActivityWithExternalAndChallenge(100, "title", "header", "description", // external
false, 10000L, UserHandle.myUserId());
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
Intent startedIntent = shadowActivity.getNextStartedActivity();
assertEquals(new ComponentName("com.android.settings", ConfirmLockPattern.InternalActivity.class.getName()), startedIntent.getComponent());
assertFalse(startedIntent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_RETURN_CREDENTIALS, false));
assertTrue(startedIntent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false));
assertEquals(10000L, startedIntent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L));
assertFalse((startedIntent.getFlags() & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0);
assertFalse(startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.DARK_THEME, false));
assertFalse(startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.SHOW_CANCEL_BUTTON, false));
assertFalse(startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.SHOW_WHEN_LOCKED, false));
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupChooseLockGenericTest method setupChooseLockGenericPasswordComplexityExtraWithoutPermission.
@Test
public void setupChooseLockGenericPasswordComplexityExtraWithoutPermission() {
Intent intent = new Intent("com.android.settings.SETUP_LOCK_SCREEN");
intent.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_HIGH);
SetupChooseLockGeneric activity = Robolectric.buildActivity(SetupChooseLockGeneric.class, intent).create().get();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
assertThat(shadowActivity.isFinishing()).isTrue();
}
Aggregations