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

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

Issue 15692018: Remove screen capturers from media/video/capture/screen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/chromoting_host.h ('k') | remoting/host/chromoting_messages.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/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "media/video/capture/screen/screen_capturer_fake.h"
10 #include "remoting/base/auto_thread_task_runner.h" 9 #include "remoting/base/auto_thread_task_runner.h"
11 #include "remoting/host/audio_capturer.h" 10 #include "remoting/host/audio_capturer.h"
12 #include "remoting/host/chromoting_host.h" 11 #include "remoting/host/chromoting_host.h"
13 #include "remoting/host/chromoting_host_context.h" 12 #include "remoting/host/chromoting_host_context.h"
14 #include "remoting/host/desktop_environment.h" 13 #include "remoting/host/desktop_environment.h"
15 #include "remoting/host/host_mock_objects.h" 14 #include "remoting/host/host_mock_objects.h"
15 #include "remoting/host/screen_capturer_fake.h"
16 #include "remoting/jingle_glue/mock_objects.h" 16 #include "remoting/jingle_glue/mock_objects.h"
17 #include "remoting/proto/video.pb.h" 17 #include "remoting/proto/video.pb.h"
18 #include "remoting/protocol/errors.h" 18 #include "remoting/protocol/errors.h"
19 #include "remoting/protocol/protocol_mock_objects.h" 19 #include "remoting/protocol/protocol_mock_objects.h"
20 #include "remoting/protocol/session_config.h" 20 #include "remoting/protocol/session_config.h"
21 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gmock_mutant.h" 22 #include "testing/gmock_mutant.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 using ::remoting::protocol::MockClientStub; 25 using ::remoting::protocol::MockClientStub;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Make sure that the host has been properly deleted. 224 // Make sure that the host has been properly deleted.
225 DCHECK(host_.get() == NULL); 225 DCHECK(host_.get() == NULL);
226 } 226 }
227 227
228 // Change the session route for |client1_|. 228 // Change the session route for |client1_|.
229 void ChangeSessionRoute(const std::string& channel_name, 229 void ChangeSessionRoute(const std::string& channel_name,
230 const protocol::TransportRoute& route) { 230 const protocol::TransportRoute& route) {
231 host_->OnSessionRouteChange(get_client(0), channel_name, route); 231 host_->OnSessionRouteChange(get_client(0), channel_name, route);
232 } 232 }
233 233
234 // Creates a DesktopEnvironment with a fake media::ScreenCapturer, to mock 234 // Creates a DesktopEnvironment with a fake webrtc::ScreenCapturer, to mock
235 // DesktopEnvironmentFactory::Create(). 235 // DesktopEnvironmentFactory::Create().
236 DesktopEnvironment* CreateDesktopEnvironment() { 236 DesktopEnvironment* CreateDesktopEnvironment() {
237 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment(); 237 MockDesktopEnvironment* desktop_environment = new MockDesktopEnvironment();
238 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr()) 238 EXPECT_CALL(*desktop_environment, CreateAudioCapturerPtr())
239 .Times(0); 239 .Times(0);
240 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr()) 240 EXPECT_CALL(*desktop_environment, CreateInputInjectorPtr())
241 .Times(AtMost(1)) 241 .Times(AtMost(1))
242 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector)); 242 .WillOnce(Invoke(this, &ChromotingHostTest::CreateInputInjector));
243 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr()) 243 EXPECT_CALL(*desktop_environment, CreateScreenControlsPtr())
244 .Times(AtMost(1)); 244 .Times(AtMost(1));
245 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr()) 245 EXPECT_CALL(*desktop_environment, CreateVideoCapturerPtr())
246 .Times(AtMost(1)) 246 .Times(AtMost(1))
247 .WillOnce(Invoke(this, &ChromotingHostTest::CreateVideoCapturer)); 247 .WillOnce(Invoke(this, &ChromotingHostTest::CreateVideoCapturer));
248 EXPECT_CALL(*desktop_environment, GetCapabilities()) 248 EXPECT_CALL(*desktop_environment, GetCapabilities())
249 .Times(AtMost(1)); 249 .Times(AtMost(1));
250 EXPECT_CALL(*desktop_environment, SetCapabilities(_)) 250 EXPECT_CALL(*desktop_environment, SetCapabilities(_))
251 .Times(AtMost(1)); 251 .Times(AtMost(1));
252 252
253 return desktop_environment; 253 return desktop_environment;
254 } 254 }
255 255
256 // Creates a dummy InputInjector, to mock 256 // Creates a dummy InputInjector, to mock
257 // DesktopEnvironment::CreateInputInjector(). 257 // DesktopEnvironment::CreateInputInjector().
258 InputInjector* CreateInputInjector() { 258 InputInjector* CreateInputInjector() {
259 MockInputInjector* input_injector = new MockInputInjector(); 259 MockInputInjector* input_injector = new MockInputInjector();
260 EXPECT_CALL(*input_injector, StartPtr(_)); 260 EXPECT_CALL(*input_injector, StartPtr(_));
261 return input_injector; 261 return input_injector;
262 } 262 }
263 263
264 // Creates a fake media::ScreenCapturer, to mock 264 // Creates a fake webrtc::ScreenCapturer, to mock
265 // DesktopEnvironment::CreateVideoCapturer(). 265 // DesktopEnvironment::CreateVideoCapturer().
266 media::ScreenCapturer* CreateVideoCapturer() { 266 webrtc::ScreenCapturer* CreateVideoCapturer() {
267 return new media::ScreenCapturerFake(); 267 return new ScreenCapturerFake();
268 } 268 }
269 269
270 void DisconnectAllClients() { 270 void DisconnectAllClients() {
271 host_->DisconnectAllClients(); 271 host_->DisconnectAllClients();
272 } 272 }
273 273
274 // Helper method to disconnect client 1 from the host. 274 // Helper method to disconnect client 1 from the host.
275 void DisconnectClient1() { 275 void DisconnectClient1() {
276 NotifyClientSessionClosed(0); 276 NotifyClientSessionClosed(0);
277 } 277 }
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 ExpectClientDisconnected(0, true, video_packet_sent, 646 ExpectClientDisconnected(0, true, video_packet_sent,
647 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 647 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
648 EXPECT_CALL(host_status_observer_, OnShutdown()); 648 EXPECT_CALL(host_status_observer_, OnShutdown());
649 649
650 host_->Start(xmpp_login_); 650 host_->Start(xmpp_login_);
651 SimulateClientConnection(0, true, false); 651 SimulateClientConnection(0, true, false);
652 message_loop_.Run(); 652 message_loop_.Run();
653 } 653 }
654 654
655 } // namespace remoting 655 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698