use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupChooseLockPasswordTest method createActivity_clickDifferentOption_extrasShouldBePropagated.
@Test
public void createActivity_clickDifferentOption_extrasShouldBePropagated() {
Bundle bundle = new Bundle();
bundle.putString("foo", "bar");
Intent intent = new IntentBuilder(application).build();
intent.putExtra(ChooseLockGenericFragment.EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS, bundle);
intent = SetupChooseLockPassword.modifyIntentForSetup(application, intent);
intent.putExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, true);
SetupChooseLockPassword activity = ActivityController.of(new SetupChooseLockPassword(), intent).setup().get();
SetupChooseLockPasswordFragment fragment = (SetupChooseLockPasswordFragment) activity.getSupportFragmentManager().findFragmentById(R.id.main_content);
fragment.onLockTypeSelected(ScreenLockType.PATTERN);
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
final Intent nextStartedActivity = shadowActivity.getNextStartedActivity();
assertThat(nextStartedActivity).isNotNull();
assertThat(nextStartedActivity.getBooleanExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, false)).isTrue();
assertThat(nextStartedActivity.getStringExtra("foo")).named("Foo extra").isEqualTo("bar");
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.
the class SetupChooseLockPasswordTest method createActivity_shouldNotCrash.
@Test
public void createActivity_shouldNotCrash() {
// Basic test for activity created without crashing
final Intent intent = SetupChooseLockPassword.modifyIntentForSetup(application, new IntentBuilder(application).build());
ActivityController.of(new SetupChooseLockPassword(), intent).setup().get();
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.
the class ChooseLockPasswordTest method intentBuilder_setMinComplexityMedium_hasMinComplexityExtraMedium.
@Test
public void intentBuilder_setMinComplexityMedium_hasMinComplexityExtraMedium() {
Intent intent = new IntentBuilder(application).setPasswordRequirement(PASSWORD_COMPLEXITY_MEDIUM, null).build();
assertThat(intent.hasExtra(ChooseLockPassword.EXTRA_KEY_MIN_COMPLEXITY)).isTrue();
assertThat(intent.getIntExtra(ChooseLockPassword.EXTRA_KEY_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE)).isEqualTo(PASSWORD_COMPLEXITY_MEDIUM);
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.
the class ChooseLockPasswordTest method intentBuilder_setMinComplexityNotCalled.
@Test
public void intentBuilder_setMinComplexityNotCalled() {
Intent intent = new IntentBuilder(application).build();
assertThat(intent.hasExtra(ChooseLockPassword.EXTRA_KEY_MIN_COMPLEXITY)).isFalse();
}
use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.
the class ChooseLockPasswordTest method intentBuilder_setRequestGatekeeperPassword_shouldAddExtras.
@Test
public void intentBuilder_setRequestGatekeeperPassword_shouldAddExtras() {
Intent intent = new IntentBuilder(application).setRequestGatekeeperPasswordHandle(true).setPasswordType(PASSWORD_QUALITY_ALPHANUMERIC).setUserId(123).build();
assertWithMessage("EXTRA_KEY_REQUEST_GK_PW").that(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_REQUEST_GK_PW_HANDLE, false)).isTrue();
assertWithMessage("PASSWORD_TYPE_KEY").that(intent.getIntExtra(PASSWORD_TYPE_KEY, 0)).isEqualTo(PASSWORD_QUALITY_ALPHANUMERIC);
assertWithMessage("EXTRA_USER_ID").that(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).isEqualTo(123);
}
Aggregations