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

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

Issue 2568033005: [NTP::SectionOrder] Replace CategoryFactory with a category ranker. (Closed)
Patch Set: download provider tests. Created 4 years 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_fetcher_unittest.cc
diff --git a/components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc b/components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc
index ca9343583b26c07326f518a6a19f6b74b02916fe..1d3fbceb194363302a15d6372a39058ac8da9c17 100644
--- a/components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc
+++ b/components/ntp_snippets/remote/ntp_snippets_fetcher_unittest.cc
@@ -16,7 +16,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/values.h"
-#include "components/ntp_snippets/category_factory.h"
+#include "components/ntp_snippets/category.h"
#include "components/ntp_snippets/features.h"
#include "components/ntp_snippets/ntp_snippets_constants.h"
#include "components/ntp_snippets/remote/ntp_snippet.h"
@@ -311,8 +311,8 @@ class NTPSnippetsFetcherTestBase : public testing::Test {
fake_signin_manager_.get(), fake_token_service_.get(),
scoped_refptr<net::TestURLRequestContextGetter>(
new net::TestURLRequestContextGetter(mock_task_runner_.get())),
- pref_service_.get(), &category_factory_, nullptr,
- base::Bind(&ParseJsonDelayed), kAPIKey, user_classifier_.get());
+ pref_service_.get(), nullptr, base::Bind(&ParseJsonDelayed), kAPIKey,
+ user_classifier_.get());
snippets_fetcher_->SetTickClockForTesting(
mock_task_runner_->GetMockTickClock());
@@ -414,7 +414,6 @@ class NTPSnippetsFetcherTestBase : public testing::Test {
std::unique_ptr<NTPSnippetsFetcher> snippets_fetcher_;
std::unique_ptr<TestingPrefServiceSimple> pref_service_;
std::unique_ptr<UserClassifier> user_classifier_;
- CategoryFactory category_factory_;
MockSnippetsAvailableCallback mock_callback_;
const GURL test_url_;
base::HistogramTester histogram_tester_;
@@ -833,7 +832,7 @@ TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ServerCategories) {
ASSERT_THAT(articles.size(), Eq(1u));
EXPECT_THAT(articles[0]->url().spec(), Eq("http://localhost/foobar"));
EXPECT_THAT(category.info, IsCategoryInfoForArticles());
- } else if (category.category == CategoryFactory().FromRemoteCategory(2)) {
+ } else if (category.category == Category::FromRemoteCategory(2)) {
ASSERT_THAT(articles.size(), Eq(1u));
EXPECT_THAT(articles[0]->url().spec(), Eq("http://localhost/foo2"));
EXPECT_THAT(category.info.has_more_action(), Eq(true));
@@ -949,8 +948,8 @@ TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ExclusiveCategoryOnly) {
.WillOnce(MoveArgument1PointeeTo(&fetched_categories));
NTPSnippetsFetcher::Params params = test_params();
- params.exclusive_category = base::Optional<Category>(
- CategoryFactory().FromRemoteCategory(2));
+ params.exclusive_category =
+ base::Optional<Category>(Category::FromRemoteCategory(2));
snippets_fetcher().FetchSnippets(
params, ToSnippetsAvailableCallback(&mock_callback()));
FastForwardUntilNoTasksRemain();
@@ -958,8 +957,7 @@ TEST_F(NTPSnippetsContentSuggestionsFetcherTest, ExclusiveCategoryOnly) {
ASSERT_TRUE(fetched_categories);
ASSERT_THAT(fetched_categories->size(), Eq(1u));
const auto& category = (*fetched_categories)[0];
- EXPECT_THAT(category.category.id(),
- Eq(CategoryFactory().FromRemoteCategory(2).id()));
+ EXPECT_THAT(category.category.id(), Eq(Category::FromRemoteCategory(2).id()));
ASSERT_THAT(category.snippets.size(), Eq(1u));
EXPECT_THAT(category.snippets[0]->url().spec(), Eq("http://localhost/foo2"));
}

Powered by Google App Engine
This is Rietveld 408576698