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

Side by Side Diff: base/test/test_mock_time_task_runner.cc

Issue 807503002: Implement throttling logic for fetching affiliation information. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@aff_database
Patch Set: Fix ambiguity with pow() on Android. Created 5 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 unified diff | Download patch
« no previous file with comments | « base/test/test_mock_time_task_runner.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/test/test_mock_time_task_runner.h" 5 #include "base/test/test_mock_time_task_runner.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 scoped_ptr<TickClock> TestMockTimeTaskRunner::GetMockTickClock() const { 95 scoped_ptr<TickClock> TestMockTimeTaskRunner::GetMockTickClock() const {
96 DCHECK(thread_checker_.CalledOnValidThread()); 96 DCHECK(thread_checker_.CalledOnValidThread());
97 return make_scoped_ptr(new MockTickClock(this)); 97 return make_scoped_ptr(new MockTickClock(this));
98 } 98 }
99 99
100 bool TestMockTimeTaskRunner::HasPendingTask() const { 100 bool TestMockTimeTaskRunner::HasPendingTask() const {
101 DCHECK(thread_checker_.CalledOnValidThread()); 101 DCHECK(thread_checker_.CalledOnValidThread());
102 return !tasks_.empty(); 102 return !tasks_.empty();
103 } 103 }
104 104
105 size_t TestMockTimeTaskRunner::GetPendingTaskCount() const {
106 DCHECK(thread_checker_.CalledOnValidThread());
107 return tasks_.size();
108 }
109
105 TimeDelta TestMockTimeTaskRunner::NextPendingTaskDelay() const { 110 TimeDelta TestMockTimeTaskRunner::NextPendingTaskDelay() const {
106 DCHECK(thread_checker_.CalledOnValidThread()); 111 DCHECK(thread_checker_.CalledOnValidThread());
107 return tasks_.empty() ? TimeDelta::Max() : tasks_.top().GetTimeToRun() - now_; 112 return tasks_.empty() ? TimeDelta::Max() : tasks_.top().GetTimeToRun() - now_;
108 } 113 }
109 114
110 bool TestMockTimeTaskRunner::RunsTasksOnCurrentThread() const { 115 bool TestMockTimeTaskRunner::RunsTasksOnCurrentThread() const {
111 return thread_checker_.CalledOnValidThread(); 116 return thread_checker_.CalledOnValidThread();
112 } 117 }
113 118
114 bool TestMockTimeTaskRunner::PostDelayedTask( 119 bool TestMockTimeTaskRunner::PostDelayedTask(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (!tasks_.empty() && 153 if (!tasks_.empty() &&
149 (tasks_.top().GetTimeToRun() - reference) <= max_delta) { 154 (tasks_.top().GetTimeToRun() - reference) <= max_delta) {
150 *next_task = tasks_.top(); 155 *next_task = tasks_.top();
151 tasks_.pop(); 156 tasks_.pop();
152 return true; 157 return true;
153 } 158 }
154 return false; 159 return false;
155 } 160 }
156 161
157 } // namespace base 162 } // namespace base
OLDNEW
« no previous file with comments | « base/test/test_mock_time_task_runner.h ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698