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

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

Issue 2494943005: [ash-md] Added a delay between system menu default/detailed view transitions. (Closed)
Patch Set: Addressed gab@'s comments. Created 4 years, 1 month 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 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 <algorithm>
gab 2016/11/18 15:13:55 why?
bruthig 2016/11/18 16:44:53 Not sure.... removed.
8
7 #include "base/logging.h" 9 #include "base/logging.h"
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
10 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
11 #include "base/time/clock.h" 13 #include "base/time/clock.h"
12 #include "base/time/tick_clock.h" 14 #include "base/time/tick_clock.h"
13 15
14 namespace base { 16 namespace base {
15 17
16 namespace { 18 namespace {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::unique_ptr<Clock> TestMockTimeTaskRunner::GetMockClock() const { 168 std::unique_ptr<Clock> TestMockTimeTaskRunner::GetMockClock() const {
167 DCHECK(thread_checker_.CalledOnValidThread()); 169 DCHECK(thread_checker_.CalledOnValidThread());
168 return MakeUnique<MockClock>(this); 170 return MakeUnique<MockClock>(this);
169 } 171 }
170 172
171 std::unique_ptr<TickClock> TestMockTimeTaskRunner::GetMockTickClock() const { 173 std::unique_ptr<TickClock> TestMockTimeTaskRunner::GetMockTickClock() const {
172 DCHECK(thread_checker_.CalledOnValidThread()); 174 DCHECK(thread_checker_.CalledOnValidThread());
173 return MakeUnique<MockTickClock>(this); 175 return MakeUnique<MockTickClock>(this);
174 } 176 }
175 177
178 std::deque<TestPendingTask> TestMockTimeTaskRunner::TakePendingTasks() {
179 std::deque<TestPendingTask> tasks;
180 while (!tasks_.empty()) {
181 tasks.push_back(tasks_.top());
182 tasks_.pop();
183 }
184 return tasks;
185 }
186
176 bool TestMockTimeTaskRunner::HasPendingTask() const { 187 bool TestMockTimeTaskRunner::HasPendingTask() const {
177 DCHECK(thread_checker_.CalledOnValidThread()); 188 DCHECK(thread_checker_.CalledOnValidThread());
178 return !tasks_.empty(); 189 return !tasks_.empty();
179 } 190 }
180 191
181 size_t TestMockTimeTaskRunner::GetPendingTaskCount() const { 192 size_t TestMockTimeTaskRunner::GetPendingTaskCount() const {
182 DCHECK(thread_checker_.CalledOnValidThread()); 193 DCHECK(thread_checker_.CalledOnValidThread());
183 return tasks_.size(); 194 return tasks_.size();
184 } 195 }
185 196
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 if (!tasks_.empty() && 271 if (!tasks_.empty() &&
261 (tasks_.top().GetTimeToRun() - reference) <= max_delta) { 272 (tasks_.top().GetTimeToRun() - reference) <= max_delta) {
262 *next_task = tasks_.top(); 273 *next_task = tasks_.top();
263 tasks_.pop(); 274 tasks_.pop();
264 return true; 275 return true;
265 } 276 }
266 return false; 277 return false;
267 } 278 }
268 279
269 } // namespace base 280 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698