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

Unified Diff: components/ntp_snippets/content_suggestions_service_unittest.cc

Issue 2473483006: Adds a Fetch() method to the ContentSuggestionService which asks any provider to provide more conte… (Closed)
Patch Set: comments by Markus. Created 4 years, 1 month 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
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 99d7a3fd0259b478e397167124398b0371f48247..978d01b3ae409035dc4197a69a192d01126a7188 100644
--- a/components/ntp_snippets/content_suggestions_service_unittest.cc
+++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -88,6 +88,10 @@ class MockProvider : public ContentSuggestionsProvider {
void(base::Time begin,
base::Time end,
const base::Callback<bool(const GURL& url)>& filter));
+ MOCK_METHOD3(Fetch,
+ void(const Category&,
+ const std::set<std::string>&,
+ FetchingCallback));
MOCK_METHOD1(ClearCachedSuggestions, void(Category category));
MOCK_METHOD2(GetDismissedSuggestionsForDebugging,
void(Category category,
@@ -575,6 +579,16 @@ TEST_F(ContentSuggestionsServiceTest, ShouldForwardClearHistory) {
service()->ClearHistory(begin, end, filter);
}
+TEST_F(ContentSuggestionsServiceTest, ShouldForwardFetch) {
+ Category category = FromKnownCategory(KnownCategories::ARTICLES);
+ std::set<std::string> known_suggestions;
+ MockProvider* provider = RegisterProvider(category);
+ provider->FireCategoryStatusChangedWithCurrentStatus(category);
+ EXPECT_CALL(*provider, Fetch(category, known_suggestions, _));
+ service()->Fetch(category, known_suggestions,
+ ContentSuggestionsService::FetchingCallback());
+}
+
TEST_F(ContentSuggestionsServiceTest, DismissAndRestoreCategory) {
// Register a category with one suggestion.
Category category = FromKnownCategory(KnownCategories::ARTICLES);

Powered by Google App Engine
This is Rietveld 408576698