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

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

Issue 2685123002: Make OAuth2TokenService and subclasses take delegate by unique_ptr (Closed)
Patch Set: Created 3 years, 10 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/remote/remote_suggestions_fetcher_unittest.cc
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc
index 54a5cf03078d120f6d55351a0fd552aebd6b582b..28e4d79f224f11f21c6f83420067592a0ec3c181 100644
--- a/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc
@@ -295,12 +295,9 @@ class RemoteSuggestionsFetcherTestBase : public testing::Test {
scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
new net::TestURLRequestContextGetter(mock_task_runner_.get());
- fake_token_service_delegate_ =
- new FakeOAuth2TokenServiceDelegate(request_context_getter.get());
- // Not a memleak because OAuth2TokenService takes ownership of the raw
- // pointer (crbug.com/688387).
fake_token_service_ = base::MakeUnique<FakeProfileOAuth2TokenService>(
- fake_token_service_delegate_);
+ base::MakeUnique<FakeOAuth2TokenServiceDelegate>(
+ request_context_getter.get()));
fetcher_ = base::MakeUnique<RemoteSuggestionsFetcher>(
utils_.fake_signin_manager(), fake_token_service_.get(),
@@ -313,7 +310,7 @@ class RemoteSuggestionsFetcherTestBase : public testing::Test {
void SignIn() { utils_.fake_signin_manager()->SignIn(kTestEmail); }
void IssueRefreshToken() {
- fake_token_service_delegate_->UpdateCredentials(kTestEmail, "token");
+ fake_token_service_->GetDelegate()->UpdateCredentials(kTestEmail, "token");
}
void IssueOAuth2Token() {
@@ -386,7 +383,6 @@ class RemoteSuggestionsFetcherTestBase : public testing::Test {
FailingFakeURLFetcherFactory failing_url_fetcher_factory_;
// Initialized lazily in SetFakeResponse().
std::unique_ptr<net::FakeURLFetcherFactory> fake_url_fetcher_factory_;
- FakeOAuth2TokenServiceDelegate* fake_token_service_delegate_;
std::unique_ptr<FakeProfileOAuth2TokenService> fake_token_service_;
std::unique_ptr<RemoteSuggestionsFetcher> fetcher_;
std::unique_ptr<UserClassifier> user_classifier_;

Powered by Google App Engine
This is Rietveld 408576698