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

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: 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 9d56af38b90dc1b5d961c3ee86a7914847bb83a3..6387742b9fe761937bf601f1c35700b54ab3d916 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"
@@ -330,15 +331,17 @@ class NTPSnippetsServiceTest : public test::NTPSnippetsTestBase {
/*image_fetcher=*/nullptr, base::MakeUnique<NTPSnippetsDatabase>(
database_dir_.path(), task_runner),
base::MakeUnique<NTPSnippetsStatusService>(
- fake_signin_manager(), mock_sync_service(), pref_service())));
+ fake_signin_manager(), mock_sync_service(), pref_service()),
+ &category_factory_));
if (enabled)
WaitForDBLoad(service_.get());
}
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 +369,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