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

Unified Diff: remoting/host/chromoting_host_unittest.cc

Issue 2420183002: Don't use barcodes in ProtocolPerfTests (Closed)
Patch Set: Update ChromotingHost::OnSessionAuthenticated() to fix test crash Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/client_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host_unittest.cc
diff --git a/remoting/host/chromoting_host_unittest.cc b/remoting/host/chromoting_host_unittest.cc
index f01539bf7886dadce55bab3183f5193fcd6ba99e..5c631f052d317b4aaf0a377e8cc1f2998b1f81e0 100644
--- a/remoting/host/chromoting_host_unittest.cc
+++ b/remoting/host/chromoting_host_unittest.cc
@@ -136,7 +136,7 @@ class ChromotingHostTest : public testing::Test {
get_client(connection_index) = client_ptr;
// |host| is responsible for deleting |client| from now on.
- host_->clients_.push_back(client.release());
+ host_->clients_.push_back(std::move(client));
if (authenticate) {
client_ptr->OnConnectionAuthenticated();
@@ -244,11 +244,6 @@ class ChromotingHostTest : public testing::Test {
return (connection_index == 0) ? client1_ : client2_;
}
- // Returns the list of clients of the host_.
- std::list<ClientSession*>& get_clients_from_host() {
- return host_->clients_;
- }
-
const std::string& get_session_jid(int connection_index) {
return (connection_index == 0) ? session_jid1_ : session_jid2_;
}
@@ -338,7 +333,8 @@ TEST_F(ChromotingHostTest, LoginBackOffUponConnection) {
host_->OnIncomingSession(session_unowned1_.release(), &response);
EXPECT_EQ(protocol::SessionManager::ACCEPT, response);
- host_->OnSessionAuthenticating(get_clients_from_host().front());
+ host_->OnSessionAuthenticating(
+ host_->client_sessions_for_tests().front().get());
host_->OnIncomingSession(session_unowned2_.get(), &response);
EXPECT_EQ(protocol::SessionManager::OVERLOAD, response);
}
@@ -362,13 +358,15 @@ TEST_F(ChromotingHostTest, LoginBackOffUponAuthenticating) {
EXPECT_EQ(protocol::SessionManager::ACCEPT, response);
// This will set the backoff.
- host_->OnSessionAuthenticating(get_clients_from_host().front());
+ host_->OnSessionAuthenticating(
+ host_->client_sessions_for_tests().front().get());
// This should disconnect client2.
- host_->OnSessionAuthenticating(get_clients_from_host().back());
+ host_->OnSessionAuthenticating(
+ host_->client_sessions_for_tests().back().get());
// Verify that the host only has 1 client at this point.
- EXPECT_EQ(get_clients_from_host().size(), 1U);
+ EXPECT_EQ(host_->client_sessions_for_tests().size(), 1U);
}
TEST_F(ChromotingHostTest, OnSessionRouteChange) {
« no previous file with comments | « remoting/host/chromoting_host.cc ('k') | remoting/host/client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698