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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 2187233002: Add ContentSuggestionsCategoryFactory; Store categories as ints (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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_service_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_service_unittest.cc b/components/ntp_snippets/ntp_snippets_service_unittest.cc
index b5d01dc79c60c3629f2f7d77e536b11215300b3d..a36f53f7152dd5df29559fdfa65a3e179c47949d 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -23,6 +23,7 @@
#include "base/time/time.h"
#include "components/image_fetcher/image_decoder.h"
#include "components/image_fetcher/image_fetcher.h"
+#include "components/ntp_snippets/content_suggestions_category_factory.h"
#include "components/ntp_snippets/ntp_snippet.h"
#include "components/ntp_snippets/ntp_snippets_database.h"
#include "components/ntp_snippets/ntp_snippets_fetcher.h"
@@ -325,7 +326,7 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
SetUpFetchResponse(GetTestJson({GetSnippet()}));
service_.reset(new NTPSnippetsService(
- enabled, pref_service(), nullptr, "fr", &scheduler_,
+ enabled, pref_service(), nullptr, &category_factory_, "fr", &scheduler_,
std::move(snippets_fetcher), /*image_fetcher=*/nullptr,
/*image_fetcher=*/nullptr, base::MakeUnique<NTPSnippetsDatabase>(
database_dir_.path(), task_runner),
@@ -337,8 +338,9 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
}
std::string MakeUniqueID(const std::string& within_category_id) {
- return NTPSnippetsService::MakeUniqueID(
- ContentSuggestionsCategory::ARTICLES, within_category_id);
+ return service()->MakeUniqueID(category_factory_.FromKnownCategory(
+ KnownSuggestionsCategories::ARTICLES),
+ within_category_id);
}
protected:
@@ -366,6 +368,7 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
const GURL test_url_;
std::unique_ptr<OAuth2TokenService> fake_token_service_;
MockScheduler scheduler_;
+ ContentSuggestionsCategoryFactory category_factory_;
// Last so that the dependencies are deleted after the service.
std::unique_ptr<NTPSnippetsService> service_;

Powered by Google App Engine
This is Rietveld 408576698