| 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 // ATL headers have to go first. | 5 // ATL headers have to go first. |
| 6 #include <atlbase.h> | 6 #include <atlbase.h> |
| 7 #include <atlhost.h> | 7 #include <atlhost.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/guid.h" | 13 #include "base/guid.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/win/scoped_com_initializer.h" | 18 #include "base/win/scoped_com_initializer.h" |
| 18 #include "remoting/base/auto_thread_task_runner.h" | 19 #include "remoting/base/auto_thread_task_runner.h" |
| 19 #include "remoting/host/win/rdp_client.h" | 20 #include "remoting/host/win/rdp_client.h" |
| 20 #include "remoting/host/win/wts_terminal_monitor.h" | 21 #include "remoting/host/win/wts_terminal_monitor.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gmock_mutant.h" | 23 #include "testing/gmock_mutant.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 25 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 25 | 26 |
| 26 using testing::_; | 27 using testing::_; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 module_.reset(); | 134 module_.reset(); |
| 134 } | 135 } |
| 135 | 136 |
| 136 void RdpClientTest::OnRdpConnected() { | 137 void RdpClientTest::OnRdpConnected() { |
| 137 uint32_t session_id = WtsTerminalMonitor::LookupSessionId(terminal_id_); | 138 uint32_t session_id = WtsTerminalMonitor::LookupSessionId(terminal_id_); |
| 138 | 139 |
| 139 std::string id; | 140 std::string id; |
| 140 EXPECT_TRUE(WtsTerminalMonitor::LookupTerminalId(session_id, &id)); | 141 EXPECT_TRUE(WtsTerminalMonitor::LookupTerminalId(session_id, &id)); |
| 141 EXPECT_EQ(id, terminal_id_); | 142 EXPECT_EQ(id, terminal_id_); |
| 142 | 143 |
| 143 message_loop_.PostTask(FROM_HERE, base::Bind(&RdpClientTest::CloseRdpClient, | 144 message_loop_.task_runner()->PostTask( |
| 144 base::Unretained(this))); | 145 FROM_HERE, |
| 146 base::Bind(&RdpClientTest::CloseRdpClient, base::Unretained(this))); |
| 145 } | 147 } |
| 146 | 148 |
| 147 void RdpClientTest::CloseRdpClient() { | 149 void RdpClientTest::CloseRdpClient() { |
| 148 EXPECT_TRUE(rdp_client_); | 150 EXPECT_TRUE(rdp_client_); |
| 149 | 151 |
| 150 rdp_client_.reset(); | 152 rdp_client_.reset(); |
| 151 } | 153 } |
| 152 | 154 |
| 153 // Creates a loopback RDP connection. | 155 // Creates a loopback RDP connection. |
| 154 TEST_F(RdpClientTest, Basic) { | 156 TEST_F(RdpClientTest, Basic) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 167 rdp_client_.reset( | 169 rdp_client_.reset( |
| 168 new RdpClient(task_runner_, task_runner_, | 170 new RdpClient(task_runner_, task_runner_, |
| 169 webrtc::DesktopSize(kDefaultWidth, kDefaultHeight), | 171 webrtc::DesktopSize(kDefaultWidth, kDefaultHeight), |
| 170 terminal_id_, kDefaultRdpPort, &event_handler_)); | 172 terminal_id_, kDefaultRdpPort, &event_handler_)); |
| 171 task_runner_ = nullptr; | 173 task_runner_ = nullptr; |
| 172 | 174 |
| 173 run_loop_.Run(); | 175 run_loop_.Run(); |
| 174 } | 176 } |
| 175 | 177 |
| 176 } // namespace remoting | 178 } // namespace remoting |
| OLD | NEW |