Skip to content

Commit

Permalink
Download later: Fix an issue that positive button text could be wrong.
Browse files Browse the repository at this point in the history
When selecting from date time picker option to other options in download
later dialog, the positive button should be "Done" instead of
"Download".

Bug: 1211732
Change-Id: Ib316a1a737586ffb620e3996c8a09076e9488a3b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2912849
Reviewed-by: David Trainor <dtrainor@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#886023}
  • Loading branch information
Xing Liu authored and Chromium LUCI CQ committed May 24, 2021
1 parent d078c38 commit 9b8c417
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,25 @@ public void testSelectFromOnWifiToDownloadLater() {
verify(mController, times(0)).onDownloadLaterDialogComplete(anyInt(), anyLong());
verify(mDateTimePicker).showDialog(any(), any(), any());
}

@Test
@MediumTest
public void testSelectFromDownloadLaterToDownloadNow() {
showDialog();
TestThreadUtils.runOnUiThreadBlocking(() -> {
RadioButtonWithDescription downloadLaterButton =
getDownloadLaterDialogView().findViewById(R.id.choose_date_time);
Assert.assertNotNull(downloadLaterButton);
downloadLaterButton.setChecked(true);
getDownloadLaterDialogView().onCheckedChanged(null, -1);

RadioButtonWithDescription onWifiButton =
(RadioButtonWithDescription) getDownloadLaterDialogView().findViewById(
org.chromium.chrome.browser.download.R.id.on_wifi);
onWifiButton.setChecked(true);
getDownloadLaterDialogView().onCheckedChanged(null, -1);
});

assertPositiveButtonText("Done");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private void onChoiceChanged(@DownloadLaterDialogChoice int choice) {
&& choice != DownloadLaterDialogChoice.DOWNLOAD_LATER) {
mDialogModel.set(ModalDialogProperties.POSITIVE_BUTTON_TEXT,
mContext.getResources().getString(
R.string.duplicate_download_infobar_download_button));
R.string.download_later_dialog_positive_button_text));
mDownloadLaterDialogModel.set(
DownloadLaterDialogProperties.DONT_SHOW_AGAIN_DISABLED, false);
}
Expand Down

0 comments on commit 9b8c417

Please sign in to comment.