| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 // Receives messages sent from the network process to the daemon. | 45 // Receives messages sent from the network process to the daemon. |
| 46 class FakeDaemonSender : public IPC::Sender { | 46 class FakeDaemonSender : public IPC::Sender { |
| 47 public: | 47 public: |
| 48 FakeDaemonSender() {} | 48 FakeDaemonSender() {} |
| 49 virtual ~FakeDaemonSender() {} | 49 virtual ~FakeDaemonSender() {} |
| 50 | 50 |
| 51 // IPC::Sender implementation. | 51 // IPC::Sender implementation. |
| 52 virtual bool Send(IPC::Message* message) OVERRIDE; | 52 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 53 | 53 |
| 54 MOCK_METHOD3(ConnectTerminal, void(int, const DesktopSessionParams&, bool)); | 54 MOCK_METHOD3(ConnectTerminal, void(int, const ScreenResolution&, bool)); |
| 55 MOCK_METHOD1(DisconnectTerminal, void(int)); | 55 MOCK_METHOD1(DisconnectTerminal, void(int)); |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 void OnMessageReceived(const IPC::Message& message); | 58 void OnMessageReceived(const IPC::Message& message); |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(FakeDaemonSender); | 60 DISALLOW_COPY_AND_ASSIGN(FakeDaemonSender); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 // Receives messages sent from the desktop process to the daemon. | 63 // Receives messages sent from the desktop process to the daemon. |
| 64 class MockDaemonListener : public IPC::Listener { | 64 class MockDaemonListener : public IPC::Listener { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } // namespace | 110 } // namespace |
| 111 | 111 |
| 112 class IpcDesktopEnvironmentTest : public testing::Test { | 112 class IpcDesktopEnvironmentTest : public testing::Test { |
| 113 public: | 113 public: |
| 114 IpcDesktopEnvironmentTest(); | 114 IpcDesktopEnvironmentTest(); |
| 115 virtual ~IpcDesktopEnvironmentTest(); | 115 virtual ~IpcDesktopEnvironmentTest(); |
| 116 | 116 |
| 117 virtual void SetUp() OVERRIDE; | 117 virtual void SetUp() OVERRIDE; |
| 118 | 118 |
| 119 void ConnectTerminal(int terminal_id, | 119 void ConnectTerminal(int terminal_id, |
| 120 const DesktopSessionParams& params, | 120 const ScreenResolution& resolution, |
| 121 bool virtual_terminal); | 121 bool virtual_terminal); |
| 122 void DisconnectTerminal(int terminal_id); | 122 void DisconnectTerminal(int terminal_id); |
| 123 | 123 |
| 124 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock | 124 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock |
| 125 // DesktopEnvironmentFactory::Create(). | 125 // DesktopEnvironmentFactory::Create(). |
| 126 DesktopEnvironment* CreateDesktopEnvironment(); | 126 DesktopEnvironment* CreateDesktopEnvironment(); |
| 127 | 127 |
| 128 // Creates a dummy EventExecutor, to mock | 128 // Creates a dummy EventExecutor, to mock |
| 129 // DesktopEnvironment::CreateEventExecutor(). | 129 // DesktopEnvironment::CreateEventExecutor(). |
| 130 EventExecutor* CreateEventExecutor(); | 130 EventExecutor* CreateEventExecutor(); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 event_executor_ = | 257 event_executor_ = |
| 258 desktop_environment_->CreateEventExecutor(task_runner_, task_runner_); | 258 desktop_environment_->CreateEventExecutor(task_runner_, task_runner_); |
| 259 | 259 |
| 260 // Create the screen capturer. | 260 // Create the screen capturer. |
| 261 video_capturer_ = | 261 video_capturer_ = |
| 262 desktop_environment_->CreateVideoCapturer(task_runner_, task_runner_); | 262 desktop_environment_->CreateVideoCapturer(task_runner_, task_runner_); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void IpcDesktopEnvironmentTest::ConnectTerminal( | 265 void IpcDesktopEnvironmentTest::ConnectTerminal( |
| 266 int terminal_id, | 266 int terminal_id, |
| 267 const DesktopSessionParams& params, | 267 const ScreenResolution& resolution, |
| 268 bool virtual_terminal) { | 268 bool virtual_terminal) { |
| 269 EXPECT_NE(terminal_id_, terminal_id); | 269 EXPECT_NE(terminal_id_, terminal_id); |
| 270 | 270 |
| 271 terminal_id_ = terminal_id; | 271 terminal_id_ = terminal_id; |
| 272 CreateDesktopProcess(); | 272 CreateDesktopProcess(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void IpcDesktopEnvironmentTest::DisconnectTerminal(int terminal_id) { | 275 void IpcDesktopEnvironmentTest::DisconnectTerminal(int terminal_id) { |
| 276 EXPECT_EQ(terminal_id_, terminal_id); | 276 EXPECT_EQ(terminal_id_, terminal_id); |
| 277 | 277 |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 event.set_x(0); | 646 event.set_x(0); |
| 647 event.set_y(0); | 647 event.set_y(0); |
| 648 event_executor_->InjectMouseEvent(event); | 648 event_executor_->InjectMouseEvent(event); |
| 649 | 649 |
| 650 task_runner_ = NULL; | 650 task_runner_ = NULL; |
| 651 io_task_runner_ = NULL; | 651 io_task_runner_ = NULL; |
| 652 main_run_loop_.Run(); | 652 main_run_loop_.Run(); |
| 653 } | 653 } |
| 654 | 654 |
| 655 } // namespace remoting | 655 } // namespace remoting |
| OLD | NEW |