use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ForgetDeviceDialogFragmentTest method createDialog_untetheredDevice_showUntetheredMessage.
@Test
public void createDialog_untetheredDevice_showUntetheredMessage() {
when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)).thenReturn("true".getBytes());
FragmentController.setupFragment(mFragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.bluetooth_untethered_unpair_dialog_body, DEVICE_NAME));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DevelopmentSettingsDashboardFragmentTest method onSwitchChanged_turnOff_andOffloadIsNotDefaultValue_shouldShowWarningDialog.
@Test
@Config(shadows = ShadowDisableDevSettingsDialogFragment.class)
public void onSwitchChanged_turnOff_andOffloadIsNotDefaultValue_shouldShowWarningDialog() {
final BluetoothA2dpHwOffloadPreferenceController controller = mock(BluetoothA2dpHwOffloadPreferenceController.class);
when(mDashboard.getContext()).thenReturn(mContext);
when(mDashboard.getDevelopmentOptionsController(BluetoothA2dpHwOffloadPreferenceController.class)).thenReturn(controller);
when(controller.isDefaultValue()).thenReturn(false);
Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 1);
mDashboard.onSwitchChanged(mSwitch, false);
AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog).isNotNull();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getTitle()).isEqualTo(mContext.getString(R.string.bluetooth_disable_a2dp_hw_offload_dialog_title));
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.bluetooth_disable_a2dp_hw_offload_dialog_message));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipDialogFragmentTest method testOnCreateDialog_highUsageTip_fireHighUsageDialog.
@Test
public void testOnCreateDialog_highUsageTip_fireHighUsageDialog() {
Robolectric.getForegroundThreadScheduler().pause();
mDialogFragment = BatteryTipDialogFragment.newInstance(mHighUsageTip, METRICS_KEY);
FragmentController.setupFragment(mDialogFragment, FragmentActivity.class, 0, /* containerViewId */
null);
Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.battery_tip_dialog_message, 1));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BatteryTipDialogFragmentTest method testOnCreateDialog_unRestrictAppTip_fireUnRestrictDialog.
@Test
public void testOnCreateDialog_unRestrictAppTip_fireUnRestrictDialog() {
mDialogFragment = BatteryTipDialogFragment.newInstance(mUnrestrictAppTip, METRICS_KEY);
ShadowUtils.setApplicationLabel(PACKAGE_NAME, DISPLAY_NAME);
FragmentController.setupFragment(mDialogFragment, FragmentActivity.class, 0, /* containerViewId */
null);
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
ShadowAlertDialogCompat shadowDialog = ShadowAlertDialogCompat.shadowOf(dialog);
assertThat(shadowDialog.getTitle()).isEqualTo("Remove restriction?");
assertThat(shadowDialog.getMessage()).isEqualTo(mContext.getString(R.string.battery_tip_unrestrict_app_dialog_message));
}
use of com.android.settings.testutils.shadow.ShadowAlertDialogCompat in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SetupSkipDialogTest method dialogMessage_whenSkipPinSetupForFace_shouldShownCorrectly.
@Test
public void dialogMessage_whenSkipPinSetupForFace_shouldShownCorrectly() {
SetupSkipDialog setupSkipDialog = SetupSkipDialog.newInstance(true, false, false, false, true);
setupSkipDialog.show(mActivity.getSupportFragmentManager());
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog).isNotNull();
ShadowAlertDialogCompat shadowAlertDialog = ShadowAlertDialogCompat.shadowOf(alertDialog);
assertThat(mActivity.getString(R.string.lock_screen_pin_skip_title)).isEqualTo(shadowAlertDialog.getTitle());
assertThat(getSkipDialogMessage(false)).isEqualTo(shadowAlertDialog.getMessage());
}
Aggregations