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

Side by Side Diff: net/quic/test_tools/mock_crypto_client_stream.cc

Issue 23279011: Require handshake confirmation until a QUIC connection is created succesfully when using a new netw… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Created 7 years, 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "net/quic/test_tools/mock_crypto_client_stream.h" 5 #include "net/quic/test_tools/mock_crypto_client_stream.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace net { 8 namespace net {
9 9
10 MockCryptoClientStream::MockCryptoClientStream( 10 MockCryptoClientStream::MockCryptoClientStream(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 case COLD_START: { 45 case COLD_START: {
46 handshake_confirmed_ = false; 46 handshake_confirmed_ = false;
47 encryption_established_ = false; 47 encryption_established_ = false;
48 break; 48 break;
49 } 49 }
50 } 50 }
51 return true; 51 return true;
52 } 52 }
53 53
54 void MockCryptoClientStream::SendOnCryptoHandshakeEvent(
55 QuicSession::CryptoHandshakeEvent event) {
56 encryption_established_ = true;
wtc 2013/08/21 01:09:32 Nit: it seems that we only need to set encryption_
57 if (event == QuicSession::HANDSHAKE_CONFIRMED) {
58 handshake_confirmed_ = true;
59 SetConfigNegotiated();
60 }
61 session()->OnCryptoHandshakeEvent(event);
62 }
63
54 void MockCryptoClientStream::SetConfigNegotiated() { 64 void MockCryptoClientStream::SetConfigNegotiated() {
55 ASSERT_FALSE(session()->config()->negotiated()); 65 ASSERT_FALSE(session()->config()->negotiated());
56 QuicTagVector cgst; 66 QuicTagVector cgst;
57 cgst.push_back(kINAR); 67 cgst.push_back(kINAR);
58 cgst.push_back(kQBIC); 68 cgst.push_back(kQBIC);
59 session()->config()->set_congestion_control(cgst, kQBIC); 69 session()->config()->set_congestion_control(cgst, kQBIC);
60 session()->config()->set_idle_connection_state_lifetime( 70 session()->config()->set_idle_connection_state_lifetime(
61 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), 71 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs),
62 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); 72 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs));
63 session()->config()->set_max_streams_per_connection( 73 session()->config()->set_max_streams_per_connection(
64 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); 74 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection);
65 75
66 CryptoHandshakeMessage msg; 76 CryptoHandshakeMessage msg;
67 session()->config()->ToHandshakeMessage(&msg); 77 session()->config()->ToHandshakeMessage(&msg);
68 string error_details; 78 string error_details;
69 const QuicErrorCode error = 79 const QuicErrorCode error =
70 session()->config()->ProcessClientHello(msg, &error_details); 80 session()->config()->ProcessClientHello(msg, &error_details);
71 ASSERT_EQ(QUIC_NO_ERROR, error); 81 ASSERT_EQ(QUIC_NO_ERROR, error);
72 ASSERT_TRUE(session()->config()->negotiated()); 82 ASSERT_TRUE(session()->config()->negotiated());
73 } 83 }
74 84
75 } // namespace net 85 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698