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

Unified Diff: components/ntp_snippets/remote/ntp_snippets_service_unittest.cc

Issue 2387293009: Removes a data-dependent DCHECK(). (Closed)
Patch Set: merged to head Created 4 years, 2 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/remote/ntp_snippets_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/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
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippets_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698