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

Unified Diff: components/ntp_snippets/ntp_snippets_fetcher_unittest.cc

Issue 2276383002: Support server-provided category names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Move "ignored" comment. Created 4 years, 4 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/ntp_snippets_fetcher_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc b/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
index c4249008a16de07882ccc0136732b40ce772ea58..8886d17d842ad0ca1edac15538a593c6cc9a8496 100644
--- a/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
@@ -66,14 +66,15 @@ MATCHER(HasValue, "") {
MATCHER(IsEmptyArticleList, "is an empty list of articles") {
NTPSnippetsFetcher::OptionalSnippets& snippets = *arg;
- return snippets && snippets->size() == 1 && snippets->begin()->second.empty();
+ return snippets && snippets->size() == 1 &&
+ snippets->begin()->snippets.empty();
}
MATCHER_P(IsSingleArticle, url, "is a list with the single article %(url)s") {
NTPSnippetsFetcher::OptionalSnippets& snippets = *arg;
return snippets && snippets->size() == 1 &&
- snippets->begin()->second.size() == 1 &&
- snippets->begin()->second[0]->best_source().url.spec() == url;
+ snippets->begin()->snippets.size() == 1 &&
+ snippets->begin()->snippets[0]->best_source().url.spec() == url;
}
MATCHER_P(EqualsJSON, json, "equals JSON") {
@@ -548,8 +549,8 @@ TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ServerCategories) {
ASSERT_TRUE(snippets);
ASSERT_THAT(snippets->size(), Eq(2u));
for (const auto& category : *snippets) {
- const auto& articles = category.second;
- switch (category.first.id()) {
+ const auto& articles = category.snippets;
+ switch (category.category.id()) {
case static_cast<int>(KnownCategories::ARTICLES):
ASSERT_THAT(articles.size(), Eq(1u));
EXPECT_THAT(articles[0]->best_source().url.spec(),
@@ -561,7 +562,7 @@ TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ServerCategories) {
Eq("http://localhost/foo2"));
break;
default:
- FAIL() << "unknown category ID " << category.first.id();
+ FAIL() << "unknown category ID " << category.category.id();
}
}

Powered by Google App Engine
This is Rietveld 408576698