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

Side by Side Diff: remoting/test/test_chromoting_client_unittest.cc

Issue 2542343004: Updating the Chromoting Test Driver to target the test environment (Closed)
Patch Set: Addressing feedback Created 4 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 | « remoting/test/test_chromoting_client.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/test/test_chromoting_client.h" 5 #include "remoting/test/test_chromoting_client.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 } 103 }
104 104
105 void TestChromotingClientTest::ConnectionReady(bool ready) { 105 void TestChromotingClientTest::ConnectionReady(bool ready) {
106 if (ready) { 106 if (ready) {
107 is_connected_to_host_ = true; 107 is_connected_to_host_ = true;
108 } 108 }
109 } 109 }
110 110
111 TEST_F(TestChromotingClientTest, StartConnectionAndDisconnect) { 111 TEST_F(TestChromotingClientTest, StartConnectionAndDisconnect) {
112 test_chromoting_client_->StartConnection(connection_setup_info_); 112 test_chromoting_client_->StartConnection(false, connection_setup_info_);
113 EXPECT_EQ(protocol::ConnectionToHost::State::CONNECTING, connection_state_); 113 EXPECT_EQ(protocol::ConnectionToHost::State::CONNECTING, connection_state_);
114 EXPECT_EQ(protocol::OK, error_code_); 114 EXPECT_EQ(protocol::OK, error_code_);
115 EXPECT_FALSE(is_connected_to_host_); 115 EXPECT_FALSE(is_connected_to_host_);
116 116
117 // Simulate an AUTHENTICATED message being sent from the Jingle session. 117 // Simulate an AUTHENTICATED message being sent from the Jingle session.
118 fake_connection_to_host_->SignalStateChange(protocol::Session::AUTHENTICATED, 118 fake_connection_to_host_->SignalStateChange(protocol::Session::AUTHENTICATED,
119 protocol::OK); 119 protocol::OK);
120 EXPECT_EQ(protocol::ConnectionToHost::State::AUTHENTICATED, 120 EXPECT_EQ(protocol::ConnectionToHost::State::AUTHENTICATED,
121 connection_state_); 121 connection_state_);
122 EXPECT_EQ(protocol::OK, error_code_); 122 EXPECT_EQ(protocol::OK, error_code_);
(...skipping 12 matching lines...) Expand all
135 EXPECT_TRUE(is_connected_to_host_); 135 EXPECT_TRUE(is_connected_to_host_);
136 136
137 test_chromoting_client_->EndConnection(); 137 test_chromoting_client_->EndConnection();
138 EXPECT_EQ(protocol::ConnectionToHost::State::CLOSED, connection_state_); 138 EXPECT_EQ(protocol::ConnectionToHost::State::CLOSED, connection_state_);
139 EXPECT_EQ(protocol::OK, error_code_); 139 EXPECT_EQ(protocol::OK, error_code_);
140 EXPECT_FALSE(is_connected_to_host_); 140 EXPECT_FALSE(is_connected_to_host_);
141 } 141 }
142 142
143 TEST_F(TestChromotingClientTest, 143 TEST_F(TestChromotingClientTest,
144 StartConnectionThenFailWithAuthenticationError) { 144 StartConnectionThenFailWithAuthenticationError) {
145 test_chromoting_client_->StartConnection(connection_setup_info_); 145 test_chromoting_client_->StartConnection(false, connection_setup_info_);
146 EXPECT_EQ(protocol::ConnectionToHost::State::CONNECTING, connection_state_); 146 EXPECT_EQ(protocol::ConnectionToHost::State::CONNECTING, connection_state_);
147 EXPECT_EQ(protocol::OK, error_code_); 147 EXPECT_EQ(protocol::OK, error_code_);
148 EXPECT_FALSE(is_connected_to_host_); 148 EXPECT_FALSE(is_connected_to_host_);
149 149
150 fake_connection_to_host_->SignalStateChange(protocol::Session::FAILED, 150 fake_connection_to_host_->SignalStateChange(protocol::Session::FAILED,
151 protocol::AUTHENTICATION_FAILED); 151 protocol::AUTHENTICATION_FAILED);
152 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); 152 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_);
153 EXPECT_EQ(protocol::ErrorCode::AUTHENTICATION_FAILED, error_code_); 153 EXPECT_EQ(protocol::ErrorCode::AUTHENTICATION_FAILED, error_code_);
154 EXPECT_FALSE(is_connected_to_host_); 154 EXPECT_FALSE(is_connected_to_host_);
155 155
156 // Close the connection via the TestChromotingClient and verify the error 156 // Close the connection via the TestChromotingClient and verify the error
157 // state is persisted. 157 // state is persisted.
158 test_chromoting_client_->EndConnection(); 158 test_chromoting_client_->EndConnection();
159 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); 159 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_);
160 EXPECT_EQ(protocol::ErrorCode::AUTHENTICATION_FAILED, error_code_); 160 EXPECT_EQ(protocol::ErrorCode::AUTHENTICATION_FAILED, error_code_);
161 EXPECT_FALSE(is_connected_to_host_); 161 EXPECT_FALSE(is_connected_to_host_);
162 } 162 }
163 163
164 TEST_F(TestChromotingClientTest, StartConnectionThenFailWithUnknownError) { 164 TEST_F(TestChromotingClientTest, StartConnectionThenFailWithUnknownError) {
165 test_chromoting_client_->StartConnection(connection_setup_info_); 165 test_chromoting_client_->StartConnection(false, connection_setup_info_);
166 EXPECT_EQ(protocol::ConnectionToHost::State::CONNECTING, connection_state_); 166 EXPECT_EQ(protocol::ConnectionToHost::State::CONNECTING, connection_state_);
167 EXPECT_EQ(protocol::OK, error_code_); 167 EXPECT_EQ(protocol::OK, error_code_);
168 EXPECT_FALSE(is_connected_to_host_); 168 EXPECT_FALSE(is_connected_to_host_);
169 169
170 // Simulate an AUTHENTICATED message being sent from the Jingle session. 170 // Simulate an AUTHENTICATED message being sent from the Jingle session.
171 fake_connection_to_host_->SignalStateChange(protocol::Session::AUTHENTICATED, 171 fake_connection_to_host_->SignalStateChange(protocol::Session::AUTHENTICATED,
172 protocol::OK); 172 protocol::OK);
173 EXPECT_EQ(protocol::ConnectionToHost::State::AUTHENTICATED, 173 EXPECT_EQ(protocol::ConnectionToHost::State::AUTHENTICATED,
174 connection_state_); 174 connection_state_);
175 EXPECT_EQ(protocol::OK, error_code_); 175 EXPECT_EQ(protocol::OK, error_code_);
(...skipping 20 matching lines...) Expand all
196 // Close the connection via the TestChromotingClient and verify the error 196 // Close the connection via the TestChromotingClient and verify the error
197 // state is persisted. 197 // state is persisted.
198 test_chromoting_client_->EndConnection(); 198 test_chromoting_client_->EndConnection();
199 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_); 199 EXPECT_EQ(protocol::ConnectionToHost::State::FAILED, connection_state_);
200 EXPECT_EQ(protocol::ErrorCode::UNKNOWN_ERROR, error_code_); 200 EXPECT_EQ(protocol::ErrorCode::UNKNOWN_ERROR, error_code_);
201 EXPECT_FALSE(is_connected_to_host_); 201 EXPECT_FALSE(is_connected_to_host_);
202 } 202 }
203 203
204 } // namespace test 204 } // namespace test
205 } // namespace remoting 205 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/test_chromoting_client.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698