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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = | 294 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = |
295 new net::TestURLRequestContextGetter(mock_task_runner_.get()); | 295 new net::TestURLRequestContextGetter(mock_task_runner_.get()); |
296 | 296 |
297 fake_token_service_ = base::MakeUnique<FakeProfileOAuth2TokenService>( | 297 fake_token_service_ = base::MakeUnique<FakeProfileOAuth2TokenService>( |
298 base::MakeUnique<FakeOAuth2TokenServiceDelegate>( | 298 base::MakeUnique<FakeOAuth2TokenServiceDelegate>( |
299 request_context_getter.get())); | 299 request_context_getter.get())); |
300 | 300 |
301 fetcher_ = base::MakeUnique<RemoteSuggestionsFetcher>( | 301 fetcher_ = base::MakeUnique<RemoteSuggestionsFetcher>( |
302 utils_.fake_signin_manager(), fake_token_service_.get(), | 302 utils_.fake_signin_manager(), fake_token_service_.get(), |
303 std::move(request_context_getter), utils_.pref_service(), nullptr, | 303 std::move(request_context_getter), utils_.pref_service(), nullptr, |
304 base::Bind(&ParseJsonDelayed), kAPIKey, user_classifier_.get()); | 304 base::Bind(&ParseJsonDelayed), |
| 305 GetFetchEndpoint(version_info::Channel::STABLE), kAPIKey, |
| 306 user_classifier_.get()); |
305 | 307 |
306 fetcher_->SetClockForTesting(mock_task_runner_->GetMockClock()); | 308 fetcher_->SetClockForTesting(mock_task_runner_->GetMockClock()); |
307 } | 309 } |
308 | 310 |
309 void SignIn() { utils_.fake_signin_manager()->SignIn(kTestEmail); } | 311 void SignIn() { utils_.fake_signin_manager()->SignIn(kTestEmail); } |
310 | 312 |
311 void IssueRefreshToken() { | 313 void IssueRefreshToken() { |
312 fake_token_service_->GetDelegate()->UpdateCredentials(kTestEmail, "token"); | 314 fake_token_service_->GetDelegate()->UpdateCredentials(kTestEmail, "token"); |
313 } | 315 } |
314 | 316 |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 fetched_categories) { | 1017 fetched_categories) { |
1016 if (fetched_categories) { | 1018 if (fetched_categories) { |
1017 // Matchers above aren't any more precise than this, so this is sufficient | 1019 // Matchers above aren't any more precise than this, so this is sufficient |
1018 // for test-failure diagnostics. | 1020 // for test-failure diagnostics. |
1019 return os << "list with " << fetched_categories->size() << " elements"; | 1021 return os << "list with " << fetched_categories->size() << " elements"; |
1020 } | 1022 } |
1021 return os << "null"; | 1023 return os << "null"; |
1022 } | 1024 } |
1023 | 1025 |
1024 } // namespace ntp_snippets | 1026 } // namespace ntp_snippets |
OLD | NEW |