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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « net/quic/test_tools/mock_crypto_client_stream.h ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | 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/quic_client_session_base.h" 8 #include "net/quic/quic_client_session_base.h"
9 #include "net/quic/quic_server_id.h" 9 #include "net/quic/quic_server_id.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 MockCryptoClientStream::~MockCryptoClientStream() { 29 MockCryptoClientStream::~MockCryptoClientStream() {
30 } 30 }
31 31
32 void MockCryptoClientStream::OnHandshakeMessage( 32 void MockCryptoClientStream::OnHandshakeMessage(
33 const CryptoHandshakeMessage& message) { 33 const CryptoHandshakeMessage& message) {
34 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE); 34 CloseConnection(QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE);
35 } 35 }
36 36
37 bool MockCryptoClientStream::CryptoConnect() { 37 void MockCryptoClientStream::CryptoConnect() {
38 switch (handshake_mode_) { 38 switch (handshake_mode_) {
39 case ZERO_RTT: { 39 case ZERO_RTT: {
40 encryption_established_ = true; 40 encryption_established_ = true;
41 handshake_confirmed_ = false; 41 handshake_confirmed_ = false;
42 session()->connection()->SetDecrypter(QuicDecrypter::Create(kNULL), 42 session()->connection()->SetDecrypter(QuicDecrypter::Create(kNULL),
43 ENCRYPTION_INITIAL); 43 ENCRYPTION_INITIAL);
44 session()->OnCryptoHandshakeEvent( 44 session()->OnCryptoHandshakeEvent(
45 QuicSession::ENCRYPTION_FIRST_ESTABLISHED); 45 QuicSession::ENCRYPTION_FIRST_ESTABLISHED);
46 break; 46 break;
47 } 47 }
(...skipping 12 matching lines...) Expand all
60 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); 60 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
61 break; 61 break;
62 } 62 }
63 63
64 case COLD_START: { 64 case COLD_START: {
65 handshake_confirmed_ = false; 65 handshake_confirmed_ = false;
66 encryption_established_ = false; 66 encryption_established_ = false;
67 break; 67 break;
68 } 68 }
69 } 69 }
70 return true;
71 } 70 }
72 71
73 void MockCryptoClientStream::SendOnCryptoHandshakeEvent( 72 void MockCryptoClientStream::SendOnCryptoHandshakeEvent(
74 QuicSession::CryptoHandshakeEvent event) { 73 QuicSession::CryptoHandshakeEvent event) {
75 encryption_established_ = true; 74 encryption_established_ = true;
76 if (event == QuicSession::HANDSHAKE_CONFIRMED) { 75 if (event == QuicSession::HANDSHAKE_CONFIRMED) {
77 handshake_confirmed_ = true; 76 handshake_confirmed_ = true;
78 SetConfigNegotiated(); 77 SetConfigNegotiated();
79 } 78 }
80 session()->OnCryptoHandshakeEvent(event); 79 session()->OnCryptoHandshakeEvent(event);
(...skipping 22 matching lines...) Expand all
103 ASSERT_EQ(QUIC_NO_ERROR, error); 102 ASSERT_EQ(QUIC_NO_ERROR, error);
104 ASSERT_TRUE(session()->config()->negotiated()); 103 ASSERT_TRUE(session()->config()->negotiated());
105 session()->OnConfigNegotiated(); 104 session()->OnConfigNegotiated();
106 } 105 }
107 106
108 QuicClientSessionBase* MockCryptoClientStream::client_session() { 107 QuicClientSessionBase* MockCryptoClientStream::client_session() {
109 return reinterpret_cast<QuicClientSessionBase*>(session()); 108 return reinterpret_cast<QuicClientSessionBase*>(session());
110 } 109 }
111 110
112 } // namespace net 111 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/mock_crypto_client_stream.h ('k') | net/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698