Search in sources :

Example 41 with IntentBuilder

use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.

the class ChooseLockPasswordTest method intentBuilder_setProfileToUnify_shouldAddExtras.

@Test
public void intentBuilder_setProfileToUnify_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setProfileToUnify(23, LockscreenCredential.createNone()).build();
    assertWithMessage("EXTRA_KEY_UNIFICATION_PROFILE_ID").that(intent.getIntExtra(ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_ID, 0)).isEqualTo(23);
    assertWithMessage("EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL").that((LockscreenCredential) intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL)).isNotNull();
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential) IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 42 with IntentBuilder

use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.

the class ChooseLockPasswordTest method setActivityAndGetIconDrawable.

private ShadowDrawable setActivityAndGetIconDrawable(boolean addFingerprintExtra) {
    ChooseLockPassword passwordActivity = buildChooseLockPasswordActivity(new IntentBuilder(application).setUserId(UserHandle.myUserId()).setForFingerprint(addFingerprintExtra).build());
    ChooseLockPasswordFragment fragment = getChooseLockPasswordFragment(passwordActivity);
    return Shadows.shadowOf(((GlifLayout) fragment.getView()).getIcon());
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) ChooseLockPasswordFragment(com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)

Example 43 with IntentBuilder

use of com.android.settings.password.ChooseLockPassword.IntentBuilder in project android_packages_apps_Settings by omnirom.

the class ChooseLockPasswordTest method intentBuilder_setPassword_shouldAddExtras.

@Test
public void intentBuilder_setPassword_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setPassword(LockscreenCredential.createPassword("password")).setPasswordType(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC).setUserId(123).build();
    assertWithMessage("EXTRA_KEY_FORCE_VERIFY").that(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FORCE_VERIFY, false)).isFalse();
    assertWithMessage("EXTRA_KEY_PASSWORD").that((LockscreenCredential) intent.getParcelableExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD)).isEqualTo(LockscreenCredential.createPassword("password"));
    assertWithMessage("PASSWORD_TYPE_KEY").that(intent.getIntExtra(PASSWORD_TYPE_KEY, 0)).isEqualTo(DevicePolicyManager.PASSWORD_QUALITY_NUMERIC);
    assertWithMessage("EXTRA_USER_ID").that(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).isEqualTo(123);
}
Also used : LockscreenCredential(com.android.internal.widget.LockscreenCredential) IntentBuilder(com.android.settings.password.ChooseLockPassword.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

IntentBuilder (com.android.settings.password.ChooseLockPassword.IntentBuilder)43 Intent (android.content.Intent)36 Test (org.junit.Test)29 Bundle (android.os.Bundle)7 ChooseLockPasswordFragment (com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment)7 SetupChooseLockPasswordFragment (com.android.settings.password.SetupChooseLockPassword.SetupChooseLockPasswordFragment)7 ShadowActivity (org.robolectric.shadows.ShadowActivity)7 IntentForResult (org.robolectric.shadows.ShadowActivity.IntentForResult)5 LockscreenCredential (com.android.internal.widget.LockscreenCredential)2