Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: remoting/host/ipc_desktop_environment_unittest.cc

Issue 14314026: remoting: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Destroys the desktop process object created by CreateDesktopProcess(). 147 // Destroys the desktop process object created by CreateDesktopProcess().
148 void DestoyDesktopProcess(); 148 void DestoyDesktopProcess();
149 149
150 void OnDisconnectCallback(); 150 void OnDisconnectCallback();
151 151
152 // Invoked when ChromotingDesktopDaemonMsg_DesktopAttached message is 152 // Invoked when ChromotingDesktopDaemonMsg_DesktopAttached message is
153 // received. 153 // received.
154 void OnDesktopAttached(IPC::PlatformFileForTransit desktop_pipe); 154 void OnDesktopAttached(IPC::PlatformFileForTransit desktop_pipe);
155 155
156 // The main message loop. 156 // The main message loop.
157 MessageLoop message_loop_; 157 base::MessageLoop message_loop_;
158 158
159 // Runs until |desktop_session_proxy_| is connected to the desktop. 159 // Runs until |desktop_session_proxy_| is connected to the desktop.
160 scoped_ptr<base::RunLoop> setup_run_loop_; 160 scoped_ptr<base::RunLoop> setup_run_loop_;
161 161
162 // Runs until there are references to |task_runner_|. 162 // Runs until there are references to |task_runner_|.
163 base::RunLoop main_run_loop_; 163 base::RunLoop main_run_loop_;
164 164
165 scoped_refptr<AutoThreadTaskRunner> task_runner_; 165 scoped_refptr<AutoThreadTaskRunner> task_runner_;
166 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; 166 scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
167 167
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // The last |terminal_id| passed to ConnectTermina(); 199 // The last |terminal_id| passed to ConnectTermina();
200 int terminal_id_; 200 int terminal_id_;
201 201
202 media::MockScreenCapturerDelegate screen_capturer_delegate_; 202 media::MockScreenCapturerDelegate screen_capturer_delegate_;
203 203
204 MockClientSessionControl client_session_control_; 204 MockClientSessionControl client_session_control_;
205 base::WeakPtrFactory<ClientSessionControl> client_session_control_factory_; 205 base::WeakPtrFactory<ClientSessionControl> client_session_control_factory_;
206 }; 206 };
207 207
208 IpcDesktopEnvironmentTest::IpcDesktopEnvironmentTest() 208 IpcDesktopEnvironmentTest::IpcDesktopEnvironmentTest()
209 : message_loop_(MessageLoop::TYPE_UI), 209 : message_loop_(base::MessageLoop::TYPE_UI),
210 client_jid_("user@domain/rest-of-jid"), 210 client_jid_("user@domain/rest-of-jid"),
211 clipboard_stub_(NULL), 211 clipboard_stub_(NULL),
212 remote_input_injector_(NULL), 212 remote_input_injector_(NULL),
213 terminal_id_(-1), 213 terminal_id_(-1),
214 client_session_control_factory_(&client_session_control_) { 214 client_session_control_factory_(&client_session_control_) {
215 } 215 }
216 216
217 IpcDesktopEnvironmentTest::~IpcDesktopEnvironmentTest() { 217 IpcDesktopEnvironmentTest::~IpcDesktopEnvironmentTest() {
218 } 218 }
219 219
220 void IpcDesktopEnvironmentTest::SetUp() { 220 void IpcDesktopEnvironmentTest::SetUp() {
221 // Arrange to run |message_loop_| until no components depend on it. 221 // Arrange to run |message_loop_| until no components depend on it.
222 task_runner_ = new AutoThreadTaskRunner( 222 task_runner_ = new AutoThreadTaskRunner(
223 message_loop_.message_loop_proxy(), main_run_loop_.QuitClosure()); 223 message_loop_.message_loop_proxy(), main_run_loop_.QuitClosure());
224 224
225 io_task_runner_ = AutoThread::CreateWithType("IPC thread", task_runner_, 225 io_task_runner_ = AutoThread::CreateWithType(
226 MessageLoop::TYPE_IO); 226 "IPC thread", task_runner_, base::MessageLoop::TYPE_IO);
227 227
228 setup_run_loop_.reset(new base::RunLoop()); 228 setup_run_loop_.reset(new base::RunLoop());
229 229
230 // Set expectation that the DaemonProcess will send DesktopAttached message 230 // Set expectation that the DaemonProcess will send DesktopAttached message
231 // once it is ready. 231 // once it is ready.
232 EXPECT_CALL(desktop_listener_, OnChannelConnected(_)) 232 EXPECT_CALL(desktop_listener_, OnChannelConnected(_))
233 .Times(AnyNumber()); 233 .Times(AnyNumber());
234 EXPECT_CALL(desktop_listener_, OnDesktopAttached(_)) 234 EXPECT_CALL(desktop_listener_, OnDesktopAttached(_))
235 .Times(AnyNumber()) 235 .Times(AnyNumber())
236 .WillRepeatedly(Invoke(this, 236 .WillRepeatedly(Invoke(this,
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 event.set_x(0); 606 event.set_x(0);
607 event.set_y(0); 607 event.set_y(0);
608 input_injector_->InjectMouseEvent(event); 608 input_injector_->InjectMouseEvent(event);
609 609
610 task_runner_ = NULL; 610 task_runner_ = NULL;
611 io_task_runner_ = NULL; 611 io_task_runner_ = NULL;
612 main_run_loop_.Run(); 612 main_run_loop_.Run();
613 } 613 }
614 614
615 } // namespace remoting 615 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_change_notification_listener_unittest.cc ('k') | remoting/host/linux/audio_pipe_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698