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

Side by Side Diff: remoting/host/desktop_process_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) 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 "remoting/host/desktop_process.h" 5 #include "remoting/host/desktop_process.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void OnDesktopAttached(IPC::PlatformFileForTransit desktop_process); 104 void OnDesktopAttached(IPC::PlatformFileForTransit desktop_process);
105 105
106 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock 106 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock
107 // DesktopEnvironmentFactory::Create(). 107 // DesktopEnvironmentFactory::Create().
108 DesktopEnvironment* CreateDesktopEnvironment(); 108 DesktopEnvironment* CreateDesktopEnvironment();
109 109
110 // Creates a dummy EventExecutor, to mock 110 // Creates a dummy EventExecutor, to mock
111 // DesktopEnvironment::CreateEventExecutor(). 111 // DesktopEnvironment::CreateEventExecutor().
112 EventExecutor* CreateEventExecutor(); 112 EventExecutor* CreateEventExecutor();
113 113
114 // Creates a dummy SessionController, to mock
115 // DesktopEnvironment::CreateSessionController().
116 SessionController* CreateSessionController();
117
114 // Creates a fake media::ScreenCapturer, to mock 118 // Creates a fake media::ScreenCapturer, to mock
115 // DesktopEnvironment::CreateVideoCapturer(). 119 // DesktopEnvironment::CreateVideoCapturer().
116 media::ScreenCapturer* CreateVideoCapturer(); 120 media::ScreenCapturer* CreateVideoCapturer();
117 121
118 // Disconnects the daemon-to-desktop channel causing the desktop process to 122 // Disconnects the daemon-to-desktop channel causing the desktop process to
119 // exit. 123 // exit.
120 void DisconnectChannels(); 124 void DisconnectChannels();
121 125
122 // Posts DisconnectChannels() to |message_loop_|. 126 // Posts DisconnectChannels() to |message_loop_|.
123 void PostDisconnectChannels(); 127 void PostDisconnectChannels();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 197 }
194 198
195 DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() { 199 DesktopEnvironment* DesktopProcessTest::CreateDesktopEnvironment() {
196 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); 200 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment();
197 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_)) 201 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr(_))
198 .Times(0); 202 .Times(0);
199 EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _)) 203 EXPECT_CALL(*desktop_environment, CreateEventExecutorPtr(_, _))
200 .Times(AnyNumber()) 204 .Times(AnyNumber())
201 .WillRepeatedly( 205 .WillRepeatedly(
202 InvokeWithoutArgs(this, &DesktopProcessTest::CreateEventExecutor)); 206 InvokeWithoutArgs(this, &DesktopProcessTest::CreateEventExecutor));
207 EXPECT_CALL(*desktop_environment, CreateSessionControllerPtr())
208 .Times(AnyNumber())
209 .WillRepeatedly(
210 InvokeWithoutArgs(this,
211 &DesktopProcessTest::CreateSessionController));
203 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _)) 212 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr(_, _))
204 .Times(AnyNumber()) 213 .Times(AnyNumber())
205 .WillRepeatedly( 214 .WillRepeatedly(
206 InvokeWithoutArgs(this, &DesktopProcessTest::CreateVideoCapturer)); 215 InvokeWithoutArgs(this, &DesktopProcessTest::CreateVideoCapturer));
207 216
208 // Notify the test that the desktop environment has been created. 217 // Notify the test that the desktop environment has been created.
209 network_listener_.OnDesktopEnvironmentCreated(); 218 network_listener_.OnDesktopEnvironmentCreated();
210 return desktop_environment; 219 return desktop_environment;
211 } 220 }
212 221
213 EventExecutor* DesktopProcessTest::CreateEventExecutor() { 222 EventExecutor* DesktopProcessTest::CreateEventExecutor() {
214 MockEventExecutor* event_executor = new MockEventExecutor(); 223 MockEventExecutor* event_executor = new MockEventExecutor();
215 EXPECT_CALL(*event_executor, StartPtr(_)); 224 EXPECT_CALL(*event_executor, StartPtr(_));
216 return event_executor; 225 return event_executor;
217 } 226 }
218 227
228 SessionController* DesktopProcessTest::CreateSessionController() {
229 return new MockSessionController();
230 }
231
219 media::ScreenCapturer* DesktopProcessTest::CreateVideoCapturer() { 232 media::ScreenCapturer* DesktopProcessTest::CreateVideoCapturer() {
220 return new media::ScreenCapturerFake(); 233 return new media::ScreenCapturerFake();
221 } 234 }
222 235
223 void DesktopProcessTest::DisconnectChannels() { 236 void DesktopProcessTest::DisconnectChannels() {
224 daemon_channel_.reset(); 237 daemon_channel_.reset();
225 network_channel_.reset(); 238 network_channel_.reset();
226 io_task_runner_ = NULL; 239 io_task_runner_ = NULL;
227 } 240 }
228 241
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 354 }
342 355
343 // Run the desktop process and ask it to crash. 356 // Run the desktop process and ask it to crash.
344 TEST_F(DesktopProcessTest, DeathTest) { 357 TEST_F(DesktopProcessTest, DeathTest) {
345 testing::GTEST_FLAG(death_test_style) = "threadsafe"; 358 testing::GTEST_FLAG(death_test_style) = "threadsafe";
346 359
347 EXPECT_DEATH(RunDeathTest(), ""); 360 EXPECT_DEATH(RunDeathTest(), "");
348 } 361 }
349 362
350 } // namespace remoting 363 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698