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

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

Issue 10384127: Chromoting: the Me2me host now presents a notification on the console allowing a user to disconnect… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Unix-line endings. The license text. Created 8 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
« no previous file with comments | « no previous file | remoting/host/continue_window_win.cc » ('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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop_proxy.h" 7 #include "base/message_loop_proxy.h"
8 #include "remoting/jingle_glue/mock_objects.h" 8 #include "remoting/jingle_glue/mock_objects.h"
9 #include "remoting/host/capturer_fake.h" 9 #include "remoting/host/capturer_fake.h"
10 #include "remoting/host/chromoting_host.h" 10 #include "remoting/host/chromoting_host.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 capturer.Pass(), 93 capturer.Pass(),
94 event_executor.Pass()); 94 event_executor.Pass());
95 95
96 host_ = new ChromotingHost( 96 host_ = new ChromotingHost(
97 &context_, &signal_strategy_, desktop_environment_.get(), 97 &context_, &signal_strategy_, desktop_environment_.get(),
98 NetworkSettings()); 98 NetworkSettings());
99 99
100 disconnect_window_ = new MockDisconnectWindow(); 100 disconnect_window_ = new MockDisconnectWindow();
101 continue_window_ = new MockContinueWindow(); 101 continue_window_ = new MockContinueWindow();
102 local_input_monitor_ = new MockLocalInputMonitor(); 102 local_input_monitor_ = new MockLocalInputMonitor();
103 it2me_host_user_interface_.reset(new It2MeHostUserInterface(host_, 103 it2me_host_user_interface_.reset(new It2MeHostUserInterface(&context_));
104 &context_)); 104 it2me_host_user_interface_->StartForTest(
105 it2me_host_user_interface_->InitFrom( 105 host_,
106 base::Bind(&ChromotingHost::Shutdown, host_, base::Closure()),
106 scoped_ptr<DisconnectWindow>(disconnect_window_), 107 scoped_ptr<DisconnectWindow>(disconnect_window_),
107 scoped_ptr<ContinueWindow>(continue_window_), 108 scoped_ptr<ContinueWindow>(continue_window_),
108 scoped_ptr<LocalInputMonitor>(local_input_monitor_)); 109 scoped_ptr<LocalInputMonitor>(local_input_monitor_));
109 110
110 session_ = new MockSession(); 111 session_ = new MockSession();
111 session2_ = new MockSession(); 112 session2_ = new MockSession();
112 session_config_ = SessionConfig::GetDefault(); 113 session_config_ = SessionConfig::GetDefault();
113 session_jid_ = "user@domain/rest-of-jid"; 114 session_jid_ = "user@domain/rest-of-jid";
114 session_config2_ = SessionConfig::GetDefault(); 115 session_config2_ = SessionConfig::GetDefault();
115 session2_jid_ = "user2@domain/rest-of-jid"; 116 session2_jid_ = "user2@domain/rest-of-jid";
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 message_loop_.Run(); 268 message_loop_.Run();
268 } 269 }
269 270
270 TEST_F(ChromotingHostTest, DISABLED_Connect) { 271 TEST_F(ChromotingHostTest, DISABLED_Connect) {
271 host_->Start(); 272 host_->Start();
272 273
273 // When the video packet is received we first shutdown ChromotingHost 274 // When the video packet is received we first shutdown ChromotingHost
274 // then execute the done task. 275 // then execute the done task.
275 { 276 {
276 InSequence s; 277 InSequence s;
277 EXPECT_CALL(*disconnect_window_, Show(_, _)) 278 EXPECT_CALL(*disconnect_window_, Show(_, _, _))
278 .Times(0); 279 .Times(0);
279 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 280 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
280 .WillOnce(DoAll( 281 .WillOnce(DoAll(
281 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost), 282 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost),
282 RunDoneTask())) 283 RunDoneTask()))
283 .RetiresOnSaturation(); 284 .RetiresOnSaturation();
284 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 285 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
285 .Times(AnyNumber()); 286 .Times(AnyNumber());
286 EXPECT_CALL(*connection_, Disconnect()) 287 EXPECT_CALL(*connection_, Disconnect())
287 .RetiresOnSaturation(); 288 .RetiresOnSaturation();
288 } 289 }
289 SimulateClientConnection(0, true); 290 SimulateClientConnection(0, true);
290 message_loop_.Run(); 291 message_loop_.Run();
291 } 292 }
292 293
293 TEST_F(ChromotingHostTest, DISABLED_Reconnect) { 294 TEST_F(ChromotingHostTest, DISABLED_Reconnect) {
294 host_->Start(); 295 host_->Start();
295 296
296 // When the video packet is received we first disconnect the mock 297 // When the video packet is received we first disconnect the mock
297 // connection. 298 // connection.
298 { 299 {
299 InSequence s; 300 InSequence s;
300 EXPECT_CALL(*disconnect_window_, Show(_, _)) 301 EXPECT_CALL(*disconnect_window_, Show(_, _, _))
301 .Times(0); 302 .Times(0);
302 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 303 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
303 .WillOnce(DoAll( 304 .WillOnce(DoAll(
304 InvokeWithoutArgs(this, &ChromotingHostTest::RemoveClientSession), 305 InvokeWithoutArgs(this, &ChromotingHostTest::RemoveClientSession),
305 RunDoneTask())) 306 RunDoneTask()))
306 .RetiresOnSaturation(); 307 .RetiresOnSaturation();
307 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 308 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
308 .Times(AnyNumber()); 309 .Times(AnyNumber());
309 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 310 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
310 .Times(AnyNumber()); 311 .Times(AnyNumber());
311 } 312 }
312 313
313 // If Disconnect() is called we can break the main message loop. 314 // If Disconnect() is called we can break the main message loop.
314 EXPECT_CALL(*connection_, Disconnect()) 315 EXPECT_CALL(*connection_, Disconnect())
315 .WillOnce(QuitMainMessageLoop(&message_loop_)) 316 .WillOnce(QuitMainMessageLoop(&message_loop_))
316 .RetiresOnSaturation(); 317 .RetiresOnSaturation();
317 318
318 SimulateClientConnection(0, true); 319 SimulateClientConnection(0, true);
319 message_loop_.Run(); 320 message_loop_.Run();
320 321
321 // Connect the client again. 322 // Connect the client again.
322 { 323 {
323 InSequence s; 324 InSequence s;
324 EXPECT_CALL(*disconnect_window_, Show(_, _)) 325 EXPECT_CALL(*disconnect_window_, Show(_, _, _))
325 .Times(0); 326 .Times(0);
326 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 327 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
327 .WillOnce(DoAll( 328 .WillOnce(DoAll(
328 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost), 329 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost),
329 RunDoneTask())) 330 RunDoneTask()))
330 .RetiresOnSaturation(); 331 .RetiresOnSaturation();
331 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 332 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
332 .Times(AnyNumber()); 333 .Times(AnyNumber());
333 } 334 }
334 335
335 EXPECT_CALL(*connection_, Disconnect()) 336 EXPECT_CALL(*connection_, Disconnect())
336 .RetiresOnSaturation(); 337 .RetiresOnSaturation();
337 338
338 SimulateClientConnection(0, true); 339 SimulateClientConnection(0, true);
339 message_loop_.Run(); 340 message_loop_.Run();
340 } 341 }
341 342
342 TEST_F(ChromotingHostTest, DISABLED_ConnectTwice) { 343 TEST_F(ChromotingHostTest, DISABLED_ConnectTwice) {
343 host_->Start(); 344 host_->Start();
344 345
345 // When a video packet is received we connect the second mock 346 // When a video packet is received we connect the second mock
346 // connection. 347 // connection.
347 { 348 {
348 InSequence s; 349 InSequence s;
349 EXPECT_CALL(*disconnect_window_, Show(_, _)) 350 EXPECT_CALL(*disconnect_window_, Show(_, _, _))
350 .Times(0); 351 .Times(0);
351 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 352 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
352 .WillOnce(DoAll( 353 .WillOnce(DoAll(
353 InvokeWithoutArgs( 354 InvokeWithoutArgs(
354 CreateFunctor( 355 CreateFunctor(
355 this, 356 this,
356 &ChromotingHostTest::SimulateClientConnection, 1, true)), 357 &ChromotingHostTest::SimulateClientConnection, 1, true)),
357 RunDoneTask())) 358 RunDoneTask()))
358 .RetiresOnSaturation(); 359 .RetiresOnSaturation();
359 EXPECT_CALL(*disconnect_window_, Show(_, _)) 360 EXPECT_CALL(*disconnect_window_, Show(_, _, _))
360 .Times(0); 361 .Times(0);
361 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _)) 362 EXPECT_CALL(video_stub_, ProcessVideoPacketPtr(_, _))
362 .Times(AnyNumber()); 363 .Times(AnyNumber());
363 EXPECT_CALL(video_stub2_, ProcessVideoPacketPtr(_, _)) 364 EXPECT_CALL(video_stub2_, ProcessVideoPacketPtr(_, _))
364 .WillOnce(DoAll( 365 .WillOnce(DoAll(
365 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost), 366 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost),
366 RunDoneTask())) 367 RunDoneTask()))
367 .RetiresOnSaturation(); 368 .RetiresOnSaturation();
368 EXPECT_CALL(video_stub2_, ProcessVideoPacketPtr(_, _)) 369 EXPECT_CALL(video_stub2_, ProcessVideoPacketPtr(_, _))
369 .Times(AnyNumber()); 370 .Times(AnyNumber());
370 } 371 }
371 372
372 EXPECT_CALL(*connection_, Disconnect()) 373 EXPECT_CALL(*connection_, Disconnect())
373 .RetiresOnSaturation(); 374 .RetiresOnSaturation();
374 EXPECT_CALL(*connection2_, Disconnect()) 375 EXPECT_CALL(*connection2_, Disconnect())
375 .RetiresOnSaturation(); 376 .RetiresOnSaturation();
376 377
377 SimulateClientConnection(0, true); 378 SimulateClientConnection(0, true);
378 message_loop_.Run(); 379 message_loop_.Run();
379 } 380 }
380 381
381 } // namespace remoting 382 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/continue_window_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698