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

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

Issue 1463293002: Replace MockConnectionToClient with FakeConnectionToClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_RejectAuthenticatingClient
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | remoting/host/client_session_unittest.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/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 "remoting/base/auto_thread_task_runner.h" 8 #include "remoting/base/auto_thread_task_runner.h"
9 #include "remoting/host/audio_capturer.h" 9 #include "remoting/host/audio_capturer.h"
10 #include "remoting/host/chromoting_host.h" 10 #include "remoting/host/chromoting_host.h"
11 #include "remoting/host/chromoting_host_context.h" 11 #include "remoting/host/chromoting_host_context.h"
12 #include "remoting/host/desktop_environment.h" 12 #include "remoting/host/desktop_environment.h"
13 #include "remoting/host/fake_mouse_cursor_monitor.h" 13 #include "remoting/host/fake_mouse_cursor_monitor.h"
14 #include "remoting/host/host_mock_objects.h" 14 #include "remoting/host/host_mock_objects.h"
15 #include "remoting/proto/video.pb.h" 15 #include "remoting/proto/video.pb.h"
16 #include "remoting/protocol/errors.h" 16 #include "remoting/protocol/errors.h"
17 #include "remoting/protocol/fake_connection_to_client.h"
17 #include "remoting/protocol/fake_desktop_capturer.h" 18 #include "remoting/protocol/fake_desktop_capturer.h"
18 #include "remoting/protocol/protocol_mock_objects.h" 19 #include "remoting/protocol/protocol_mock_objects.h"
19 #include "remoting/protocol/session_config.h" 20 #include "remoting/protocol/session_config.h"
20 #include "remoting/signaling/mock_signal_strategy.h" 21 #include "remoting/signaling/mock_signal_strategy.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gmock_mutant.h" 23 #include "testing/gmock_mutant.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
25 using ::remoting::protocol::MockClientStub; 26 using ::remoting::protocol::MockClientStub;
26 using ::remoting::protocol::MockConnectionToClient;
27 using ::remoting::protocol::MockConnectionToClientEventHandler; 27 using ::remoting::protocol::MockConnectionToClientEventHandler;
28 using ::remoting::protocol::MockHostStub; 28 using ::remoting::protocol::MockHostStub;
29 using ::remoting::protocol::MockSession; 29 using ::remoting::protocol::MockSession;
30 using ::remoting::protocol::MockVideoStub; 30 using ::remoting::protocol::MockVideoStub;
31 using ::remoting::protocol::Session; 31 using ::remoting::protocol::Session;
32 using ::remoting::protocol::SessionConfig; 32 using ::remoting::protocol::SessionConfig;
33 33
34 using testing::_; 34 using testing::_;
35 using testing::AnyNumber; 35 using testing::AnyNumber;
36 using testing::AtLeast; 36 using testing::AtLeast;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 .WillRepeatedly(SaveArg<0>(&session_unowned1_event_handler_)); 123 .WillRepeatedly(SaveArg<0>(&session_unowned1_event_handler_));
124 EXPECT_CALL(*session_unowned2_, SetEventHandler(_)) 124 EXPECT_CALL(*session_unowned2_, SetEventHandler(_))
125 .Times(AnyNumber()) 125 .Times(AnyNumber())
126 .WillRepeatedly(SaveArg<0>(&session_unowned2_event_handler_)); 126 .WillRepeatedly(SaveArg<0>(&session_unowned2_event_handler_));
127 EXPECT_CALL(*session1_, config()) 127 EXPECT_CALL(*session1_, config())
128 .WillRepeatedly(ReturnRef(*session_config1_)); 128 .WillRepeatedly(ReturnRef(*session_config1_));
129 EXPECT_CALL(*session2_, config()) 129 EXPECT_CALL(*session2_, config())
130 .WillRepeatedly(ReturnRef(*session_config2_)); 130 .WillRepeatedly(ReturnRef(*session_config2_));
131 131
132 owned_connection1_.reset( 132 owned_connection1_.reset(
133 new MockConnectionToClient(make_scoped_ptr(session1_), &host_stub1_)); 133 new protocol::FakeConnectionToClient(make_scoped_ptr(session1_)));
134 owned_connection1_->set_host_stub(&host_stub1_);
134 connection1_ = owned_connection1_.get(); 135 connection1_ = owned_connection1_.get();
136 connection1_->set_video_stub(&video_stub1_);
137 connection1_->set_client_stub(&client_stub1_);
138
135 owned_connection2_.reset( 139 owned_connection2_.reset(
136 new MockConnectionToClient(make_scoped_ptr(session2_), &host_stub2_)); 140 new protocol::FakeConnectionToClient(make_scoped_ptr(session2_)));
141 owned_connection2_->set_host_stub(&host_stub2_);
137 connection2_ = owned_connection2_.get(); 142 connection2_ = owned_connection2_.get();
143 connection2_->set_video_stub(&video_stub2_);
144 connection2_->set_client_stub(&client_stub2_);
138 145
139 ON_CALL(video_stub1_, ProcessVideoPacketPtr(_, _)) 146 ON_CALL(video_stub1_, ProcessVideoPacketPtr(_, _))
140 .WillByDefault(DeleteArg<0>()); 147 .WillByDefault(DeleteArg<0>());
141 ON_CALL(video_stub2_, ProcessVideoPacketPtr(_, _)) 148 ON_CALL(video_stub2_, ProcessVideoPacketPtr(_, _))
142 .WillByDefault(DeleteArg<0>()); 149 .WillByDefault(DeleteArg<0>());
143 ON_CALL(*connection1_, video_stub())
144 .WillByDefault(Return(&video_stub1_));
145 ON_CALL(*connection1_, client_stub())
146 .WillByDefault(Return(&client_stub1_));
147 ON_CALL(*connection2_, video_stub())
148 .WillByDefault(Return(&video_stub2_));
149 ON_CALL(*connection2_, client_stub())
150 .WillByDefault(Return(&client_stub2_));
151 EXPECT_CALL(*connection1_, video_stub())
152 .Times(AnyNumber());
153 EXPECT_CALL(*connection1_, client_stub())
154 .Times(AnyNumber());
155 EXPECT_CALL(*connection2_, video_stub())
156 .Times(AnyNumber());
157 EXPECT_CALL(*connection2_, client_stub())
158 .Times(AnyNumber());
159 } 150 }
160 151
161 // Helper method to pretend a client is connected to ChromotingHost. 152 // Helper method to pretend a client is connected to ChromotingHost.
162 void SimulateClientConnection(int connection_index, bool authenticate, 153 void SimulateClientConnection(int connection_index, bool authenticate,
163 bool reject) { 154 bool reject) {
164 scoped_ptr<protocol::ConnectionToClient> connection = 155 scoped_ptr<protocol::ConnectionToClient> connection =
165 ((connection_index == 0) ? owned_connection1_ : owned_connection2_) 156 ((connection_index == 0) ? owned_connection1_ : owned_connection2_)
166 .Pass(); 157 .Pass();
167 protocol::ConnectionToClient* connection_ptr = connection.get(); 158 protocol::ConnectionToClient* connection_ptr = connection.get();
168 scoped_ptr<ClientSession> client(new ClientSession( 159 scoped_ptr<ClientSession> client(new ClientSession(
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 action, 323 action,
333 RunDoneTask())) 324 RunDoneTask()))
334 .RetiresOnSaturation(); 325 .RetiresOnSaturation();
335 EXPECT_CALL(video_stub, ProcessVideoPacketPtr(_, _)) 326 EXPECT_CALL(video_stub, ProcessVideoPacketPtr(_, _))
336 .Times(AnyNumber()) 327 .Times(AnyNumber())
337 .After(video_packet_sent) 328 .After(video_packet_sent)
338 .WillRepeatedly(RunDoneTask()); 329 .WillRepeatedly(RunDoneTask());
339 return video_packet_sent; 330 return video_packet_sent;
340 } 331 }
341 332
342 // Return an expectation that a client will disconnect after a given 333 // Expect that a client is disconnected after a given expectation. The given
343 // expectation. The given action will be done after the event executor is 334 // action will be done after the status observer is notified that the session
344 // notified that the session has finished. 335 // has finished.
345 template <class A> 336 template <class A>
346 Expectation ExpectClientDisconnected(int connection_index, 337 Expectation ExpectClientDisconnected(int connection_index,
347 bool expect_host_status_change,
348 Expectation after, 338 Expectation after,
349 A action) { 339 A action) {
350 MockConnectionToClient* connection = get_connection(connection_index); 340 return EXPECT_CALL(host_status_observer_,
351 341 OnClientDisconnected(get_session_jid(connection_index)))
352 Expectation client_disconnected = 342 .After(after)
353 EXPECT_CALL(*connection, Disconnect(_)) 343 .WillOnce(action)
354 .After(after) 344 .RetiresOnSaturation();
355 .WillOnce(InvokeWithoutArgs(CreateFunctor(
356 this, &ChromotingHostTest::NotifyClientSessionClosed,
357 connection_index)))
358 .RetiresOnSaturation();
359 ExpectClientDisconnectEffects(connection_index,
360 expect_host_status_change,
361 after,
362 action);
363 return client_disconnected;
364 }
365
366 // Expect the side-effects of a client disconnection, after a given
367 // expectation. The given action will be done after the event executor is
368 // notifed that the session has finished.
369 template <class A>
370 void ExpectClientDisconnectEffects(int connection_index,
371 bool expect_host_status_change,
372 Expectation after,
373 A action) {
374 const std::string& session_jid = get_session_jid(connection_index);
375
376 if (expect_host_status_change) {
377 EXPECT_CALL(host_status_observer_, OnClientDisconnected(session_jid))
378 .After(after)
379 .WillOnce(action)
380 .RetiresOnSaturation();
381 }
382 } 345 }
383 346
384 protected: 347 protected:
385 base::MessageLoop message_loop_; 348 base::MessageLoop message_loop_;
386 scoped_refptr<AutoThreadTaskRunner> task_runner_; 349 scoped_refptr<AutoThreadTaskRunner> task_runner_;
387 MockConnectionToClientEventHandler handler_; 350 MockConnectionToClientEventHandler handler_;
388 MockSignalStrategy signal_strategy_; 351 MockSignalStrategy signal_strategy_;
389 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory_; 352 scoped_ptr<MockDesktopEnvironmentFactory> desktop_environment_factory_;
390 scoped_ptr<ChromotingHost> host_; 353 scoped_ptr<ChromotingHost> host_;
391 MockHostStatusObserver host_status_observer_; 354 MockHostStatusObserver host_status_observer_;
392 protocol::MockSessionManager* session_manager_; 355 protocol::MockSessionManager* session_manager_;
393 std::string xmpp_login_; 356 std::string xmpp_login_;
394 MockConnectionToClient* connection1_; 357 protocol::FakeConnectionToClient* connection1_;
395 scoped_ptr<MockConnectionToClient> owned_connection1_; 358 scoped_ptr<protocol::FakeConnectionToClient> owned_connection1_;
396 ClientSession* client1_; 359 ClientSession* client1_;
397 std::string session_jid1_; 360 std::string session_jid1_;
398 MockSession* session1_; // Owned by |connection_|. 361 MockSession* session1_; // Owned by |connection_|.
399 scoped_ptr<SessionConfig> session_config1_; 362 scoped_ptr<SessionConfig> session_config1_;
400 MockVideoStub video_stub1_; 363 MockVideoStub video_stub1_;
401 MockClientStub client_stub1_; 364 MockClientStub client_stub1_;
402 MockHostStub host_stub1_; 365 MockHostStub host_stub1_;
403 MockConnectionToClient* connection2_; 366 protocol::FakeConnectionToClient* connection2_;
404 scoped_ptr<MockConnectionToClient> owned_connection2_; 367 scoped_ptr<protocol::FakeConnectionToClient> owned_connection2_;
405 ClientSession* client2_; 368 ClientSession* client2_;
406 std::string session_jid2_; 369 std::string session_jid2_;
407 MockSession* session2_; // Owned by |connection2_|. 370 MockSession* session2_; // Owned by |connection2_|.
408 scoped_ptr<SessionConfig> session_config2_; 371 scoped_ptr<SessionConfig> session_config2_;
409 MockVideoStub video_stub2_; 372 MockVideoStub video_stub2_;
410 MockClientStub client_stub2_; 373 MockClientStub client_stub2_;
411 MockHostStub host_stub2_; 374 MockHostStub host_stub2_;
412 scoped_ptr<MockSession> session_unowned1_; // Not owned by a connection. 375 scoped_ptr<MockSession> session_unowned1_; // Not owned by a connection.
413 std::string session_unowned_jid1_; 376 std::string session_unowned_jid1_;
414 scoped_ptr<MockSession> session_unowned2_; // Not owned by a connection. 377 scoped_ptr<MockSession> session_unowned2_; // Not owned by a connection.
415 std::string session_unowned_jid2_; 378 std::string session_unowned_jid2_;
416 protocol::Session::EventHandler* session_unowned1_event_handler_; 379 protocol::Session::EventHandler* session_unowned1_event_handler_;
417 protocol::Session::EventHandler* session_unowned2_event_handler_; 380 protocol::Session::EventHandler* session_unowned2_event_handler_;
418 381
419 MockConnectionToClient*& get_connection(int connection_index) { 382 protocol::FakeConnectionToClient*& get_connection(int connection_index) {
420 return (connection_index == 0) ? connection1_ : connection2_; 383 return (connection_index == 0) ? connection1_ : connection2_;
421 } 384 }
422 385
423 // Returns the cached client pointers client1_ or client2_. 386 // Returns the cached client pointers client1_ or client2_.
424 ClientSession*& get_client(int connection_index) { 387 ClientSession*& get_client(int connection_index) {
425 return (connection_index == 0) ? client1_ : client2_; 388 return (connection_index == 0) ? client1_ : client2_;
426 } 389 }
427 390
428 // Returns the list of clients of the host_. 391 // Returns the list of clients of the host_.
429 std::list<ClientSession*>& get_clients_from_host() { 392 std::list<ClientSession*>& get_clients_from_host() {
(...skipping 17 matching lines...) Expand all
447 ShutdownHost(); 410 ShutdownHost();
448 message_loop_.Run(); 411 message_loop_.Run();
449 } 412 }
450 413
451 TEST_F(ChromotingHostTest, Connect) { 414 TEST_F(ChromotingHostTest, Connect) {
452 ExpectHostAndSessionManagerStart(); 415 ExpectHostAndSessionManagerStart();
453 416
454 // Shut down the host when the first video packet is received. 417 // Shut down the host when the first video packet is received.
455 Expectation video_packet_sent = ExpectClientConnected( 418 Expectation video_packet_sent = ExpectClientConnected(
456 0, InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 419 0, InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
457 Expectation client_disconnected = ExpectClientDisconnected( 420 EXPECT_CALL(host_status_observer_, OnShutdown()).After(video_packet_sent);
458 0, true, video_packet_sent, InvokeWithoutArgs(base::DoNothing));
459 EXPECT_CALL(host_status_observer_, OnShutdown()).After(client_disconnected);
460 421
461 host_->Start(xmpp_login_); 422 host_->Start(xmpp_login_);
462 SimulateClientConnection(0, true, false); 423 SimulateClientConnection(0, true, false);
463 message_loop_.Run(); 424 message_loop_.Run();
464 } 425 }
465 426
466 TEST_F(ChromotingHostTest, AuthenticationFailed) { 427 TEST_F(ChromotingHostTest, AuthenticationFailed) {
467 ExpectHostAndSessionManagerStart(); 428 ExpectHostAndSessionManagerStart();
468 EXPECT_CALL(host_status_observer_, OnAccessDenied(session_jid1_)) 429 EXPECT_CALL(host_status_observer_, OnAccessDenied(session_jid1_))
469 .WillOnce(InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 430 .WillOnce(InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
470 EXPECT_CALL(host_status_observer_, OnShutdown()); 431 EXPECT_CALL(host_status_observer_, OnShutdown());
471 432
472 host_->Start(xmpp_login_); 433 host_->Start(xmpp_login_);
473 SimulateClientConnection(0, false, false); 434 SimulateClientConnection(0, false, false);
474 message_loop_.Run(); 435 message_loop_.Run();
475 } 436 }
476 437
477 TEST_F(ChromotingHostTest, Reconnect) { 438 TEST_F(ChromotingHostTest, Reconnect) {
478 ExpectHostAndSessionManagerStart(); 439 ExpectHostAndSessionManagerStart();
479 440
480 // When a video packet is received on the first connection, disconnect it, 441 // When a video packet is received on the first connection, disconnect it,
481 // then quit the message loop. 442 // then quit the message loop.
482 Expectation video_packet_sent1 = ExpectClientConnected(0, DoAll( 443 Expectation video_packet_sent1 = ExpectClientConnected(0, DoAll(
483 InvokeWithoutArgs(this, &ChromotingHostTest::DisconnectClient1), 444 InvokeWithoutArgs(this, &ChromotingHostTest::DisconnectClient1),
484 InvokeWithoutArgs(this, &ChromotingHostTest::QuitMainMessageLoop))); 445 InvokeWithoutArgs(this, &ChromotingHostTest::QuitMainMessageLoop)));
485 ExpectClientDisconnectEffects( 446 ExpectClientDisconnected(
486 0, true, video_packet_sent1, InvokeWithoutArgs(base::DoNothing)); 447 0, video_packet_sent1, InvokeWithoutArgs(base::DoNothing));
487 448
488 // When a video packet is received on the second connection, shut down the 449 // When a video packet is received on the second connection, shut down the
489 // host. 450 // host.
490 Expectation video_packet_sent2 = ExpectClientConnected( 451 Expectation video_packet_sent2 = ExpectClientConnected(
491 1, InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 452 1, InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
492 Expectation client_disconnected2 = ExpectClientDisconnected( 453 Expectation client_disconnected2 = ExpectClientDisconnected(
493 1, true, video_packet_sent2, InvokeWithoutArgs(base::DoNothing)); 454 1, video_packet_sent2, InvokeWithoutArgs(base::DoNothing));
494 EXPECT_CALL(host_status_observer_, OnShutdown()).After(client_disconnected2); 455 EXPECT_CALL(host_status_observer_, OnShutdown()).After(client_disconnected2);
495 456
496 host_->Start(xmpp_login_); 457 host_->Start(xmpp_login_);
497 SimulateClientConnection(0, true, false); 458 SimulateClientConnection(0, true, false);
498 message_loop_.Run(); 459 message_loop_.Run();
499 SimulateClientConnection(1, true, false); 460 SimulateClientConnection(1, true, false);
500 message_loop_.Run(); 461 message_loop_.Run();
501 } 462 }
502 463
503 TEST_F(ChromotingHostTest, ConnectWhenAnotherClientIsConnected) { 464 TEST_F(ChromotingHostTest, ConnectWhenAnotherClientIsConnected) {
504 ExpectHostAndSessionManagerStart(); 465 ExpectHostAndSessionManagerStart();
505 466
506 // When a video packet is received, connect the second connection. 467 // When a video packet is received, connect the second connection.
507 // This should disconnect the first connection. 468 // This should disconnect the first connection.
508 Expectation video_packet_sent1 = ExpectClientConnected( 469 Expectation video_packet_sent1 = ExpectClientConnected(
509 0, 470 0,
510 InvokeWithoutArgs( 471 InvokeWithoutArgs(
511 CreateFunctor( 472 CreateFunctor(
512 this, 473 this,
513 &ChromotingHostTest::SimulateClientConnection, 1, true, false))); 474 &ChromotingHostTest::SimulateClientConnection, 1, true, false)));
514 ExpectClientDisconnected( 475 ExpectClientDisconnected(
515 0, true, video_packet_sent1, InvokeWithoutArgs(base::DoNothing)); 476 0, video_packet_sent1, InvokeWithoutArgs(base::DoNothing));
516 Expectation video_packet_sent2 = ExpectClientConnected( 477 Expectation video_packet_sent2 = ExpectClientConnected(
517 1, InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 478 1, InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
518 Expectation client_disconnected2 = ExpectClientDisconnected( 479 Expectation client_disconnected2 = ExpectClientDisconnected(
519 1, true, video_packet_sent2, InvokeWithoutArgs(base::DoNothing)); 480 1, video_packet_sent2, InvokeWithoutArgs(base::DoNothing));
520 EXPECT_CALL(host_status_observer_, OnShutdown()).After(client_disconnected2); 481 EXPECT_CALL(host_status_observer_, OnShutdown()).After(client_disconnected2);
521 482
522 host_->Start(xmpp_login_); 483 host_->Start(xmpp_login_);
523 SimulateClientConnection(0, true, false); 484 SimulateClientConnection(0, true, false);
524 message_loop_.Run(); 485 message_loop_.Run();
525 } 486 }
526 487
527 TEST_F(ChromotingHostTest, IncomingSessionDeclined) { 488 TEST_F(ChromotingHostTest, IncomingSessionDeclined) {
528 protocol::SessionManager::IncomingSessionResponse response = 489 protocol::SessionManager::IncomingSessionResponse response =
529 protocol::SessionManager::ACCEPT; 490 protocol::SessionManager::ACCEPT;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 ShutdownHost(); 569 ShutdownHost();
609 message_loop_.Run(); 570 message_loop_.Run();
610 } 571 }
611 572
612 TEST_F(ChromotingHostTest, OnSessionRouteChange) { 573 TEST_F(ChromotingHostTest, OnSessionRouteChange) {
613 std::string channel_name("ChannelName"); 574 std::string channel_name("ChannelName");
614 protocol::TransportRoute route; 575 protocol::TransportRoute route;
615 576
616 ExpectHostAndSessionManagerStart(); 577 ExpectHostAndSessionManagerStart();
617 Expectation video_packet_sent = ExpectClientConnected( 578 Expectation video_packet_sent = ExpectClientConnected(
618 0, InvokeWithoutArgs(CreateFunctor( 579 0,
580 InvokeWithoutArgs(CreateFunctor(
619 this, &ChromotingHostTest::ChangeSessionRoute, channel_name, route))); 581 this, &ChromotingHostTest::ChangeSessionRoute, channel_name, route)));
620 Expectation route_change = 582 Expectation route_change =
621 EXPECT_CALL(host_status_observer_, OnClientRouteChange( 583 EXPECT_CALL(host_status_observer_,
622 session_jid1_, channel_name, _)) 584 OnClientRouteChange(session_jid1_, channel_name, _))
623 .After(video_packet_sent) 585 .After(video_packet_sent)
624 .WillOnce(InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 586 .WillOnce(InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
625 ExpectClientDisconnected(0, true, route_change, 587 ExpectClientDisconnected(0, route_change, InvokeWithoutArgs(base::DoNothing));
626 InvokeWithoutArgs(base::DoNothing));
627 EXPECT_CALL(host_status_observer_, OnShutdown()); 588 EXPECT_CALL(host_status_observer_, OnShutdown());
628 589
629 host_->Start(xmpp_login_); 590 host_->Start(xmpp_login_);
630 SimulateClientConnection(0, true, false); 591 SimulateClientConnection(0, true, false);
631 message_loop_.Run(); 592 message_loop_.Run();
632 } 593 }
633 594
634 TEST_F(ChromotingHostTest, DisconnectAllClients) { 595 TEST_F(ChromotingHostTest, DisconnectAllClients) {
635 ExpectHostAndSessionManagerStart(); 596 ExpectHostAndSessionManagerStart();
636 Expectation video_packet_sent = ExpectClientConnected( 597 Expectation video_packet_sent = ExpectClientConnected(
637 0, InvokeWithoutArgs(this, &ChromotingHostTest::DisconnectAllClients)); 598 0, InvokeWithoutArgs(this, &ChromotingHostTest::DisconnectAllClients));
638 ExpectClientDisconnected(0, true, video_packet_sent, 599 ExpectClientDisconnected(
600 0, video_packet_sent,
639 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 601 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
640 EXPECT_CALL(host_status_observer_, OnShutdown()); 602 EXPECT_CALL(host_status_observer_, OnShutdown());
641 603
642 host_->Start(xmpp_login_); 604 host_->Start(xmpp_login_);
643 SimulateClientConnection(0, true, false); 605 SimulateClientConnection(0, true, false);
644 message_loop_.Run(); 606 message_loop_.Run();
645 } 607 }
646 608
647 } // namespace remoting 609 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/host/client_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698