Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Unified Diff: components/ntp_snippets/content_suggestions_service_unittest.cc

Issue 2610553002: [NTP::SectionOrder] Make ClickBasedRanker move dismissed sections down. (Closed)
Patch Set: jkrcal@ comment. Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/content_suggestions_service_unittest.cc
diff --git a/components/ntp_snippets/content_suggestions_service_unittest.cc b/components/ntp_snippets/content_suggestions_service_unittest.cc
index 2b0ea890486697de612d858f3b81410ee0eb5b25..e7914ea9da95e83f66123f8728758eea983c19e7 100644
--- a/components/ntp_snippets/content_suggestions_service_unittest.cc
+++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -18,6 +18,7 @@
#include "components/ntp_snippets/category_info.h"
#include "components/ntp_snippets/category_rankers/constant_category_ranker.h"
#include "components/ntp_snippets/category_rankers/fake_category_ranker.h"
+#include "components/ntp_snippets/category_rankers/mock_category_ranker.h"
#include "components/ntp_snippets/category_status.h"
#include "components/ntp_snippets/content_suggestion.h"
#include "components/ntp_snippets/content_suggestions_provider.h"
@@ -743,4 +744,21 @@ TEST_F(ContentSuggestionsServiceTest, ShouldReturnCategoriesInOrderToDisplay) {
ElementsAre(second_category, first_category));
}
+TEST_F(ContentSuggestionsServiceTest,
+ ShouldForwardDismissedCategoryToCategoryRanker) {
+ auto mock_ranker = base::MakeUnique<MockCategoryRanker>();
+ MockCategoryRanker* raw_mock_ranker = mock_ranker.get();
+ SetCategoryRanker(std::move(mock_ranker));
+
+ // The service is recreated to pick up the new ranker.
+ ResetService();
+
+ Category category = Category::FromKnownCategory(KnownCategories::BOOKMARKS);
+ MockProvider* provider = RegisterProvider(category);
+ provider->FireCategoryStatusChangedWithCurrentStatus(category);
+
+ EXPECT_CALL(*raw_mock_ranker, OnCategoryDismissed(category));
+ service()->DismissCategory(category);
+}
+
} // namespace ntp_snippets
« no previous file with comments | « components/ntp_snippets/content_suggestions_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698