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

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

Issue 1507853003: Reland of Close the QUIC connection when non-crypto stream data is written at ENCRYPTION_NONE. Flag protected… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2526
Patch Set: Created 5 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 | « net/quic/quic_session_test.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 (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 6
7 #include "net/quic/crypto/quic_decrypter.h" 7 #include "net/quic/crypto/quic_decrypter.h"
8 #include "net/quic/crypto/quic_encrypter.h"
8 #include "net/quic/quic_client_session_base.h" 9 #include "net/quic/quic_client_session_base.h"
9 #include "net/quic/quic_server_id.h" 10 #include "net/quic/quic_server_id.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 12
12 using std::string; 13 using std::string;
13 14
14 namespace net { 15 namespace net {
15 16
16 MockCryptoClientStream::MockCryptoClientStream( 17 MockCryptoClientStream::MockCryptoClientStream(
17 const QuicServerId& server_id, 18 const QuicServerId& server_id,
(...skipping 15 matching lines...) Expand all
33 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); 34 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE);
34 } 35 }
35 36
36 void MockCryptoClientStream::CryptoConnect() { 37 void MockCryptoClientStream::CryptoConnect() {
37 switch (handshake_mode_) { 38 switch (handshake_mode_) {
38 case ZERO_RTT: { 39 case ZERO_RTT: {
39 encryption_established_ = true; 40 encryption_established_ = true;
40 handshake_confirmed_ = false; 41 handshake_confirmed_ = false;
41 session()->connection()->SetDecrypter(ENCRYPTION_INITIAL, 42 session()->connection()->SetDecrypter(ENCRYPTION_INITIAL,
42 QuicDecrypter::Create(kNULL)); 43 QuicDecrypter::Create(kNULL));
44 session()->connection()->SetEncrypter(ENCRYPTION_INITIAL,
45 QuicEncrypter::Create(kNULL));
46 session()->connection()->SetDefaultEncryptionLevel(ENCRYPTION_INITIAL);
43 session()->OnCryptoHandshakeEvent( 47 session()->OnCryptoHandshakeEvent(
44 QuicSession::ENCRYPTION_FIRST_ESTABLISHED); 48 QuicSession::ENCRYPTION_FIRST_ESTABLISHED);
45 break; 49 break;
46 } 50 }
47 51
48 case CONFIRM_HANDSHAKE: { 52 case CONFIRM_HANDSHAKE: {
49 encryption_established_ = true; 53 encryption_established_ = true;
50 handshake_confirmed_ = true; 54 handshake_confirmed_ = true;
51 crypto_negotiated_params_.key_exchange = kC255; 55 crypto_negotiated_params_.key_exchange = kC255;
52 crypto_negotiated_params_.aead = kAESG; 56 crypto_negotiated_params_.aead = kAESG;
53 if (proof_verify_details_) { 57 if (proof_verify_details_) {
54 client_session()->OnProofVerifyDetailsAvailable(*proof_verify_details_); 58 client_session()->OnProofVerifyDetailsAvailable(*proof_verify_details_);
55 } 59 }
56 SetConfigNegotiated(); 60 SetConfigNegotiated();
57 session()->connection()->SetDecrypter(ENCRYPTION_FORWARD_SECURE, 61 session()->connection()->SetDecrypter(ENCRYPTION_FORWARD_SECURE,
58 QuicDecrypter::Create(kNULL)); 62 QuicDecrypter::Create(kNULL));
63 session()->connection()->SetEncrypter(ENCRYPTION_FORWARD_SECURE,
64 QuicEncrypter::Create(kNULL));
65 session()->connection()->SetDefaultEncryptionLevel(
66 ENCRYPTION_FORWARD_SECURE);
59 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); 67 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
60 break; 68 break;
61 } 69 }
62 70
63 case COLD_START: { 71 case COLD_START: {
64 handshake_confirmed_ = false; 72 handshake_confirmed_ = false;
65 encryption_established_ = false; 73 encryption_established_ = false;
66 break; 74 break;
67 } 75 }
68 } 76 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ASSERT_EQ(QUIC_NO_ERROR, error); 110 ASSERT_EQ(QUIC_NO_ERROR, error);
103 ASSERT_TRUE(session()->config()->negotiated()); 111 ASSERT_TRUE(session()->config()->negotiated());
104 session()->OnConfigNegotiated(); 112 session()->OnConfigNegotiated();
105 } 113 }
106 114
107 QuicClientSessionBase* MockCryptoClientStream::client_session() { 115 QuicClientSessionBase* MockCryptoClientStream::client_session() {
108 return reinterpret_cast<QuicClientSessionBase*>(session()); 116 return reinterpret_cast<QuicClientSessionBase*>(session());
109 } 117 }
110 118
111 } // namespace net 119 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698