Fix Settings password robo tests.
Bug: 151913744
Test: m RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.password
Change-Id: I7d4f221f4f4c0375f06780f907b769946aebd272
diff --git a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
index 634b9a8..6b92e57 100644
--- a/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
+++ b/tests/robotests/src/com/android/settings/password/ChooseLockGenericTest.java
@@ -65,7 +65,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
@@ -233,7 +232,6 @@
}
@Test
- @Ignore
public void updatePreferencesOrFinish_callingAppIsAdmin_deviceNotProvisioned_footerInvisible() {
Global.putInt(application.getContentResolver(), Global.DEVICE_PROVISIONED, 0);
initActivity(new Intent().putExtra(EXTRA_KEY_IS_CALLING_APP_ADMIN, true));
diff --git a/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java b/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
index 79d4b6b..af44d39 100644
--- a/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
+++ b/tests/robotests/src/com/android/settings/password/SetNewPasswordActivityTest.java
@@ -50,7 +50,6 @@
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -105,18 +104,17 @@
}
@Test
- @Ignore
public void testSetupChooseLockGeneric() {
Settings.Global.putInt(RuntimeEnvironment.application.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0);
+ Intent intent = new Intent(ACTION_SET_NEW_PASSWORD);
+ intent.putExtra(WizardManagerHelper.EXTRA_IS_SETUP_FLOW, true);
SetNewPasswordActivity activity =
- Robolectric.buildActivity(SetNewPasswordActivity.class).get();
- activity.launchChooseLock(new Bundle());
+ Robolectric.buildActivity(SetNewPasswordActivity.class, intent).create().get();
ShadowActivity shadowActivity = Shadows.shadowOf(activity);
- Intent intent = getLaunchChooseLockIntent(shadowActivity);
- intent.putExtra(WizardManagerHelper.EXTRA_IS_FIRST_RUN, true);
- assertThat(intent.getComponent())
+ Intent nextIntent = shadowActivity.getNextStartedActivityForResult().intent;
+ assertThat(nextIntent.getComponent())
.isEqualTo(new ComponentName(activity, SetupChooseLockGeneric.class));
}