Search in sources :

Example 6 with IntentBuilder

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

the class ChooseLockPatternTest 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.ChooseLockPattern.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 7 with IntentBuilder

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

the class ChooseLockPatternTest method intentBuilder_setPattern_shouldAddExtras.

@Test
public void intentBuilder_setPattern_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setPattern(createPattern("1234")).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(createPattern("1234"));
    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.ChooseLockPattern.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 8 with IntentBuilder

use of com.android.settings.password.ChooseLockPattern.IntentBuilder in project android_packages_apps_Settings by crdroidandroid.

the class ChooseLockPatternTest method intentBuilder_setChallenge_shouldAddExtras.

@Test
public void intentBuilder_setChallenge_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setChallenge(12345L).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(Intent.EXTRA_USER_ID, 0)).named("EXTRA_USER_ID").isEqualTo(123);
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPattern.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 9 with IntentBuilder

use of com.android.settings.password.ChooseLockPattern.IntentBuilder in project android_packages_apps_Settings by crdroidandroid.

the class ChooseLockPatternTest method intentBuilder_setPattern_shouldAddExtras.

@Test
public void intentBuilder_setPattern_shouldAddExtras() {
    Intent intent = new IntentBuilder(application).setPattern("pattern").setUserId(123).build();
    assertThat(intent.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, true)).named("EXTRA_KEY_HAS_CHALLENGE").isFalse();
    assertThat(intent.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD)).named("EXTRA_KEY_PASSWORD").isEqualTo("pattern");
    assertThat(intent.getIntExtra(Intent.EXTRA_USER_ID, 0)).named("EXTRA_USER_ID").isEqualTo(123);
}
Also used : IntentBuilder(com.android.settings.password.ChooseLockPattern.IntentBuilder) Intent(android.content.Intent) Test(org.junit.Test)

Example 10 with IntentBuilder

use of com.android.settings.password.ChooseLockPattern.IntentBuilder in project android_packages_apps_Settings by crdroidandroid.

the class SetupChooseLockPatternTest method setUp.

@Before
public void setUp() {
    RuntimeEnvironment.getRobolectricPackageManager().setComponentEnabledSetting(new ComponentName(application, SetupRedactionInterstitial.class), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
    mActivity = Robolectric.buildActivity(SetupChooseLockPattern.class, SetupChooseLockPattern.modifyIntentForSetup(application, new IntentBuilder(application).setUserId(UserHandle.myUserId()).build())).setup().get();
}
Also used : SetupChooseLockPattern(com.android.settings.password.SetupChooseLockPattern) IntentBuilder(com.android.settings.password.ChooseLockPattern.IntentBuilder) ComponentName(android.content.ComponentName) Before(org.junit.Before)

Aggregations

IntentBuilder (com.android.settings.password.ChooseLockPattern.IntentBuilder)24 Intent (android.content.Intent)18 Test (org.junit.Test)16 ComponentName (android.content.ComponentName)8 Before (org.junit.Before)8 SetupChooseLockPattern (com.android.settings.password.SetupChooseLockPattern)6 LockscreenCredential (com.android.internal.widget.LockscreenCredential)2 SetupRedactionInterstitial (com.android.settings.SetupRedactionInterstitial)2