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 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Tears down |rdp_client_|. | 88 // Tears down |rdp_client_|. |
89 void CloseRdpClient(); | 89 void CloseRdpClient(); |
90 | 90 |
91 protected: | 91 protected: |
92 // The ATL module instance required by the ATL code. | 92 // The ATL module instance required by the ATL code. |
93 scoped_ptr<RdpClientModule> module_; | 93 scoped_ptr<RdpClientModule> module_; |
94 | 94 |
95 // The UI message loop used by RdpClient. The loop is stopped once there is no | 95 // The UI message loop used by RdpClient. The loop is stopped once there is no |
96 // more references to |task_runner_|. | 96 // more references to |task_runner_|. |
97 MessageLoop message_loop_; | 97 base::MessageLoop message_loop_; |
98 base::RunLoop run_loop_; | 98 base::RunLoop run_loop_; |
99 scoped_refptr<AutoThreadTaskRunner> task_runner_; | 99 scoped_refptr<AutoThreadTaskRunner> task_runner_; |
100 | 100 |
101 // Mocks RdpClient::EventHandler for testing. | 101 // Mocks RdpClient::EventHandler for testing. |
102 MockRdpClientEventHandler event_handler_; | 102 MockRdpClientEventHandler event_handler_; |
103 | 103 |
104 // Points to the object being tested. | 104 // Points to the object being tested. |
105 scoped_ptr<RdpClient> rdp_client_; | 105 scoped_ptr<RdpClient> rdp_client_; |
106 }; | 106 }; |
107 | 107 |
108 RdpClientTest::RdpClientTest() : message_loop_(MessageLoop::TYPE_UI) { | 108 RdpClientTest::RdpClientTest() |
| 109 : message_loop_(base::MessageLoop::TYPE_UI) { |
109 } | 110 } |
110 | 111 |
111 RdpClientTest::~RdpClientTest() { | 112 RdpClientTest::~RdpClientTest() { |
112 } | 113 } |
113 | 114 |
114 void RdpClientTest::SetUp() { | 115 void RdpClientTest::SetUp() { |
115 // Arrange to run |message_loop_| until no components depend on it. | 116 // Arrange to run |message_loop_| until no components depend on it. |
116 task_runner_ = new AutoThreadTaskRunner( | 117 task_runner_ = new AutoThreadTaskRunner( |
117 message_loop_.message_loop_proxy(), run_loop_.QuitClosure()); | 118 message_loop_.message_loop_proxy(), run_loop_.QuitClosure()); |
118 | 119 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 158 |
158 rdp_client_.reset(new RdpClient(task_runner_, task_runner_, | 159 rdp_client_.reset(new RdpClient(task_runner_, task_runner_, |
159 SkISize::Make(kDefaultWidth, kDefaultHeight), | 160 SkISize::Make(kDefaultWidth, kDefaultHeight), |
160 &event_handler_)); | 161 &event_handler_)); |
161 task_runner_ = NULL; | 162 task_runner_ = NULL; |
162 | 163 |
163 run_loop_.Run(); | 164 run_loop_.Run(); |
164 } | 165 } |
165 | 166 |
166 } // namespace remoting | 167 } // namespace remoting |
OLD | NEW |