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

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

Issue 12545026: ResizingHostObserver is created by the desktop environment together with other stubs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 void DisconnectTerminal(int terminal_id); 122 void DisconnectTerminal(int terminal_id);
123 123
124 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock 124 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock
125 // DesktopEnvironmentFactory::Create(). 125 // DesktopEnvironmentFactory::Create().
126 DesktopEnvironment* CreateDesktopEnvironment(); 126 DesktopEnvironment* CreateDesktopEnvironment();
127 127
128 // Creates a dummy EventExecutor, to mock 128 // Creates a dummy EventExecutor, to mock
129 // DesktopEnvironment::CreateEventExecutor(). 129 // DesktopEnvironment::CreateEventExecutor().
130 EventExecutor* CreateEventExecutor(); 130 EventExecutor* CreateEventExecutor();
131 131
132 // Creates a dummy SessionController, to mock
133 // DesktopEnvironment::CreateSessionController().
134 SessionController* CreateSessionController();
135
132 // Creates a fake media::ScreenCapturer, to mock 136 // Creates a fake media::ScreenCapturer, to mock
133 // DesktopEnvironment::CreateVideoCapturer(). 137 // DesktopEnvironment::CreateVideoCapturer().
134 media::ScreenCapturer* CreateVideoCapturer(); 138 media::ScreenCapturer* CreateVideoCapturer();
135 139
136 void DeleteDesktopEnvironment(); 140 void DeleteDesktopEnvironment();
137 141
138 // Forwards |event| to |clipboard_stub_|. 142 // Forwards |event| to |clipboard_stub_|.
139 void ReflectClipboardEvent(const protocol::ClipboardEvent& event); 143 void ReflectClipboardEvent(const protocol::ClipboardEvent& event);
140 144
141 protected: 145 protected:
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 282
279 DesktopEnvironment* IpcDesktopEnvironmentTest::CreateDesktopEnvironment() { 283 DesktopEnvironment* IpcDesktopEnvironmentTest::CreateDesktopEnvironment() {
280 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); 284 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment();
281 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) 285 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_))
282 .Times(0); 286 .Times(0);
283 EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) 287 EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _))
284 .Times(AnyNumber()) 288 .Times(AnyNumber())
285 .WillRepeatedly( 289 .WillRepeatedly(
286 InvokeWithoutArgs(this, 290 InvokeWithoutArgs(this,
287 &IpcDesktopEnvironmentTest::CreateEventExecutor)); 291 &IpcDesktopEnvironmentTest::CreateEventExecutor));
292 EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr())
293 .Times(AnyNumber())
294 .WillRepeatedly(InvokeWithoutArgs(
295 this, &IpcDesktopEnvironmentTest::CreateSessionController));
288 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _)) 296 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _))
289 .Times(AnyNumber()) 297 .Times(AnyNumber())
290 .WillRepeatedly( 298 .WillRepeatedly(
291 InvokeWithoutArgs(this, 299 InvokeWithoutArgs(this,
292 &IpcDesktopEnvironmentTest::CreateVideoCapturer)); 300 &IpcDesktopEnvironmentTest::CreateVideoCapturer));
293 301
294 // Let tests know that the remote desktop environment is created. 302 // Let tests know that the remote desktop environment is created.
295 message_loop_.PostTask(FROM_HERE, setup_run_loop_->QuitClosure()); 303 message_loop_.PostTask(FROM_HERE, setup_run_loop_->QuitClosure());
296 304
297 return desktop_environment; 305 return desktop_environment;
298 } 306 }
299 307
300 EventExecutor* IpcDesktopEnvironmentTest::CreateEventExecutor() { 308 EventExecutor* IpcDesktopEnvironmentTest::CreateEventExecutor() {
301 EXPECT_TRUE(remote_event_executor_ == NULL); 309 EXPECT_TRUE(remote_event_executor_ == NULL);
302 remote_event_executor_ = new MockEventExecutor(); 310 remote_event_executor_ = new MockEventExecutor();
303 311
304 EXPECT_CALL(*remote_event_executor_, StartPtr(_)); 312 EXPECT_CALL(*remote_event_executor_, StartPtr(_));
305 return remote_event_executor_; 313 return remote_event_executor_;
306 } 314 }
307 315
316 SessionController* IpcDesktopEnvironmentTest::CreateSessionController() {
317 return new MockSessionController();
318 }
319
308 media::ScreenCapturer* IpcDesktopEnvironmentTest::CreateVideoCapturer() { 320 media::ScreenCapturer* IpcDesktopEnvironmentTest::CreateVideoCapturer() {
309 return new media::ScreenCapturerFake(); 321 return new media::ScreenCapturerFake();
310 } 322 }
311 323
312 void IpcDesktopEnvironmentTest::DeleteDesktopEnvironment() { 324 void IpcDesktopEnvironmentTest::DeleteDesktopEnvironment() {
313 event_executor_.reset(); 325 event_executor_.reset();
314 video_capturer_.reset(); 326 video_capturer_.reset();
315 327
316 // Trigger DisconnectTerminal(). 328 // Trigger DisconnectTerminal().
317 desktop_environment_.reset(); 329 desktop_environment_.reset();
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 event.set_x(0); 646 event.set_x(0);
635 event.set_y(0); 647 event.set_y(0);
636 event_executor_->InjectMouseEvent(event); 648 event_executor_->InjectMouseEvent(event);
637 649
638 task_runner_ = NULL; 650 task_runner_ = NULL;
639 io_task_runner_ = NULL; 651 io_task_runner_ = NULL;
640 main_run_loop_.Run(); 652 main_run_loop_.Run();
641 } 653 }
642 654
643 } // namespace remoting 655 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698