Index: components/ntp_snippets/remote/ntp_snippets_service_unittest.cc |
diff --git a/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc b/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc |
index 268a18434ea4dad99ffc7b7aec046922ac56e08e..63f5ed2425498e18613a915f8e71dfa515740f3b 100644 |
--- a/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc |
+++ b/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc |
@@ -1177,4 +1177,17 @@ TEST_F(NTPSnippetsServiceTest, ShouldClearOrphanedImagesOnRestart) { |
EXPECT_TRUE(FetchImage(service.get(), MakeArticleID(kSnippetUrl)).IsEmpty()); |
} |
+TEST_F(NTPSnippetsServiceTest, ShouldHandleMoreThanMaxSnippetsInResponse) { |
+ auto service = MakeSnippetsService(); |
+ |
+ std::vector<std::string> suggestions; |
+ for (int i = 0 ; i < service->GetMaxSnippetCountForTesting() + 1; ++i) { |
+ suggestions.push_back(GetSnippetWithUrl( |
+ base::StringPrintf("http://localhost/snippet-id-%d", i))); |
+ } |
+ LoadFromJSONString(service.get(), GetTestJson(suggestions)); |
+ EXPECT_THAT(service->GetSnippetsForTesting(articles_category()), |
+ SizeIs(service->GetMaxSnippetCountForTesting() + 1)); |
Marc Treib
2016/10/06 15:36:13
Is this actually the behavior we want?
tschumann
2016/10/06 17:57:42
added a TODO().
|
+} |
+ |
} // namespace ntp_snippets |