Skip to content

Commit

Permalink
Remove toast notification for adding article to reading list
Browse files Browse the repository at this point in the history
  • Loading branch information
emerick committed Dec 12, 2024
1 parent c34372a commit b1f0cda
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
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 @@ -1936,9 +1936,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

0 comments on commit b1f0cda

Please sign in to comment.