Merge "Update buttons in FP find sensor" into oc-dr1-dev
This commit is contained in:
@@ -17,10 +17,12 @@
|
||||
|
||||
<com.android.setupwizardlib.GlifLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/setup_wizard_layout"
|
||||
style="?attr/fingerprint_layout_theme"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
app:suwFooter="@layout/fingerprint_enroll_find_sensor_base_footer">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -65,7 +67,7 @@
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<Button
|
||||
style="@style/SuwGlifButton.Primary"
|
||||
style="@style/SuwGlifButton.Secondary"
|
||||
android:id="@+id/next_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@@ -25,15 +25,16 @@ import static org.robolectric.RuntimeEnvironment.application;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintManager.EnrollmentCallback;
|
||||
import android.os.CancellationSignal;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.password.ChooseLockSettingsHelper;
|
||||
import com.android.settings.password.IFingerprintManager;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||
import com.android.settings.testutils.shadow.ShadowDynamicIndexableContentMonitor;
|
||||
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
|
||||
@@ -92,13 +93,26 @@ public class FingerprintEnrollFindSensorTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clickNextAndFingerprint_shouldNotCrash() {
|
||||
public void enrollFingerprint_shouldProceed() {
|
||||
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
||||
|
||||
Button nextButton = mActivity.findViewById(R.id.next_button);
|
||||
nextButton.performClick();
|
||||
enrollmentCallback.onEnrollmentProgress(123);
|
||||
nextButton.performClick();
|
||||
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));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enrollFingerprintTwice_shouldStartOneEnrolling() {
|
||||
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
||||
|
||||
enrollmentCallback.onEnrollmentProgress(123);
|
||||
enrollmentCallback.onEnrollmentProgress(123); // A second enroll should be a no-op
|
||||
|
||||
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||
IntentForResult startedActivity =
|
||||
@@ -120,9 +134,7 @@ public class FingerprintEnrollFindSensorTest {
|
||||
public void layoutWithoutAnimation_shouldNotCrash() {
|
||||
EnrollmentCallback enrollmentCallback = verifyAndCaptureEnrollmentCallback();
|
||||
enrollmentCallback.onEnrollmentProgress(123);
|
||||
|
||||
Button nextButton = mActivity.findViewById(R.id.next_button);
|
||||
nextButton.performClick();
|
||||
enrollmentCallback.onEnrollmentError(FingerprintManager.FINGERPRINT_ERROR_CANCELED, "test");
|
||||
|
||||
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||
IntentForResult startedActivity =
|
||||
@@ -132,6 +144,16 @@ public class FingerprintEnrollFindSensorTest {
|
||||
.isEqualTo(new ComponentName(application, FingerprintEnrollEnrolling.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clickSkip_shouldReturnResultSkip() {
|
||||
Button skipButton = mActivity.findViewById(R.id.skip_button);
|
||||
skipButton.performClick();
|
||||
|
||||
ShadowActivity shadowActivity = Shadows.shadowOf(mActivity);
|
||||
assertThat(shadowActivity.getResultCode()).named("result code")
|
||||
.isEqualTo(FingerprintEnrollBase.RESULT_SKIP);
|
||||
}
|
||||
|
||||
private EnrollmentCallback verifyAndCaptureEnrollmentCallback() {
|
||||
ArgumentCaptor<EnrollmentCallback> callbackCaptor =
|
||||
ArgumentCaptor.forClass(EnrollmentCallback.class);
|
||||
|
||||
Reference in New Issue
Block a user