Chromium Code Reviews| 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() : message_loop_(base::MessageLoop::TYPE_UI) {} |
|
alexeypa (please no reviews)
2013/04/29 17:17:41
nit: Please move |message_loop_| initialization to
xhwang
2013/04/30 00:02:36
Done.
| |
| 109 } | |
| 110 | 109 |
| 111 RdpClientTest::~RdpClientTest() { | 110 RdpClientTest::~RdpClientTest() { |
| 112 } | 111 } |
| 113 | 112 |
| 114 void RdpClientTest::SetUp() { | 113 void RdpClientTest::SetUp() { |
| 115 // Arrange to run |message_loop_| until no components depend on it. | 114 // Arrange to run |message_loop_| until no components depend on it. |
| 116 task_runner_ = new AutoThreadTaskRunner( | 115 task_runner_ = new AutoThreadTaskRunner( |
| 117 message_loop_.message_loop_proxy(), run_loop_.QuitClosure()); | 116 message_loop_.message_loop_proxy(), run_loop_.QuitClosure()); |
| 118 | 117 |
| 119 module_.reset(new RdpClientModule()); | 118 module_.reset(new RdpClientModule()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 156 |
| 158 rdp_client_.reset(new RdpClient(task_runner_, task_runner_, | 157 rdp_client_.reset(new RdpClient(task_runner_, task_runner_, |
| 159 SkISize::Make(kDefaultWidth, kDefaultHeight), | 158 SkISize::Make(kDefaultWidth, kDefaultHeight), |
| 160 &event_handler_)); | 159 &event_handler_)); |
| 161 task_runner_ = NULL; | 160 task_runner_ = NULL; |
| 162 | 161 |
| 163 run_loop_.Run(); | 162 run_loop_.Run(); |
| 164 } | 163 } |
| 165 | 164 |
| 166 } // namespace remoting | 165 } // namespace remoting |
| OLD | NEW |