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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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_discardable_memory_allocator.cc ('k') | base/test/test_mock_time_task_runner.cc » ('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 #ifndef BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ 5 #ifndef BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_
6 #define BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ 6 #define BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory>
10 #include <queue> 11 #include <queue>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
17 #include "base/test/test_pending_task.h" 17 #include "base/test/test_pending_task.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 20
21 namespace base { 21 namespace base {
22 22
23 class Clock; 23 class Clock;
24 class TickClock; 24 class TickClock;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void ClearPendingTasks(); 70 void ClearPendingTasks();
71 71
72 // Returns the current virtual time (initially starting at the Unix epoch). 72 // Returns the current virtual time (initially starting at the Unix epoch).
73 Time Now() const; 73 Time Now() const;
74 74
75 // Returns the current virtual tick time (initially starting at 0). 75 // Returns the current virtual tick time (initially starting at 0).
76 TimeTicks NowTicks() const; 76 TimeTicks NowTicks() const;
77 77
78 // Returns a Clock that uses the virtual time of |this| as its time source. 78 // Returns a Clock that uses the virtual time of |this| as its time source.
79 // The returned Clock will hold a reference to |this|. 79 // The returned Clock will hold a reference to |this|.
80 scoped_ptr<Clock> GetMockClock() const; 80 std::unique_ptr<Clock> GetMockClock() const;
81 81
82 // Returns a TickClock that uses the virtual time ticks of |this| as its tick 82 // Returns a TickClock that uses the virtual time ticks of |this| as its tick
83 // source. The returned TickClock will hold a reference to |this|. 83 // source. The returned TickClock will hold a reference to |this|.
84 scoped_ptr<TickClock> GetMockTickClock() const; 84 std::unique_ptr<TickClock> GetMockTickClock() const;
85 85
86 bool HasPendingTask() const; 86 bool HasPendingTask() const;
87 size_t GetPendingTaskCount() const; 87 size_t GetPendingTaskCount() const;
88 TimeDelta NextPendingTaskDelay() const; 88 TimeDelta NextPendingTaskDelay() const;
89 89
90 // SingleThreadTaskRunner: 90 // SingleThreadTaskRunner:
91 bool RunsTasksOnCurrentThread() const override; 91 bool RunsTasksOnCurrentThread() const override;
92 bool PostDelayedTask(const tracked_objects::Location& from_here, 92 bool PostDelayedTask(const tracked_objects::Location& from_here,
93 const Closure& task, 93 const Closure& task,
94 TimeDelta delay) override; 94 TimeDelta delay) override;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 size_t next_task_ordinal_; 161 size_t next_task_ordinal_;
162 162
163 Lock tasks_lock_; 163 Lock tasks_lock_;
164 164
165 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner); 165 DISALLOW_COPY_AND_ASSIGN(TestMockTimeTaskRunner);
166 }; 166 };
167 167
168 } // namespace base 168 } // namespace base
169 169
170 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_ 170 #endif // BASE_TEST_TEST_MOCK_TIME_TASK_RUNNER_H_
OLDNEW
« no previous file with comments | « base/test/test_discardable_memory_allocator.cc ('k') | base/test/test_mock_time_task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698