OLD | NEW |
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 "components/policy/core/common/remote_commands/testing_remote_commands_
server.h" | 5 #include "components/policy/core/common/remote_commands/testing_remote_commands_
server.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/callback.h" | 10 #include "base/callback.h" |
9 #include "base/location.h" | 11 #include "base/location.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
12 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
13 #include "base/time/default_tick_clock.h" | 15 #include "base/time/default_tick_clock.h" |
14 #include "base/time/tick_clock.h" | 16 #include "base/time/tick_clock.h" |
15 #include "base/time/time.h" | 17 #include "base/time/time.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Push delayed commands into the main queue. | 130 // Push delayed commands into the main queue. |
129 commands_.insert(commands_.end(), commands_issued_after_next_fetch_.begin(), | 131 commands_.insert(commands_.end(), commands_issued_after_next_fetch_.begin(), |
130 commands_issued_after_next_fetch_.end()); | 132 commands_issued_after_next_fetch_.end()); |
131 commands_issued_after_next_fetch_.clear(); | 133 commands_issued_after_next_fetch_.clear(); |
132 | 134 |
133 return fetched_commands; | 135 return fetched_commands; |
134 } | 136 } |
135 | 137 |
136 void TestingRemoteCommandsServer::SetClock(scoped_ptr<base::TickClock> clock) { | 138 void TestingRemoteCommandsServer::SetClock(scoped_ptr<base::TickClock> clock) { |
137 DCHECK(thread_checker_.CalledOnValidThread()); | 139 DCHECK(thread_checker_.CalledOnValidThread()); |
138 clock_ = clock.Pass(); | 140 clock_ = std::move(clock); |
139 } | 141 } |
140 | 142 |
141 size_t TestingRemoteCommandsServer::NumberOfCommandsPendingResult() const { | 143 size_t TestingRemoteCommandsServer::NumberOfCommandsPendingResult() const { |
142 DCHECK(thread_checker_.CalledOnValidThread()); | 144 DCHECK(thread_checker_.CalledOnValidThread()); |
143 return commands_.size(); | 145 return commands_.size(); |
144 } | 146 } |
145 | 147 |
146 void TestingRemoteCommandsServer::ReportJobResult( | 148 void TestingRemoteCommandsServer::ReportJobResult( |
147 const ResultReportedCallback& reported_callback, | 149 const ResultReportedCallback& reported_callback, |
148 const em::RemoteCommandResult& job_result) const { | 150 const em::RemoteCommandResult& job_result) const { |
149 DCHECK(thread_checker_.CalledOnValidThread()); | 151 DCHECK(thread_checker_.CalledOnValidThread()); |
150 reported_callback.Run(job_result); | 152 reported_callback.Run(job_result); |
151 } | 153 } |
152 | 154 |
153 } // namespace policy | 155 } // namespace policy |
OLD | NEW |