| 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/run_loop.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "ipc/ipc_channel_handle.h" |
| 18 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
| 19 #include "ipc/ipc_message_macros.h" | 20 #include "ipc/ipc_message_macros.h" |
| 20 #include "ipc/ipc_platform_file.h" | |
| 21 #include "remoting/base/auto_thread_task_runner.h" | 21 #include "remoting/base/auto_thread_task_runner.h" |
| 22 #include "remoting/host/chromoting_messages.h" | 22 #include "remoting/host/chromoting_messages.h" |
| 23 #include "remoting/host/desktop_session.h" | 23 #include "remoting/host/desktop_session.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "testing/gmock_mutant.h" | 25 #include "testing/gmock_mutant.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 using testing::_; | 28 using testing::_; |
| 29 using testing::AnyNumber; | 29 using testing::AnyNumber; |
| 30 using testing::InSequence; | 30 using testing::InSequence; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 int terminal_id, | 67 int terminal_id, |
| 68 const ScreenResolution& resolution, | 68 const ScreenResolution& resolution, |
| 69 bool virtual_terminal) override; | 69 bool virtual_terminal) override; |
| 70 | 70 |
| 71 bool OnMessageReceived(const IPC::Message& message) override; | 71 bool OnMessageReceived(const IPC::Message& message) override; |
| 72 void SendToNetwork(IPC::Message* message) override; | 72 void SendToNetwork(IPC::Message* message) override; |
| 73 | 73 |
| 74 MOCK_METHOD1(Received, void(const IPC::Message&)); | 74 MOCK_METHOD1(Received, void(const IPC::Message&)); |
| 75 MOCK_METHOD1(Sent, void(const IPC::Message&)); | 75 MOCK_METHOD1(Sent, void(const IPC::Message&)); |
| 76 | 76 |
| 77 MOCK_METHOD3(OnDesktopSessionAgentAttached, | 77 MOCK_METHOD2(OnDesktopSessionAgentAttached, |
| 78 bool(int, base::ProcessHandle, IPC::PlatformFileForTransit)); | 78 bool(int, const IPC::ChannelHandle&)); |
| 79 | 79 |
| 80 MOCK_METHOD1(DoCreateDesktopSessionPtr, DesktopSession*(int)); | 80 MOCK_METHOD1(DoCreateDesktopSessionPtr, DesktopSession*(int)); |
| 81 MOCK_METHOD1(DoCrashNetworkProcess, void(const tracked_objects::Location&)); | 81 MOCK_METHOD1(DoCrashNetworkProcess, void(const tracked_objects::Location&)); |
| 82 MOCK_METHOD0(LaunchNetworkProcess, void()); | 82 MOCK_METHOD0(LaunchNetworkProcess, void()); |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(MockDaemonProcess); | 85 DISALLOW_COPY_AND_ASSIGN(MockDaemonProcess); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 FakeDesktopSession::FakeDesktopSession(DaemonProcess* daemon_process, int id) | 88 FakeDesktopSession::FakeDesktopSession(DaemonProcess* daemon_process, int id) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 EXPECT_EQ(1u, desktop_sessions().size()); | 340 EXPECT_EQ(1u, desktop_sessions().size()); |
| 341 EXPECT_EQ(id, desktop_sessions().front()->id()); | 341 EXPECT_EQ(id, desktop_sessions().front()->id()); |
| 342 | 342 |
| 343 EXPECT_TRUE(daemon_process_->OnMessageReceived( | 343 EXPECT_TRUE(daemon_process_->OnMessageReceived( |
| 344 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); | 344 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); |
| 345 EXPECT_TRUE(desktop_sessions().empty()); | 345 EXPECT_TRUE(desktop_sessions().empty()); |
| 346 EXPECT_EQ(0, terminal_id_); | 346 EXPECT_EQ(0, terminal_id_); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace remoting | 349 } // namespace remoting |
| OLD | NEW |