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

Side by Side Diff: remoting/host/client_session_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: CR feedback & rebased 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
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/desktop_environment.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "media/video/capture/screen/screen_capturer_fake.h" 6 #include "media/video/capture/screen/screen_capturer_fake.h"
7 #include "media/video/capture/screen/screen_capturer_mock_objects.h" 7 #include "media/video/capture/screen/screen_capturer_mock_objects.h"
8 #include "remoting/base/auto_thread_task_runner.h" 8 #include "remoting/base/auto_thread_task_runner.h"
9 #include "remoting/base/constants.h" 9 #include "remoting/base/constants.h"
10 #include "remoting/host/audio_capturer.h" 10 #include "remoting/host/audio_capturer.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock 70 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock
71 // DesktopEnvironmentFactory::Create(). 71 // DesktopEnvironmentFactory::Create().
72 DesktopEnvironment* CreateDesktopEnvironment(); 72 DesktopEnvironment* CreateDesktopEnvironment();
73 73
74 // Returns |event_executor_| created and initialized by SetUp(), to mock 74 // Returns |event_executor_| created and initialized by SetUp(), to mock
75 // DesktopEnvironment::CreateEventExecutor(). 75 // DesktopEnvironment::CreateEventExecutor().
76 EventExecutor* CreateEventExecutor( 76 EventExecutor* CreateEventExecutor(
77 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 77 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
78 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 78 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
79 79
80 // Creates a dummy SessionController, to mock
81 // DesktopEnvironment::CreateSessionController().
82 SessionController* CreateSessionController();
83
80 // Creates a fake media::ScreenCapturer, to mock 84 // Creates a fake media::ScreenCapturer, to mock
81 // DesktopEnvironment::CreateVideoCapturer(). 85 // DesktopEnvironment::CreateVideoCapturer().
82 media::ScreenCapturer* CreateVideoCapturer( 86 media::ScreenCapturer* CreateVideoCapturer(
83 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 87 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
84 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner); 88 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner);
85 89
86 // Notifies the client session that the client connection has been 90 // Notifies the client session that the client connection has been
87 // authenticated and channels have been connected. This effectively enables 91 // authenticated and channels have been connected. This effectively enables
88 // the input pipe line and starts video capturing. 92 // the input pipe line and starts video capturing.
89 void ConnectClientSession(); 93 void ConnectClientSession();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 192
189 desktop_environment_factory_.reset(); 193 desktop_environment_factory_.reset();
190 } 194 }
191 195
192 DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() { 196 DesktopEnvironment* ClientSessionTest::CreateDesktopEnvironment() {
193 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); 197 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment();
194 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) 198 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_))
195 .Times(0); 199 .Times(0);
196 EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) 200 EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _))
197 .WillOnce(Invoke(this, &ClientSessionTest::CreateEventExecutor)); 201 .WillOnce(Invoke(this, &ClientSessionTest::CreateEventExecutor));
202 EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr())
203 .WillOnce(Invoke(this, &ClientSessionTest::CreateSessionController));
198 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _)) 204 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _))
199 .WillOnce(Invoke(this, &ClientSessionTest::CreateVideoCapturer)); 205 .WillOnce(Invoke(this, &ClientSessionTest::CreateVideoCapturer));
200 206
201 return desktop_environment; 207 return desktop_environment;
202 } 208 }
203 209
204 EventExecutor* ClientSessionTest::CreateEventExecutor( 210 EventExecutor* ClientSessionTest::CreateEventExecutor(
205 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, 211 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner,
206 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) { 212 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
207 EXPECT_TRUE(event_executor_); 213 EXPECT_TRUE(event_executor_);
208 return event_executor_.release(); 214 return event_executor_.release();
209 } 215 }
210 216
217 SessionController* ClientSessionTest::CreateSessionController() {
218 return new MockSessionController();
219 }
220
211 media::ScreenCapturer* ClientSessionTest::CreateVideoCapturer( 221 media::ScreenCapturer* ClientSessionTest::CreateVideoCapturer(
212 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner, 222 scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner,
213 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) { 223 scoped_refptr<base::SingleThreadTaskRunner> encode_task_runner) {
214 return new media::ScreenCapturerFake(); 224 return new media::ScreenCapturerFake();
215 } 225 }
216 226
217 void ClientSessionTest::ConnectClientSession() { 227 void ClientSessionTest::ConnectClientSession() {
218 client_session_->OnConnectionAuthenticated(client_session_->connection()); 228 client_session_->OnConnectionAuthenticated(client_session_->connection());
219 client_session_->OnConnectionChannelsConnected(client_session_->connection()); 229 client_session_->OnConnectionChannelsConnected(client_session_->connection());
220 } 230 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 .After(connected) 492 .After(connected)
483 .WillOnce(DoAll( 493 .WillOnce(DoAll(
484 InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession), 494 InvokeWithoutArgs(this, &ClientSessionTest::DisconnectClientSession),
485 InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession))); 495 InvokeWithoutArgs(this, &ClientSessionTest::StopClientSession)));
486 496
487 ConnectClientSession(); 497 ConnectClientSession();
488 message_loop_.Run(); 498 message_loop_.Run();
489 } 499 }
490 500
491 } // namespace remoting 501 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/client_session.cc ('k') | remoting/host/desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698