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

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

Issue 2387293009: Removes a data-dependent DCHECK(). (Closed)
Patch Set: synced 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
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

Powered by Google App Engine
This is Rietveld 408576698