Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove toast notification for adding article to reading list (uplift to 1.74.x) #27004

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion chromium_src/chrome/browser/ui/toasts/toast_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

bool ToastController::MaybeShowToast(ToastParams params) {
if (params.toast_id == ToastId::kLinkCopied ||
params.toast_id == ToastId::kImageCopied) {
params.toast_id == ToastId::kImageCopied ||
params.toast_id == ToastId::kAddedToReadingList) {
return false;
}
return MaybeShowToast_ChromiumImpl(std::move(params));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// test toasts, but those are the two notifications we want to hide so redefine
// their identifiers here so we can continue to run the upstream tests.
#define kLinkCopied kLinkToHighlightCopied
#define kImageCopied kAddedToReadingList
#define kImageCopied kClearBrowsingData
#include "src/chrome/browser/ui/toasts/toast_controller_unittest.cc"
#undef kImageCopied
#undef kLinkCopied
Expand Down Expand Up @@ -41,3 +41,18 @@ TEST_F(ToastControllerUnitTest, NeverShowToastForImageCopied) {
EXPECT_FALSE(controller->MaybeShowToast(ToastParams(ToastId::kImageCopied)));
EXPECT_FALSE(controller->IsShowingToast());
}

TEST_F(ToastControllerUnitTest, NeverShowToastForAddedToReadingList) {
ToastRegistry* const registry = toast_registry();
registry->RegisterToast(
ToastId::kAddedToReadingList,
ToastSpecification::Builder(vector_icons::kEmailIcon, 0).Build());

auto controller = std::make_unique<TestToastController>(registry);

EXPECT_FALSE(controller->IsShowingToast());
EXPECT_TRUE(controller->CanShowToast(ToastId::kAddedToReadingList));
EXPECT_FALSE(
controller->MaybeShowToast(ToastParams(ToastId::kAddedToReadingList)));
EXPECT_FALSE(controller->IsShowingToast());
}
3 changes: 2 additions & 1 deletion test/filters/browser_tests.filter
Original file line number Diff line number Diff line change
Expand Up @@ -1939,9 +1939,10 @@
-ComponentManagerUpdateCheckBrowserTest.RegisterAndUnregisterTranslateKitLanguagePackComponent
-ComponentManagerUpdateCheckBrowserTest.RegisterTranslateKitComponent

# We disable the ImageCopied/LinkCopied toast notifications
# We disable the AddToReadingList/ImageCopied/LinkCopied toast notifications
-All/ContextMenuBrowserTest.ShowsToastOnImageCopied/*
-All/ContextMenuBrowserTest.ShowsToastOnLinkCopied/*
-BrowserCommandsTest.AddingToReadingListOpensToast
-BrowserCommandsTest.CopyingUrlOpensToast

# Tests below this point have not been diagnosed or had issues created yet.
Expand Down
Loading