Update the fingerprint skip dialog

Test: atest
Bug: 124028212
Change-Id: I1a1151c231862ef21b302317f0f105de1a79eac7
This commit is contained in:
pastychang
2019-03-18 20:10:32 +08:00
committed by Pasty Chang
parent 703e6aa092
commit 5145dc1529
5 changed files with 169 additions and 14 deletions

View File

@@ -45,7 +45,8 @@ public class SetupSkipDialogTest {
@Test
public void frpMessages_areShownCorrectly_whenNotSupported() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(false);
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(false, false, false, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
@@ -59,7 +60,8 @@ public class SetupSkipDialogTest {
@Test
public void frpMessages_areShownCorrectly_whenSupported() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true);
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, false, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
@@ -70,4 +72,101 @@ public class SetupSkipDialogTest {
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_dialog_text_frp)).isEqualTo(
shadowAlertDialog.getMessage());
}
@Test
public void dialogMessage_whenSkipPinSetupForFace_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_pin_skip_title)).isEqualTo(
shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(false)).isEqualTo(shadowAlertDialog.getMessage());
}
@Test
public void dialogMessage_whenSkipPasswordSetupForFace_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, true, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_password_skip_title)).isEqualTo(
shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(false)).isEqualTo(shadowAlertDialog.getMessage());
}
@Test
public void dialogMessage_whenSkipPatternSetupForFace_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, true, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_pattern_skip_title)).isEqualTo(
shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(false)).isEqualTo(shadowAlertDialog.getMessage());
}
@Test
public void dialogMessage_whenSkipPinSetupForFingerprint_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, false, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_pin_skip_title)).isEqualTo(
shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(true)).isEqualTo(shadowAlertDialog.getMessage());
}
@Test
public void dialogMessage_whenSkipPasswordSetupForFingerprint_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, false, true, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_password_skip_title)).isEqualTo(
shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(true)).isEqualTo(shadowAlertDialog.getMessage());
}
@Test
public void dialogMessage_whenSkipPatternSetupForFingerprint_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog =
SetupSkipDialog.newInstance(true, true, false, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_pattern_skip_title)).isEqualTo(
shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(true)).isEqualTo(shadowAlertDialog.getMessage());
}
public String getSkipDialogMessage(boolean isFingerprintSupported) {
return String.format(
mActivity.getString(isFingerprintSupported ?
R.string.fingerprint_lock_screen_setup_skip_dialog_text :
R.string.face_lock_screen_setup_skip_dialog_text));
}
}