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

Side by Side Diff: net/quic/quic_crypto_server_stream_test.cc

Issue 1977153002: Rename various MockConnectionFoo classes to MockQuicConnectionFoo. No behavior change. This is cons… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@121576119
Patch Set: Created 4 years, 7 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/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_stream_test.cc » ('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) 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 "net/quic/quic_crypto_server_stream.h" 5 #include "net/quic/quic_crypto_server_stream.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 server_session_.reset(); 92 server_session_.reset();
93 client_session_.reset(); 93 client_session_.reset();
94 STLDeleteElements(&helpers_); 94 STLDeleteElements(&helpers_);
95 STLDeleteElements(&alarm_factories_); 95 STLDeleteElements(&alarm_factories_);
96 } 96 }
97 97
98 // Initializes the crypto server stream state for testing. May be 98 // Initializes the crypto server stream state for testing. May be
99 // called multiple times. 99 // called multiple times.
100 void InitializeServer() { 100 void InitializeServer() {
101 TestQuicSpdyServerSession* server_session = nullptr; 101 TestQuicSpdyServerSession* server_session = nullptr;
102 helpers_.push_back(new MockConnectionHelper); 102 helpers_.push_back(new MockQuicConnectionHelper);
103 alarm_factories_.push_back(new MockAlarmFactory); 103 alarm_factories_.push_back(new MockAlarmFactory);
104 CreateServerSessionForTest( 104 CreateServerSessionForTest(
105 server_id_, QuicTime::Delta::FromSeconds(100000), supported_versions_, 105 server_id_, QuicTime::Delta::FromSeconds(100000), supported_versions_,
106 helpers_.back(), alarm_factories_.back(), &server_crypto_config_, 106 helpers_.back(), alarm_factories_.back(), &server_crypto_config_,
107 &server_compressed_certs_cache_, &server_connection_, &server_session); 107 &server_compressed_certs_cache_, &server_connection_, &server_session);
108 CHECK(server_session); 108 CHECK(server_session);
109 server_session_.reset(server_session); 109 server_session_.reset(server_session);
110 CryptoTestUtils::FakeServerOptions options; 110 CryptoTestUtils::FakeServerOptions options;
111 options.token_binding_enabled = true; 111 options.token_binding_enabled = true;
112 CryptoTestUtils::SetupCryptoServerConfigForTest( 112 CryptoTestUtils::SetupCryptoServerConfigForTest(
113 server_connection_->clock(), server_connection_->random_generator(), 113 server_connection_->clock(), server_connection_->random_generator(),
114 server_session_->config(), &server_crypto_config_, options); 114 server_session_->config(), &server_crypto_config_, options);
115 } 115 }
116 116
117 QuicCryptoServerStream* server_stream() { 117 QuicCryptoServerStream* server_stream() {
118 return server_session_->GetCryptoStream(); 118 return server_session_->GetCryptoStream();
119 } 119 }
120 120
121 QuicCryptoClientStream* client_stream() { 121 QuicCryptoClientStream* client_stream() {
122 return client_session_->GetCryptoStream(); 122 return client_session_->GetCryptoStream();
123 } 123 }
124 124
125 // Initializes a fake client, and all its associated state, for 125 // Initializes a fake client, and all its associated state, for
126 // testing. May be called multiple times. 126 // testing. May be called multiple times.
127 void InitializeFakeClient(bool supports_stateless_rejects) { 127 void InitializeFakeClient(bool supports_stateless_rejects) {
128 TestQuicSpdyClientSession* client_session = nullptr; 128 TestQuicSpdyClientSession* client_session = nullptr;
129 helpers_.push_back(new MockConnectionHelper); 129 helpers_.push_back(new MockQuicConnectionHelper);
130 alarm_factories_.push_back(new MockAlarmFactory); 130 alarm_factories_.push_back(new MockAlarmFactory);
131 CreateClientSessionForTest( 131 CreateClientSessionForTest(
132 server_id_, supports_stateless_rejects, 132 server_id_, supports_stateless_rejects,
133 QuicTime::Delta::FromSeconds(100000), supported_versions_, 133 QuicTime::Delta::FromSeconds(100000), supported_versions_,
134 134
135 helpers_.back(), alarm_factories_.back(), &client_crypto_config_, 135 helpers_.back(), alarm_factories_.back(), &client_crypto_config_,
136 &client_connection_, &client_session); 136 &client_connection_, &client_session);
137 CHECK(client_session); 137 CHECK(client_session);
138 client_session_.reset(client_session); 138 client_session_.reset(client_session);
139 } 139 }
(...skipping 24 matching lines...) Expand all
164 CHECK(server_connection_); 164 CHECK(server_connection_);
165 CHECK(client_session_ != nullptr); 165 CHECK(client_session_ != nullptr);
166 166
167 EXPECT_CALL(*client_session_, OnProofValid(_)).Times(testing::AnyNumber()); 167 EXPECT_CALL(*client_session_, OnProofValid(_)).Times(testing::AnyNumber());
168 client_stream()->CryptoConnect(); 168 client_stream()->CryptoConnect();
169 CryptoTestUtils::AdvanceHandshake(client_connection_, client_stream(), 0, 169 CryptoTestUtils::AdvanceHandshake(client_connection_, client_stream(), 0,
170 server_connection_, server_stream(), 0); 170 server_connection_, server_stream(), 0);
171 } 171 }
172 172
173 protected: 173 protected:
174 // Every connection gets its own MockConnectionHelper and MockAlarmFactory, 174 // Every connection gets its own MockQuicConnectionHelper and
175 // MockAlarmFactory,
175 // tracked separately from 176 // tracked separately from
176 // the server and client state so their lifetimes persist through the whole 177 // the server and client state so their lifetimes persist through the whole
177 // test. 178 // test.
178 std::vector<MockConnectionHelper*> helpers_; 179 std::vector<MockQuicConnectionHelper*> helpers_;
179 std::vector<MockAlarmFactory*> alarm_factories_; 180 std::vector<MockAlarmFactory*> alarm_factories_;
180 181
181 // Server state 182 // Server state
182 PacketSavingConnection* server_connection_; 183 PacketSavingConnection* server_connection_;
183 std::unique_ptr<TestQuicSpdyServerSession> server_session_; 184 std::unique_ptr<TestQuicSpdyServerSession> server_session_;
184 QuicCryptoServerConfig server_crypto_config_; 185 QuicCryptoServerConfig server_crypto_config_;
185 QuicCompressedCertsCache server_compressed_certs_cache_; 186 QuicCompressedCertsCache server_compressed_certs_cache_;
186 QuicServerId server_id_; 187 QuicServerId server_id_;
187 188
188 // Client state 189 // Client state
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 QUIC_NO_ERROR, "", ConnectionCloseBehavior::SILENT_CLOSE); 536 QUIC_NO_ERROR, "", ConnectionCloseBehavior::SILENT_CLOSE);
536 537
537 // The outstanding nonce verification RPC now completes. 538 // The outstanding nonce verification RPC now completes.
538 strike_register_client_->RunPendingVerifications(); 539 strike_register_client_->RunPendingVerifications();
539 } 540 }
540 541
541 } // namespace 542 } // namespace
542 543
543 } // namespace test 544 } // namespace test
544 } // namespace net 545 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_crypto_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698