| 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 c432f90b563ea1c88b7b31ccc7251630c24637c9..3002a7a38657132f45681d1ad8b249048a4e7f21 100644
|
| --- a/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
|
| +++ b/components/ntp_snippets/remote/ntp_snippets_service_unittest.cc
|
| @@ -1172,4 +1172,19 @@ 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));
|
| + // TODO(tschumann): We should probably trim out any additional results and
|
| + // only serve the MaxSnippetCount items.
|
| + EXPECT_THAT(service->GetSnippetsForTesting(articles_category()),
|
| + SizeIs(service->GetMaxSnippetCountForTesting() + 1));
|
| +}
|
| +
|
| } // namespace ntp_snippets
|
|
|