use of org.robolectric.shadows.ShadowActivity in project android_packages_apps_Settings by omnirom.
the class SetupFingerprintEnrollIntroductionTest method testLockPattern.
@Test
public void testLockPattern() {
ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
mController.create().postCreate(null).resume();
SetupFingerprintEnrollIntroduction activity = mController.get();
PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
layout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
IntentForResult startedActivity = shadowActivity.getNextStartedActivityForResult();
assertThat(startedActivity).isNotNull();
assertThat(startedActivity.intent.hasExtra(SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY)).isFalse();
}
use of org.robolectric.shadows.ShadowActivity in project android_packages_apps_Settings by omnirom.
the class SetupFingerprintEnrollIntroductionTest method testKeyguardNotSecure_shouldFinishWithSetupSkipDialogResultSkip.
@Test
public void testKeyguardNotSecure_shouldFinishWithSetupSkipDialogResultSkip() {
getShadowKeyguardManager().setIsKeyguardSecure(false);
mController.create().resume();
PartnerCustomizationLayout layout = mController.get().findViewById(R.id.setup_wizard_layout);
final Button skipButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
assertWithMessage("Skip visible").that(skipButton.getVisibility()).isEqualTo(View.VISIBLE);
skipButton.performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(mController.get());
assertWithMessage("Is finishing").that(mController.get().isFinishing()).isTrue();
assertWithMessage("Result code").that(shadowActivity.getResultCode()).isEqualTo(SetupSkipDialog.RESULT_SKIP);
}
use of org.robolectric.shadows.ShadowActivity in project android_packages_apps_Settings by omnirom.
the class SetupFingerprintEnrollIntroductionTest method testBackKeyPress_shouldSetIntentDataIfLockScreenAdded.
@Test
public void testBackKeyPress_shouldSetIntentDataIfLockScreenAdded() {
getShadowKeyguardManager().setIsKeyguardSecure(false);
mController.create().resume();
getShadowKeyguardManager().setIsKeyguardSecure(true);
SetupFingerprintEnrollIntroduction activity = mController.get();
activity.onBackPressed();
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 android_packages_apps_Settings by omnirom.
the class SetupFingerprintEnrollIntroductionTest method testCancelClicked_shouldSetIntentDataIfLockScreenAdded.
@Test
public void testCancelClicked_shouldSetIntentDataIfLockScreenAdded() {
getShadowKeyguardManager().setIsKeyguardSecure(false);
SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
PartnerCustomizationLayout layout = activity.findViewById(R.id.setup_wizard_layout);
final Button skipButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
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 android_packages_apps_Settings by omnirom.
the class SetupFingerprintEnrollIntroductionTest method testOnResultFromFindSensor_shouldNotSetIntentDataIfLockScreenPresentBeforeLaunch.
@Test
public void testOnResultFromFindSensor_shouldNotSetIntentDataIfLockScreenPresentBeforeLaunch() {
getShadowKeyguardManager().setIsKeyguardSecure(true);
SetupFingerprintEnrollIntroduction activity = mController.create().resume().get();
activity.onActivityResult(BiometricEnrollIntroduction.BIOMETRIC_FIND_SENSOR_REQUEST, BiometricEnrollBase.RESULT_FINISHED, null);
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
assertThat(shadowActivity.getResultIntent()).isNotNull();
assertThat(shadowActivity.getResultIntent().hasExtra(SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY)).isFalse();
}
Aggregations