| 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 <stdint.h> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 7 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/macros.h" |
| 8 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 9 #include "base/process/process.h" | 12 #include "base/process/process.h" |
| 10 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
| 11 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 12 #include "ipc/ipc_platform_file.h" | 15 #include "ipc/ipc_platform_file.h" |
| 13 #include "remoting/base/auto_thread_task_runner.h" | 16 #include "remoting/base/auto_thread_task_runner.h" |
| 14 #include "remoting/host/chromoting_messages.h" | 17 #include "remoting/host/chromoting_messages.h" |
| 15 #include "remoting/host/daemon_process.h" | 18 #include "remoting/host/daemon_process.h" |
| 16 #include "remoting/host/desktop_session.h" | 19 #include "remoting/host/desktop_session.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gmock_mutant.h" | 21 #include "testing/gmock_mutant.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 20 | 23 |
| 21 using testing::_; | 24 using testing::_; |
| 22 using testing::AnyNumber; | 25 using testing::AnyNumber; |
| 23 using testing::InSequence; | 26 using testing::InSequence; |
| 24 | 27 |
| 25 namespace remoting { | 28 namespace remoting { |
| 26 | 29 |
| 27 namespace { | 30 namespace { |
| 28 | 31 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 211 message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 209 } | 212 } |
| 210 | 213 |
| 211 void DaemonProcessTest::StartDaemonProcess() { | 214 void DaemonProcessTest::StartDaemonProcess() { |
| 212 // DaemonProcess::Initialize() sets up the config watcher that this test does | 215 // DaemonProcess::Initialize() sets up the config watcher that this test does |
| 213 // not support. Launch the process directly. | 216 // not support. Launch the process directly. |
| 214 daemon_process_->LaunchNetworkProcess(); | 217 daemon_process_->LaunchNetworkProcess(); |
| 215 } | 218 } |
| 216 | 219 |
| 217 MATCHER_P(Message, type, "") { | 220 MATCHER_P(Message, type, "") { |
| 218 return arg.type() == static_cast<uint32>(type); | 221 return arg.type() == static_cast<uint32_t>(type); |
| 219 } | 222 } |
| 220 | 223 |
| 221 TEST_F(DaemonProcessTest, OpenClose) { | 224 TEST_F(DaemonProcessTest, OpenClose) { |
| 222 InSequence s; | 225 InSequence s; |
| 223 EXPECT_CALL(*daemon_process_, Sent(Message(kMessageConfiguration))); | 226 EXPECT_CALL(*daemon_process_, Sent(Message(kMessageConfiguration))); |
| 224 EXPECT_CALL(*daemon_process_, Received(Message(kMessageConnectTerminal))); | 227 EXPECT_CALL(*daemon_process_, Received(Message(kMessageConnectTerminal))); |
| 225 EXPECT_CALL(*daemon_process_, Received(Message(kMessageDisconnectTerminal))); | 228 EXPECT_CALL(*daemon_process_, Received(Message(kMessageDisconnectTerminal))); |
| 226 EXPECT_CALL(*daemon_process_, Sent(Message(kMessageTerminalDisconnected))); | 229 EXPECT_CALL(*daemon_process_, Sent(Message(kMessageTerminalDisconnected))); |
| 227 | 230 |
| 228 StartDaemonProcess(); | 231 StartDaemonProcess(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 EXPECT_EQ(1u, desktop_sessions().size()); | 335 EXPECT_EQ(1u, desktop_sessions().size()); |
| 333 EXPECT_EQ(id, desktop_sessions().front()->id()); | 336 EXPECT_EQ(id, desktop_sessions().front()->id()); |
| 334 | 337 |
| 335 EXPECT_TRUE(daemon_process_->OnMessageReceived( | 338 EXPECT_TRUE(daemon_process_->OnMessageReceived( |
| 336 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); | 339 ChromotingNetworkHostMsg_ConnectTerminal(id, resolution, false))); |
| 337 EXPECT_TRUE(desktop_sessions().empty()); | 340 EXPECT_TRUE(desktop_sessions().empty()); |
| 338 EXPECT_EQ(0, terminal_id_); | 341 EXPECT_EQ(0, terminal_id_); |
| 339 } | 342 } |
| 340 | 343 |
| 341 } // namespace remoting | 344 } // namespace remoting |
| OLD | NEW |