OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/host/daemon_process.h" | 5 #include "remoting/host/daemon_process.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
| 16 #include "base/single_thread_task_runner.h" |
16 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
17 #include "ipc/ipc_message_macros.h" | 18 #include "ipc/ipc_message_macros.h" |
18 #include "ipc/ipc_platform_file.h" | 19 #include "ipc/ipc_platform_file.h" |
19 #include "remoting/base/auto_thread_task_runner.h" | 20 #include "remoting/base/auto_thread_task_runner.h" |
20 #include "remoting/host/chromoting_messages.h" | 21 #include "remoting/host/chromoting_messages.h" |
21 #include "remoting/host/desktop_session.h" | 22 #include "remoting/host/desktop_session.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gmock_mutant.h" | 24 #include "testing/gmock_mutant.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
25 | 26 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 void DaemonProcessTest::LaunchNetworkProcess() { | 204 void DaemonProcessTest::LaunchNetworkProcess() { |
204 terminal_id_ = 0; | 205 terminal_id_ = 0; |
205 daemon_process_->OnChannelConnected(0); | 206 daemon_process_->OnChannelConnected(0); |
206 } | 207 } |
207 | 208 |
208 void DaemonProcessTest::DeleteDaemonProcess() { | 209 void DaemonProcessTest::DeleteDaemonProcess() { |
209 daemon_process_.reset(); | 210 daemon_process_.reset(); |
210 } | 211 } |
211 | 212 |
212 void DaemonProcessTest::QuitMessageLoop() { | 213 void DaemonProcessTest::QuitMessageLoop() { |
213 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 214 message_loop_.task_runner()->PostTask( |
| 215 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
214 } | 216 } |
215 | 217 |
216 void DaemonProcessTest::StartDaemonProcess() { | 218 void DaemonProcessTest::StartDaemonProcess() { |
217 // DaemonProcess::Initialize() sets up the config watcher that this test does | 219 // DaemonProcess::Initialize() sets up the config watcher that this test does |
218 // not support. Launch the process directly. | 220 // not support. Launch the process directly. |
219 daemon_process_->LaunchNetworkProcess(); | 221 daemon_process_->LaunchNetworkProcess(); |
220 } | 222 } |
221 | 223 |
222 MATCHER_P(Message, type, "") { | 224 MATCHER_P(Message, type, "") { |
223 return arg.type() == static_cast<uint32_t>(type); | 225 return arg.type() == static_cast<uint32_t>(type); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 EXPECT_EQ(1u, desktop_sessions().size()); | 339 EXPECT_EQ(1u, desktop_sessions().size()); |
338 EXPECT_EQ(id, desktop_sessions().front()->id()); | 340 EXPECT_EQ(id, desktop_sessions().front()->id()); |
339 | 341 |
340 EXPECT_TRUE(daemon_process_->OnMessageReceived( | 342 EXPECT_TRUE(daemon_process_->OnMessageReceived( |
341 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); | 343 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); |
342 EXPECT_TRUE(desktop_sessions().empty()); | 344 EXPECT_TRUE(desktop_sessions().empty()); |
343 EXPECT_EQ(0, terminal_id_); | 345 EXPECT_EQ(0, terminal_id_); |
344 } | 346 } |
345 | 347 |
346 } // namespace remoting | 348 } // namespace remoting |
OLD | NEW |