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/run_loop.h" |
16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
17 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
18 #include "ipc/ipc_message_macros.h" | 19 #include "ipc/ipc_message_macros.h" |
19 #include "ipc/ipc_platform_file.h" | 20 #include "ipc/ipc_platform_file.h" |
20 #include "remoting/base/auto_thread_task_runner.h" | 21 #include "remoting/base/auto_thread_task_runner.h" |
21 #include "remoting/host/chromoting_messages.h" | 22 #include "remoting/host/chromoting_messages.h" |
22 #include "remoting/host/desktop_session.h" | 23 #include "remoting/host/desktop_session.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gmock_mutant.h" | 25 #include "testing/gmock_mutant.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 EXPECT_CALL(*daemon_process_, DoCrashNetworkProcess(_)) | 180 EXPECT_CALL(*daemon_process_, DoCrashNetworkProcess(_)) |
180 .Times(AnyNumber()) | 181 .Times(AnyNumber()) |
181 .WillRepeatedly(Invoke(this, &DaemonProcessTest::DoCrashNetworkProcess)); | 182 .WillRepeatedly(Invoke(this, &DaemonProcessTest::DoCrashNetworkProcess)); |
182 EXPECT_CALL(*daemon_process_, LaunchNetworkProcess()) | 183 EXPECT_CALL(*daemon_process_, LaunchNetworkProcess()) |
183 .Times(AnyNumber()) | 184 .Times(AnyNumber()) |
184 .WillRepeatedly(Invoke(this, &DaemonProcessTest::LaunchNetworkProcess)); | 185 .WillRepeatedly(Invoke(this, &DaemonProcessTest::LaunchNetworkProcess)); |
185 } | 186 } |
186 | 187 |
187 void DaemonProcessTest::TearDown() { | 188 void DaemonProcessTest::TearDown() { |
188 daemon_process_->Stop(); | 189 daemon_process_->Stop(); |
189 message_loop_.Run(); | 190 base::RunLoop().Run(); |
190 } | 191 } |
191 | 192 |
192 DesktopSession* DaemonProcessTest::DoCreateDesktopSession(int terminal_id) { | 193 DesktopSession* DaemonProcessTest::DoCreateDesktopSession(int terminal_id) { |
193 return new FakeDesktopSession(daemon_process_.get(), terminal_id); | 194 return new FakeDesktopSession(daemon_process_.get(), terminal_id); |
194 } | 195 } |
195 | 196 |
196 void DaemonProcessTest::DoCrashNetworkProcess( | 197 void DaemonProcessTest::DoCrashNetworkProcess( |
197 const tracked_objects::Location& location) { | 198 const tracked_objects::Location& location) { |
198 daemon_process_->SendToNetwork( | 199 daemon_process_->SendToNetwork( |
199 new ChromotingDaemonMsg_Crash(location.function_name(), | 200 new ChromotingDaemonMsg_Crash(location.function_name(), |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 EXPECT_EQ(1u, desktop_sessions().size()); | 340 EXPECT_EQ(1u, desktop_sessions().size()); |
340 EXPECT_EQ(id, desktop_sessions().front()->id()); | 341 EXPECT_EQ(id, desktop_sessions().front()->id()); |
341 | 342 |
342 EXPECT_TRUE(daemon_process_->OnMessageReceived( | 343 EXPECT_TRUE(daemon_process_->OnMessageReceived( |
343 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); | 344 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); |
344 EXPECT_TRUE(desktop_sessions().empty()); | 345 EXPECT_TRUE(desktop_sessions().empty()); |
345 EXPECT_EQ(0, terminal_id_); | 346 EXPECT_EQ(0, terminal_id_); |
346 } | 347 } |
347 | 348 |
348 } // namespace remoting | 349 } // namespace remoting |
OLD | NEW |