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

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: Address feedbacks from sergey Created 6 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 "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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
597 ExpectHostAndSessionManagerStart(); 597 ExpectHostAndSessionManagerStart();
598 EXPECT_CALL(*session_unowned1_, candidate_config()).WillOnce(Return(
599 default_candidate_config_.get()));
600 EXPECT_CALL(*session_unowned1_, set_config(_));
601 EXPECT_CALL(*session_unowned1_, Close()).WillOnce(InvokeWithoutArgs(
602 this, &ChromotingHostTest::NotifyConnectionClosed));
603 EXPECT_CALL(host_status_observer_, OnAccessDenied(_));
604 EXPECT_CALL(host_status_observer_, OnShutdown()); 598 EXPECT_CALL(host_status_observer_, OnShutdown());
605 599
606 host_->Start(xmpp_login_); 600 host_->Start(xmpp_login_);
607 601
608 protocol::SessionManager::IncomingSessionResponse response = 602 protocol::SessionManager::IncomingSessionResponse response =
609 protocol::SessionManager::DECLINE; 603 protocol::SessionManager::DECLINE;
610 host_->OnIncomingSession(session_unowned1_.release(), &response);
611 EXPECT_EQ(protocol::SessionManager::ACCEPT, response);
612 604
613 host_->OnIncomingSession(session_unowned2_.get(), &response); 605 host_->OnSessionAuthenticating(NULL);
Sergey Ulanov 2014/03/26 01:49:16 This test will break when OnSessionAuthenticating(
kelvinp 2014/03/27 03:23:21 Done.
606 host_->OnIncomingSession(session_unowned1_.get(), &response);
614 EXPECT_EQ(protocol::SessionManager::OVERLOAD, response); 607 EXPECT_EQ(protocol::SessionManager::OVERLOAD, response);
615 608
616 ShutdownHost(); 609 ShutdownHost();
617 message_loop_.Run(); 610 message_loop_.Run();
618 } 611 }
619 612
620 TEST_F(ChromotingHostTest, OnSessionRouteChange) { 613 TEST_F(ChromotingHostTest, OnSessionRouteChange) {
621 std::string channel_name("ChannelName"); 614 std::string channel_name("ChannelName");
622 protocol::TransportRoute route; 615 protocol::TransportRoute route;
623 616
(...skipping 22 matching lines...) Expand all
646 ExpectClientDisconnected(0, true, video_packet_sent, 639 ExpectClientDisconnected(0, true, video_packet_sent,
647 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost)); 640 InvokeWithoutArgs(this, &ChromotingHostTest::ShutdownHost));
648 EXPECT_CALL(host_status_observer_, OnShutdown()); 641 EXPECT_CALL(host_status_observer_, OnShutdown());
649 642
650 host_->Start(xmpp_login_); 643 host_->Start(xmpp_login_);
651 SimulateClientConnection(0, true, false); 644 SimulateClientConnection(0, true, false);
652 message_loop_.Run(); 645 message_loop_.Run();
653 } 646 }
654 647
655 } // namespace remoting 648 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698