| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/ntp_snippets/remote/remote_suggestions_fetcher.h" | 5 #include "components/ntp_snippets/remote/remote_suggestions_fetcher.h" |
| 6 | 6 |
| 7 #include <deque> | 7 #include <deque> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = | 295 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = |
| 296 new net::TestURLRequestContextGetter(mock_task_runner_.get()); | 296 new net::TestURLRequestContextGetter(mock_task_runner_.get()); |
| 297 | 297 |
| 298 fake_token_service_ = base::MakeUnique<FakeProfileOAuth2TokenService>( | 298 fake_token_service_ = base::MakeUnique<FakeProfileOAuth2TokenService>( |
| 299 base::MakeUnique<FakeOAuth2TokenServiceDelegate>( | 299 base::MakeUnique<FakeOAuth2TokenServiceDelegate>( |
| 300 request_context_getter.get())); | 300 request_context_getter.get())); |
| 301 | 301 |
| 302 fetcher_ = base::MakeUnique<RemoteSuggestionsFetcher>( | 302 fetcher_ = base::MakeUnique<RemoteSuggestionsFetcher>( |
| 303 utils_.fake_signin_manager(), fake_token_service_.get(), | 303 utils_.fake_signin_manager(), fake_token_service_.get(), |
| 304 std::move(request_context_getter), utils_.pref_service(), nullptr, | 304 std::move(request_context_getter), utils_.pref_service(), nullptr, |
| 305 base::Bind(&ParseJsonDelayed), kAPIKey, user_classifier_.get()); | 305 base::Bind(&ParseJsonDelayed), |
| 306 GetFetchEndpoint(/*is_stable_or_beta_channel=*/true), kAPIKey, |
| 307 user_classifier_.get()); |
| 306 | 308 |
| 307 fetcher_->SetClockForTesting(mock_task_runner_->GetMockClock()); | 309 fetcher_->SetClockForTesting(mock_task_runner_->GetMockClock()); |
| 308 } | 310 } |
| 309 | 311 |
| 310 void SignIn() { utils_.fake_signin_manager()->SignIn(kTestEmail); } | 312 void SignIn() { utils_.fake_signin_manager()->SignIn(kTestEmail); } |
| 311 | 313 |
| 312 void IssueRefreshToken() { | 314 void IssueRefreshToken() { |
| 313 fake_token_service_->GetDelegate()->UpdateCredentials(kTestEmail, "token"); | 315 fake_token_service_->GetDelegate()->UpdateCredentials(kTestEmail, "token"); |
| 314 } | 316 } |
| 315 | 317 |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 fetched_categories) { | 1018 fetched_categories) { |
| 1017 if (fetched_categories) { | 1019 if (fetched_categories) { |
| 1018 // Matchers above aren't any more precise than this, so this is sufficient | 1020 // Matchers above aren't any more precise than this, so this is sufficient |
| 1019 // for test-failure diagnostics. | 1021 // for test-failure diagnostics. |
| 1020 return os << "list with " << fetched_categories->size() << " elements"; | 1022 return os << "list with " << fetched_categories->size() << " elements"; |
| 1021 } | 1023 } |
| 1022 return os << "null"; | 1024 return os << "null"; |
| 1023 } | 1025 } |
| 1024 | 1026 |
| 1025 } // namespace ntp_snippets | 1027 } // namespace ntp_snippets |
| OLD | NEW |