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

Side by Side Diff: components/ntp_snippets/remote/remote_suggestions_fetcher_unittest.cc

Issue 2714863004: [Remote suggestions] Move the throttler into the Scheduler (Closed)
Patch Set: Comments #1 Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 public: 276 public:
277 explicit RemoteSuggestionsFetcherTestBase(const GURL& gurl) 277 explicit RemoteSuggestionsFetcherTestBase(const GURL& gurl)
278 : default_variation_params_( 278 : default_variation_params_(
279 {{"send_top_languages", "true"}, {"send_user_class", "true"}}), 279 {{"send_top_languages", "true"}, {"send_user_class", "true"}}),
280 params_manager_(ntp_snippets::kStudyName, 280 params_manager_(ntp_snippets::kStudyName,
281 default_variation_params_, 281 default_variation_params_,
282 {ntp_snippets::kArticleSuggestionsFeature.name}), 282 {ntp_snippets::kArticleSuggestionsFeature.name}),
283 mock_task_runner_(new base::TestMockTimeTaskRunner()), 283 mock_task_runner_(new base::TestMockTimeTaskRunner()),
284 mock_task_runner_handle_(mock_task_runner_), 284 mock_task_runner_handle_(mock_task_runner_),
285 test_url_(gurl) { 285 test_url_(gurl) {
286 RequestThrottler::RegisterProfilePrefs(utils_.pref_service()->registry());
287 UserClassifier::RegisterProfilePrefs(utils_.pref_service()->registry()); 286 UserClassifier::RegisterProfilePrefs(utils_.pref_service()->registry());
288 user_classifier_ = base::MakeUnique<UserClassifier>(utils_.pref_service()); 287 user_classifier_ = base::MakeUnique<UserClassifier>(utils_.pref_service());
289 // Increase initial time such that ticks are non-zero. 288 // Increase initial time such that ticks are non-zero.
290 mock_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(1234)); 289 mock_task_runner_->FastForwardBy(base::TimeDelta::FromMilliseconds(1234));
291 ResetFetcher(); 290 ResetFetcher();
292 } 291 }
293 292
294 void ResetFetcher() { 293 void ResetFetcher() {
295 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter = 294 scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
296 new net::TestURLRequestContextGetter(mock_task_runner_.get()); 295 new net::TestURLRequestContextGetter(mock_task_runner_.get());
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 fetched_categories) { 1015 fetched_categories) {
1017 if (fetched_categories) { 1016 if (fetched_categories) {
1018 // Matchers above aren't any more precise than this, so this is sufficient 1017 // Matchers above aren't any more precise than this, so this is sufficient
1019 // for test-failure diagnostics. 1018 // for test-failure diagnostics.
1020 return os << "list with " << fetched_categories->size() << " elements"; 1019 return os << "list with " << fetched_categories->size() << " elements";
1021 } 1020 }
1022 return os << "null"; 1021 return os << "null";
1023 } 1022 }
1024 1023
1025 } // namespace ntp_snippets 1024 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698