use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by PixelExperience.
the class BatteryTipDialogFragmentTest method testOnCreateDialog_restrictOneAppTip_fireRestrictOneAppDialog.
@Test
public void testOnCreateDialog_restrictOneAppTip_fireRestrictOneAppDialog() {
mDialogFragment = BatteryTipDialogFragment.newInstance(mRestrictedOneAppTip, METRICS_KEY);
FragmentController.setupFragment(mDialogFragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getTitle()).isEqualTo("Restrict app?");
assertThat(shadowDialog.getMessage()).isEqualTo("To save battery, stop app from using battery in the background. This app" + " may not work properly and notifications may be delayed.");
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by PixelExperience.
the class BatteryTipDialogFragmentTest method testOnCreateDialog_summaryTip_fireDialog.
@Test
public void testOnCreateDialog_summaryTip_fireDialog() {
doReturn(AVERAGE_TIME_MS).when(mSummaryTip).getAverageTimeMs();
mDialogFragment = BatteryTipDialogFragment.newInstance(mSummaryTip, METRICS_KEY);
FragmentController.setupFragment(mDialogFragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo("Your apps are using a normal amount of battery. If apps use too much battery, " + "your phone will suggest actions you can take.\n\nYou can always turn" + " on Battery Saver if you’re running low on battery.");
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by PixelExperience.
the class SetupSkipDialogTest method dialogMessage_whenSkipPasswordSetupForFace_shouldShownCorrectly.
@Test
public void dialogMessage_whenSkipPasswordSetupForFace_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true, false, true, false, true, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(mActivity.getString(R.string.lock_screen_password_skip_face_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo(mActivity.getString(R.string.lock_screen_password_skip_face_message));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by PixelExperience.
the class SetupSkipDialogTest method frpMessages_areShownCorrectly_whenNotSupported.
@Test
public void frpMessages_areShownCorrectly_whenNotSupported() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(false, false, false, false, false, false);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_title)).isEqualTo(shadowAlertDialog.getTitle());
assertThat(mActivity.getString(R.string.lock_screen_intro_skip_dialog_text)).isEqualTo(shadowAlertDialog.getMessage());
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project packages_apps_Settings by PixelExperience.
the class SetupSkipDialogTest method dialogMessage_whenSkipPasswordSetupForBiometrics_shouldShownCorrectly.
@Test
public void dialogMessage_whenSkipPasswordSetupForBiometrics_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true, false, true, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(shadowAlertDialog.getTitle()).isEqualTo(mActivity.getString(R.string.lock_screen_password_skip_biometrics_title));
assertThat(shadowAlertDialog.getMessage()).isEqualTo(mActivity.getString(R.string.lock_screen_password_skip_biometrics_message));
}
Aggregations