Search in sources :

Example 21 with EnrollmentCallback

use of android.hardware.fingerprint.FingerprintManager.EnrollmentCallback in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FingerprintEnrollFindSensorTest method enrollFingerprintTwice_shouldStartOneEnrolling.

@Test
public void enrollFingerprintTwice_shouldStartOneEnrolling() {
    EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
    enrollmentCallback.onEnrollmentProgress(123);
    // A second enroll should be a no-op
    enrollmentCallback.onEnrollmentProgress(123);
    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));
    // Should only start one next activity
    assertThat(shadowActivity.getNextStartedActivityForResult()).named("Next activity 2").isNull();
}
Also used : ShadowActivity(org.robolectric.shadows.ShadowActivity) ComponentName(android.content.ComponentName) IntentForResult(org.robolectric.shadows.ShadowActivity.IntentForResult) EnrollmentCallback(android.hardware.fingerprint.FingerprintManager.EnrollmentCallback) Test(org.junit.Test)

Example 22 with EnrollmentCallback

use of android.hardware.fingerprint.FingerprintManager.EnrollmentCallback in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class FingerprintEnrollFindSensorTest method layoutWithoutAnimation_shouldNotCrash.

// Use a non-default resource qualifier to load the test layout in
// robotests/res/layout-mcc999/fingerprint_enroll_find_sensor. This layout is a copy of the
// regular find sensor layout, with the animation removed.
@Config(qualifiers = "mcc999")
@Test
public void layoutWithoutAnimation_shouldNotCrash() {
    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").isNotNull();
    assertThat(startedActivity.intent.getComponent()).isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));
}
Also used : ShadowActivity(org.robolectric.shadows.ShadowActivity) ComponentName(android.content.ComponentName) IntentForResult(org.robolectric.shadows.ShadowActivity.IntentForResult) EnrollmentCallback(android.hardware.fingerprint.FingerprintManager.EnrollmentCallback) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

EnrollmentCallback (android.hardware.fingerprint.FingerprintManager.EnrollmentCallback)22 Test (org.junit.Test)22 ComponentName (android.content.ComponentName)21 ShadowActivity (org.robolectric.shadows.ShadowActivity)21 IntentForResult (org.robolectric.shadows.ShadowActivity.IntentForResult)21 Config (org.robolectric.annotation.Config)7 TestConfig (com.android.settings.TestConfig)6 TextView (android.widget.TextView)1