use of org.robolectric.shadows.ShadowActivity in project platform_packages_apps_Settings by BlissRoms.
the class SetupFingerprintEnrollIntroductionTest method testCancelClicked_shouldSetIntentDataIfLockScreenAdded.
@Test
public void testCancelClicked_shouldSetIntentDataIfLockScreenAdded() {
getShadowKeyguardManager().setIsKeyguardSecure(false);
SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
final Button skipButton = activity.findViewById(R.id.fingerprint_cancel_button);
getShadowKeyguardManager().setIsKeyguardSecure(true);
skipButton.performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
assertThat(shadowActivity.getResultIntent()).isNotNull();
assertThat(shadowActivity.getResultIntent().hasExtra(SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY)).isTrue();
}
use of org.robolectric.shadows.ShadowActivity in project platform_packages_apps_Settings by BlissRoms.
the class WallpaperSuggestionActivityTest method launch_primarySuggestionActivityDoesNotExist_shouldFallback.
@Test
public void launch_primarySuggestionActivityDoesNotExist_shouldFallback() {
ShadowActivity activity = shadowOf(mController.setup().get());
final Intent intent = activity.getNextStartedActivity();
assertThat(intent.getComponent().getClassName()).isEqualTo(SubSettings.class.getName());
}
use of org.robolectric.shadows.ShadowActivity in project platform_packages_apps_Settings by BlissRoms.
the class ChooseLockSettingsHelperTest method testLaunchConfirmationActivityWithExternalAndChallenge.
@Test
public void testLaunchConfirmationActivityWithExternalAndChallenge() {
final int userId = UserHandle.myUserId();
final int request = 100;
final long challenge = 10000L;
final Activity activity = Robolectric.setupActivity(Activity.class);
ChooseLockSettingsHelper helper = getChooseLockSettingsHelper(activity);
helper.launchConfirmationActivityWithExternalAndChallenge(// request
request, "title", "header", "description", // external
true, challenge, userId);
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(challenge, startedIntent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L));
assertEquals(true, (startedIntent.getFlags() & Intent.FLAG_ACTIVITY_FORWARD_RESULT) != 0);
assertEquals(true, startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.ALLOW_FP_AUTHENTICATION, false));
assertEquals(true, startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.DARK_THEME, false));
assertEquals(true, startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.SHOW_CANCEL_BUTTON, false));
assertEquals(true, startedIntent.getBooleanExtra(ConfirmDeviceCredentialBaseFragment.SHOW_WHEN_LOCKED, false));
}
use of org.robolectric.shadows.ShadowActivity in project platform_packages_apps_Settings by BlissRoms.
the class SetNewPasswordActivityTest method testChooseLockGeneric.
@Test
public void testChooseLockGeneric() {
Settings.Global.putInt(RuntimeEnvironment.application.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 1);
SetNewPasswordActivity activity = Robolectric.buildActivity(SetNewPasswordActivity.class).get();
activity.launchChooseLock(new Bundle());
ShadowActivity shadowActivity = shadowOf(activity);
Intent intent = shadowActivity.getNextStartedActivityForResult().intent;
assertThat(intent.getComponent()).isEqualTo(new ComponentName(activity, ChooseLockGeneric.class));
}
use of org.robolectric.shadows.ShadowActivity in project platform_packages_apps_Settings by BlissRoms.
the class SetNewPasswordActivityTest method testSetupChooseLockGeneric.
@Test
public void testSetupChooseLockGeneric() {
Settings.Global.putInt(RuntimeEnvironment.application.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0);
SetNewPasswordActivity activity = Robolectric.buildActivity(SetNewPasswordActivity.class).get();
activity.launchChooseLock(new Bundle());
ShadowActivity shadowActivity = shadowOf(activity);
Intent intent = shadowActivity.getNextStartedActivityForResult().intent;
assertThat(intent.getComponent()).isEqualTo(new ComponentName(activity, SetupChooseLockGeneric.class));
}
Aggregations