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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/process.h" | |
8 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
9 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
10 #include "ipc/ipc_message_macros.h" | 11 #include "ipc/ipc_message_macros.h" |
12 #include "ipc/ipc_platform_file.h" | |
11 #include "remoting/base/auto_thread_task_runner.h" | 13 #include "remoting/base/auto_thread_task_runner.h" |
12 #include "remoting/host/chromoting_messages.h" | 14 #include "remoting/host/chromoting_messages.h" |
13 #include "remoting/host/daemon_process.h" | 15 #include "remoting/host/daemon_process.h" |
14 #include "remoting/host/desktop_session.h" | 16 #include "remoting/host/desktop_session.h" |
15 #include "testing/gmock_mutant.h" | 17 #include "testing/gmock_mutant.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
18 | 20 |
19 using testing::_; | 21 using testing::_; |
20 using testing::AnyNumber; | 22 using testing::AnyNumber; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
53 virtual ~MockDaemonProcess(); | 55 virtual ~MockDaemonProcess(); |
54 | 56 |
55 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( | 57 virtual scoped_ptr<DesktopSession> DoCreateDesktopSession( |
56 int terminal_id) OVERRIDE; | 58 int terminal_id) OVERRIDE; |
57 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
58 virtual void SendToNetwork(IPC::Message* message) OVERRIDE; | 60 virtual void SendToNetwork(IPC::Message* message) OVERRIDE; |
59 | 61 |
60 MOCK_METHOD1(Received, void(const IPC::Message&)); | 62 MOCK_METHOD1(Received, void(const IPC::Message&)); |
61 MOCK_METHOD1(Sent, void(const IPC::Message&)); | 63 MOCK_METHOD1(Sent, void(const IPC::Message&)); |
62 | 64 |
65 MOCK_METHOD3(OnDesktopSessionAgentAttached, bool( | |
Sergey Ulanov
2012/10/24 20:12:01
nit: move "bool(" to the next line.
alexeypa (please no reviews)
2012/10/24 21:41:51
Done.
| |
66 int, base::ProcessHandle, IPC::PlatformFileForTransit)); | |
67 | |
63 MOCK_METHOD1(DoCreateDesktopSessionPtr, DesktopSession*(int)); | 68 MOCK_METHOD1(DoCreateDesktopSessionPtr, DesktopSession*(int)); |
64 MOCK_METHOD0(LaunchNetworkProcess, void()); | 69 MOCK_METHOD0(LaunchNetworkProcess, void()); |
65 | 70 |
66 private: | 71 private: |
67 DISALLOW_COPY_AND_ASSIGN(MockDaemonProcess); | 72 DISALLOW_COPY_AND_ASSIGN(MockDaemonProcess); |
68 }; | 73 }; |
69 | 74 |
70 FakeDesktopSession::FakeDesktopSession(DaemonProcess* daemon_process, int id) | 75 FakeDesktopSession::FakeDesktopSession(DaemonProcess* daemon_process, int id) |
71 : DesktopSession(daemon_process, id) { | 76 : DesktopSession(daemon_process, id) { |
72 } | 77 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
306 EXPECT_EQ(1u, desktop_sessions().size()); | 311 EXPECT_EQ(1u, desktop_sessions().size()); |
307 EXPECT_EQ(id, desktop_sessions().front()->id()); | 312 EXPECT_EQ(id, desktop_sessions().front()->id()); |
308 | 313 |
309 EXPECT_TRUE(daemon_process_->OnMessageReceived( | 314 EXPECT_TRUE(daemon_process_->OnMessageReceived( |
310 ChromotingNetworkHostMsg_ConnectTerminal(id))); | 315 ChromotingNetworkHostMsg_ConnectTerminal(id))); |
311 EXPECT_TRUE(desktop_sessions().empty()); | 316 EXPECT_TRUE(desktop_sessions().empty()); |
312 EXPECT_EQ(0, terminal_id_); | 317 EXPECT_EQ(0, terminal_id_); |
313 } | 318 } |
314 | 319 |
315 } // namespace remoting | 320 } // namespace remoting |
OLD | NEW |