use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FingerprintEnrollFindSensorTest method enrollFingerprint_shouldProceed.
@Test
public void enrollFingerprint_shouldProceed() {
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
enrollmentCallback.onEnrollmentProgress(123);
enrollmentCallback.onEnrollmentError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, "test");
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
IntentForResult startedActivity = shadowActivity.getNextStartedActivityForResult();
assertThat(startedActivity).named("Next activity 1").isNotNull();
assertThat(startedActivity.intent.getComponent()).isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class FingerprintSuggestionActivityTest method testKeyguardSecure_shouldFinishWithFingerprintResultSkip.
@Test
public void testKeyguardSecure_shouldFinishWithFingerprintResultSkip() {
getShadowKeyguardManager().setIsKeyguardSecure(true);
mController.create().resume();
PartnerCustomizationLayout layout = mController.get().findViewById(R.id.setup_wizard_layout);
final Button cancelButton = layout.getMixin(FooterBarMixin.class).getSecondaryButtonView();
assertThat(cancelButton.getText().toString()).isEqualTo("Cancel");
assertThat(cancelButton.getVisibility()).named("Cancel visible").isEqualTo(View.VISIBLE);
cancelButton.performClick();
ShadowActivity shadowActivity = Shadows.shadowOf(mController.get());
assertThat(mController.get().isFinishing()).named("Is finishing").isTrue();
assertThat(shadowActivity.getResultCode()).named("Result code").isEqualTo(Activity.RESULT_CANCELED);
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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();
}
use of org.robolectric.shadows.ShadowActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
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 Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupFingerprintEnrollIntroductionTest method testOnResultFromFindSensor_shouldNotSetIntentDataIfLockScreenNotAdded.
@Test
public void testOnResultFromFindSensor_shouldNotSetIntentDataIfLockScreenNotAdded() {
getShadowKeyguardManager().setIsKeyguardSecure(false);
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()).isNull();
}
Aggregations