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

Side by Side Diff: remoting/protocol/jingle_session_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, 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 "remoting/protocol/jingle_session.h" 5 #include "remoting/protocol/jingle_session.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 .WillOnce(DoAll( 189 .WillOnce(DoAll(
190 WithArg<0>(Invoke(this, &JingleSessionTest::SetHostSession)), 190 WithArg<0>(Invoke(this, &JingleSessionTest::SetHostSession)),
191 SetArgumentPointee<1>(protocol::SessionManager::ACCEPT))); 191 SetArgumentPointee<1>(protocol::SessionManager::ACCEPT)));
192 192
193 { 193 {
194 InSequence dummy; 194 InSequence dummy;
195 195
196 EXPECT_CALL(host_session_event_handler_, 196 EXPECT_CALL(host_session_event_handler_,
197 OnSessionStateChange(Session::CONNECTED)) 197 OnSessionStateChange(Session::CONNECTED))
198 .Times(AtMost(1)); 198 .Times(AtMost(1));
199 EXPECT_CALL(host_session_event_handler_,
200 OnSessionStateChange(Session::AUTHENTICATING))
201 .Times(AtMost(1));
199 if (expect_fail) { 202 if (expect_fail) {
200 EXPECT_CALL(host_session_event_handler_, 203 EXPECT_CALL(host_session_event_handler_,
201 OnSessionStateChange(Session::FAILED)) 204 OnSessionStateChange(Session::FAILED))
202 .Times(1); 205 .Times(1);
203 } else { 206 } else {
204 EXPECT_CALL(host_session_event_handler_, 207 EXPECT_CALL(host_session_event_handler_,
205 OnSessionStateChange(Session::AUTHENTICATED)) 208 OnSessionStateChange(Session::AUTHENTICATED))
206 .Times(1); 209 .Times(1);
207 // Expect that the connection will be closed eventually. 210 // Expect that the connection will be closed eventually.
208 EXPECT_CALL(host_session_event_handler_, 211 EXPECT_CALL(host_session_event_handler_,
209 OnSessionStateChange(Session::CLOSED)) 212 OnSessionStateChange(Session::CLOSED))
210 .Times(AtMost(1)); 213 .Times(AtMost(1));
211 } 214 }
212 } 215 }
213 216
214 { 217 {
215 InSequence dummy; 218 InSequence dummy;
216 219
217 EXPECT_CALL(client_session_event_handler_, 220 EXPECT_CALL(client_session_event_handler_,
218 OnSessionStateChange(Session::CONNECTED)) 221 OnSessionStateChange(Session::CONNECTED))
219 .Times(AtMost(1)); 222 .Times(AtMost(1));
223 EXPECT_CALL(client_session_event_handler_,
224 OnSessionStateChange(Session::AUTHENTICATING))
225 .Times(AtMost(1));
220 if (expect_fail) { 226 if (expect_fail) {
221 EXPECT_CALL(client_session_event_handler_, 227 EXPECT_CALL(client_session_event_handler_,
222 OnSessionStateChange(Session::FAILED)) 228 OnSessionStateChange(Session::FAILED))
223 .Times(1); 229 .Times(1);
224 } else { 230 } else {
225 EXPECT_CALL(client_session_event_handler_, 231 EXPECT_CALL(client_session_event_handler_,
226 OnSessionStateChange(Session::AUTHENTICATED)) 232 OnSessionStateChange(Session::AUTHENTICATED))
227 .Times(1); 233 .Times(1);
228 // Expect that the connection will be closed eventually. 234 // Expect that the connection will be closed eventually.
229 EXPECT_CALL(client_session_event_handler_, 235 EXPECT_CALL(client_session_event_handler_,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 .Times(AtMost(1)); 448 .Times(AtMost(1));
443 ExpectRouteChange(kChannelName); 449 ExpectRouteChange(kChannelName);
444 450
445 message_loop_->Run(); 451 message_loop_->Run();
446 452
447 EXPECT_TRUE(!host_socket_.get()); 453 EXPECT_TRUE(!host_socket_.get());
448 } 454 }
449 455
450 } // namespace protocol 456 } // namespace protocol
451 } // namespace remoting 457 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698