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 8b27e51e62759cc71f60ab40f8d22909a887c13d..74f2726a84134265974fcb24c54f681516c3ceb3 100644 |
--- a/components/ntp_snippets/content_suggestions_service_unittest.cc |
+++ b/components/ntp_snippets/content_suggestions_service_unittest.cc |
@@ -87,6 +87,7 @@ class MockProvider : public ContentSuggestionsProvider { |
void(base::Time begin, |
base::Time end, |
const base::Callback<bool(const GURL& url)>& filter)); |
+ MOCK_METHOD2(FetchMore, void(const Category&, FetchedMoreCallback)); |
MOCK_METHOD1(ClearCachedSuggestions, void(Category category)); |
MOCK_METHOD2(GetDismissedSuggestionsForDebugging, |
void(Category category, |
@@ -196,6 +197,11 @@ class ContentSuggestionsServiceTest : public testing::Test { |
return result; |
} |
+ MockProvider::FetchedMoreCallback MakeDummyCallback() { |
+ return base::Bind(&ContentSuggestionsServiceTest::EmptyCallback, |
+ base::Unretained(this)); |
+ } |
+ |
MOCK_METHOD1(OnImageFetched, void(const gfx::Image&)); |
protected: |
@@ -237,6 +243,8 @@ class ContentSuggestionsServiceTest : public testing::Test { |
} |
private: |
+ void EmptyCallback(std::vector<ContentSuggestion>) {} |
+ |
std::unique_ptr<ContentSuggestionsService> service_; |
std::unique_ptr<TestingPrefServiceSimple> pref_service_; |
@@ -574,6 +582,14 @@ TEST_F(ContentSuggestionsServiceTest, ShouldForwardClearHistory) { |
service()->ClearHistory(begin, end, filter); |
} |
+TEST_F(ContentSuggestionsServiceTest, ShouldForwardFetchMore) { |
+ Category category = FromKnownCategory(KnownCategories::ARTICLES); |
+ MockProvider* provider = RegisterProvider(category); |
+ provider->FireCategoryStatusChangedWithCurrentStatus(category); |
+ EXPECT_CALL(*provider, FetchMore(category, testing::_)); |
Marc Treib
2016/10/20 16:51:39
nit: "testing::" not required (there's a "using" a
Marc Treib
2016/10/28 14:49:49
Done.
|
+ service()->FetchMore(category, MakeDummyCallback()); |
Marc Treib
2016/10/20 16:51:39
You can just put a null callback here, as in "Fetc
Marc Treib
2016/10/28 14:49:49
Done.
|
+} |
+ |
TEST_F(ContentSuggestionsServiceTest, DismissAndRestoreCategory) { |
// Register a category with one suggestion. |
Category category = FromKnownCategory(KnownCategories::ARTICLES); |