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

Unified Diff: components/ntp_snippets/ntp_snippets_service_unittest.cc

Issue 1922083004: Allow fetching personalized snippets from ChromeReader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase update Created 4 years, 7 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 fcc6727fdf90ed00b5753aaa2515d0b466d19ec4..d475e514b4ef75781528e0b9caaf1a1f1e13083f 100644
--- a/components/ntp_snippets/ntp_snippets_service_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_service_unittest.cc
@@ -21,6 +21,10 @@
#include "components/ntp_snippets/ntp_snippets_fetcher.h"
#include "components/ntp_snippets/ntp_snippets_scheduler.h"
#include "components/prefs/testing_pref_service.h"
+#include "components/signin/core/browser/account_tracker_service.h"
+#include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
+#include "components/signin/core/browser/fake_signin_manager.h"
+#include "components/signin/core/browser/test_signin_client.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -178,7 +182,9 @@ class MockScheduler : public NTPSnippetsScheduler {
class NTPSnippetsServiceTest : public testing::Test {
public:
NTPSnippetsServiceTest()
- : pref_service_(new TestingPrefServiceSimple()) {}
+ : pref_service_(new TestingPrefServiceSimple()),
+ signin_client_(new TestSigninClient(nullptr)),
+ account_tracker_(new AccountTrackerService()) {}
~NTPSnippetsServiceTest() override {}
void SetUp() override {
@@ -197,11 +203,16 @@ class NTPSnippetsServiceTest : public testing::Test {
base::ThreadTaskRunnerHandle::Get());
scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
new net::TestURLRequestContextGetter(task_runner.get());
+ FakeSigninManagerBase* signin_manager = new FakeSigninManagerBase(
+ signin_client_.get(), account_tracker_.get());
+ FakeProfileOAuth2TokenService* token_service =
+ new FakeProfileOAuth2TokenService();
service_.reset(new NTPSnippetsService(
pref_service_.get(), nullptr, task_runner, std::string("fr"),
scheduler_.get(),
base::WrapUnique(new NTPSnippetsFetcher(
+ signin_manager, token_service,
std::move(request_context_getter), true)),
base::Bind(&ParseJson, true)));
if (enabled)
@@ -225,6 +236,8 @@ class NTPSnippetsServiceTest : public testing::Test {
private:
base::MessageLoop message_loop_;
std::unique_ptr<TestingPrefServiceSimple> pref_service_;
+ std::unique_ptr<TestSigninClient> signin_client_;
+ std::unique_ptr<AccountTrackerService> account_tracker_;
std::unique_ptr<NTPSnippetsService> service_;
std::unique_ptr<MockScheduler> scheduler_;

Powered by Google App Engine
This is Rietveld 408576698