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

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

Issue 205583011: [Draft] Fix canceling pin prompt causes host overload (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Unittests and also reject connections upon authenticating Created 6 years, 8 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 "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/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "remoting/base/auto_thread_task_runner.h" 9 #include "remoting/base/auto_thread_task_runner.h"
10 #include "remoting/host/audio_capturer.h" 10 #include "remoting/host/audio_capturer.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 586
587 protocol::SessionManager::IncomingSessionResponse response = 587 protocol::SessionManager::IncomingSessionResponse response =
588 protocol::SessionManager::DECLINE; 588 protocol::SessionManager::DECLINE;
589 host_->OnIncomingSession(session_unowned1_.release(), &response); 589 host_->OnIncomingSession(session_unowned1_.release(), &response);
590 EXPECT_EQ(protocol::SessionManager::ACCEPT, response); 590 EXPECT_EQ(protocol::SessionManager::ACCEPT, response);
591 591
592 ShutdownHost(); 592 ShutdownHost();
593 message_loop_.Run(); 593 message_loop_.Run();
594 } 594 }
595 595
596 TEST_F(ChromotingHostTest, IncomingSessionOverload) { 596 TEST_F(ChromotingHostTest, IncomingSessionOverload) {
Sergey Ulanov 2014/03/27 19:06:55 Please add another test for the case when a sessio
597 ExpectHostAndSessionManagerStart(); 597 ExpectHostAndSessionManagerStart();
598 EXPECT_CALL(*session_unowned1_, candidate_config()).WillOnce(Return( 598 EXPECT_CALL(*session_unowned1_, candidate_config()).WillOnce(Return(
599 default_candidate_config_.get())); 599 default_candidate_config_.get()));
600 EXPECT_CALL(*session_unowned1_, set_config(_)); 600 EXPECT_CALL(*session_unowned1_, set_config(_));
601 EXPECT_CALL(*session_unowned1_, Close()).WillOnce(InvokeWithoutArgs( 601 EXPECT_CALL(*session_unowned1_, Close()).WillOnce(InvokeWithoutArgs(
602 this, &ChromotingHostTest::NotifyConnectionClosed)); 602 this, &ChromotingHostTest::NotifyConnectionClosed));
603 EXPECT_CALL(host_status_observer_, OnAccessDenied(_)); 603 EXPECT_CALL(host_status_observer_, OnAccessDenied(_));
604 EXPECT_CALL(host_status_observer_, OnShutdown()); 604 EXPECT_CALL(host_status_observer_, OnShutdown());
605 605
606 host_->Start(xmpp_login_); 606 host_->Start(xmpp_login_);
607 607
608 protocol::SessionManager::IncomingSessionResponse response = 608 protocol::SessionManager::IncomingSessionResponse response =
609 protocol::SessionManager::DECLINE; 609 protocol::SessionManager::DECLINE;
610
610 host_->OnIncomingSession(session_unowned1_.release(), &response); 611 host_->OnIncomingSession(session_unowned1_.release(), &response);
611 EXPECT_EQ(protocol::SessionManager::ACCEPT, response); 612 EXPECT_EQ(protocol::SessionManager::ACCEPT, response);
612 613 host_->OnSessionAuthenticating(NULL);
Sergey Ulanov 2014/03/27 19:06:55 s/NULL/host_->clients_.front()/
kelvinp 2014/04/01 21:23:49 Done.
613 host_->OnIncomingSession(session_unowned2_.get(), &response); 614 host_->OnIncomingSession(session_unowned2_.get(), &response);
614 EXPECT_EQ(protocol::SessionManager::OVERLOAD, response); 615 EXPECT_EQ(protocol::SessionManager::OVERLOAD, response);
615 616
616 ShutdownHost(); 617 ShutdownHost();
617 message_loop_.Run(); 618 message_loop_.Run();
618 } 619 }
619 620
620 TEST_F(ChromotingHostTest, OnSessionRouteChange) { 621 TEST_F(ChromotingHostTest, OnSessionRouteChange) {
621 std::string channel_name("ChannelName"); 622 std::string channel_name("ChannelName");
622 protocol::TransportRoute route; 623 protocol::TransportRoute route;
(...skipping 23 matching lines...) Expand all
646 ExpectClientDisconnected(0, true, video_packet_sent, 647 ExpectClientDisconnected(0, true, video_packet_sent,
647 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 648 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
648 EXPECT_CALL(host_status_observer_, OnShutdown()); 649 EXPECT_CALL(host_status_observer_, OnShutdown());
649 650
650 host_->Start(xmpp_login_); 651 host_->Start(xmpp_login_);
651 SimulateClientConnection(0, true, false); 652 SimulateClientConnection(0, true, false);
652 message_loop_.Run(); 653 message_loop_.Run();
653 } 654 }
654 655
655 } // namespace remoting 656 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698