use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project platform_packages_apps_Settings by BlissRoms.
the class ChooseLockPasswordTest method setActivityAndGetIconDrawable.
private ShadowDrawable setActivityAndGetIconDrawable(boolean addFingerprintExtra) {
ChooseLockPassword passwordActivity = Robolectric.buildActivity(ChooseLockPassword.class, new IntentBuilder(application).setUserId(UserHandle.myUserId()).setForFingerprint(addFingerprintExtra).build()).setup().get();
ChooseLockPasswordFragment fragment = (ChooseLockPasswordFragment) passwordActivity.getFragmentManager().findFragmentById(R.id.main_content);
return Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseLockPasswordTest method intentBuilder_setChallenge_shouldAddExtras.
@Test
public void intentBuilder_setChallenge_shouldAddExtras() {
Intent intent = new IntentBuilder(application).setChallenge(12345L).setPasswordQuality(PASSWORD_QUALITY_ALPHANUMERIC).setUserId(123).build();
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false)).named("EXTRA_KEY_HAS_CHALLENGE").isTrue();
assertThat(intent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L)).named("EXTRA_KEY_CHALLENGE").isEqualTo(12345L);
assertThat(intent.getIntExtra(PASSWORD_TYPE_KEY, 0)).named("PASSWORD_TYPE_KEY").isEqualTo(PASSWORD_QUALITY_ALPHANUMERIC);
assertThat(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).named("EXTRA_USER_ID").isEqualTo(123);
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ChooseLockPasswordTest method intentBuilder_setPassword_shouldAddExtras.
@Test
public void intentBuilder_setPassword_shouldAddExtras() {
Intent intent = new IntentBuilder(application).setPassword("password".getBytes()).setPasswordQuality(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC).setUserId(123).build();
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, true)).named("EXTRA_KEY_HAS_CHALLENGE").isFalse();
assertThat(intent.getByteArrayExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD)).named("EXTRA_KEY_PASSWORD").isEqualTo("password".getBytes());
assertThat(intent.getIntExtra(PASSWORD_TYPE_KEY, 0)).named("PASSWORD_TYPE_KEY").isEqualTo(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);
assertThat(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).named("EXTRA_USER_ID").isEqualTo(123);
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by LineageOS.
the class ChooseLockPasswordTest method intentBuilder_setChallenge_shouldAddExtras.
@Test
public void intentBuilder_setChallenge_shouldAddExtras() {
Intent intent = new IntentBuilder(application).setChallenge(12345L).setPasswordQuality(DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC).setPasswordLengthRange(123, 456).setUserId(123).build();
assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false)).named("EXTRA_KEY_HAS_CHALLENGE").isTrue();
assertThat(intent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0L)).named("EXTRA_KEY_CHALLENGE").isEqualTo(12345L);
assertThat(intent.getIntExtra(ChooseLockPassword.PASSWORD_MIN_KEY, 0)).named("PASSWORD_MIN_KEY").isEqualTo(123);
assertThat(intent.getIntExtra(ChooseLockPassword.PASSWORD_MAX_KEY, 0)).named("PASSWORD_MAX_KEY").isEqualTo(456);
assertThat(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY, 0)).named("PASSWORD_TYPE_KEY").isEqualTo(DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC);
assertThat(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).named("EXTRA_USER_ID").isEqualTo(123);
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by LineageOS.
the class SetupChooseLockPasswordTest method createSetupChooseLockPassword.
private SetupChooseLockPassword createSetupChooseLockPassword() {
Intent intent = SetupChooseLockPassword.modifyIntentForSetup(application, new IntentBuilder(application).build());
intent.putExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, true);
return Robolectric.buildActivity(SetupChooseLockPassword.class, intent).setup().get();
}
Aggregations