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

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

Issue 1783783003: Add a QuicCompressedCertsCache instance to QuicDispatcher, plumbing to QuicServerSessionBase but no… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@116273065
Patch Set: Created 4 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
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/test_tools/crypto_test_utils.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 <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 const char kServerHostname[] = "test.example.com"; 64 const char kServerHostname[] = "test.example.com";
65 const uint16_t kServerPort = 443; 65 const uint16_t kServerPort = 443;
66 66
67 class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> { 67 class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> {
68 public: 68 public:
69 QuicCryptoServerStreamTest() 69 QuicCryptoServerStreamTest()
70 : server_crypto_config_(QuicCryptoServerConfig::TESTING, 70 : server_crypto_config_(QuicCryptoServerConfig::TESTING,
71 QuicRandom::GetInstance(), 71 QuicRandom::GetInstance(),
72 CryptoTestUtils::ProofSourceForTesting()), 72 CryptoTestUtils::ProofSourceForTesting()),
73 server_compressed_certs_cache_(
74 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
73 server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), 75 server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED),
74 client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { 76 client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) {
75 FLAGS_enable_quic_stateless_reject_support = false; 77 FLAGS_enable_quic_stateless_reject_support = false;
76 server_crypto_config_.set_strike_register_no_startup_period(); 78 server_crypto_config_.set_strike_register_no_startup_period();
77 } 79 }
78 80
79 void Initialize() { 81 void Initialize() {
80 InitializeServer(); 82 InitializeServer();
81 83
82 if (AsyncStrikeRegisterVerification()) { 84 if (AsyncStrikeRegisterVerification()) {
(...skipping 17 matching lines...) Expand all
100 server_session_.reset(); 102 server_session_.reset();
101 client_session_.reset(); 103 client_session_.reset();
102 STLDeleteElements(&helpers_); 104 STLDeleteElements(&helpers_);
103 } 105 }
104 106
105 // Initializes the crypto server stream state for testing. May be 107 // Initializes the crypto server stream state for testing. May be
106 // called multiple times. 108 // called multiple times.
107 void InitializeServer() { 109 void InitializeServer() {
108 TestQuicSpdyServerSession* server_session = nullptr; 110 TestQuicSpdyServerSession* server_session = nullptr;
109 helpers_.push_back(new MockConnectionHelper); 111 helpers_.push_back(new MockConnectionHelper);
110 112 CreateServerSessionForTest(
111 CreateServerSessionForTest(server_id_, QuicTime::Delta::FromSeconds(100000), 113 server_id_, QuicTime::Delta::FromSeconds(100000), supported_versions_,
112 supported_versions_, helpers_.back(), 114 helpers_.back(), &server_crypto_config_,
113 &server_crypto_config_, &server_connection_, 115 &server_compressed_certs_cache_, &server_connection_, &server_session);
114 &server_session);
115 CHECK(server_session); 116 CHECK(server_session);
116 server_session_.reset(server_session); 117 server_session_.reset(server_session);
117 CryptoTestUtils::FakeServerOptions options; 118 CryptoTestUtils::FakeServerOptions options;
118 options.token_binding_enabled = true; 119 options.token_binding_enabled = true;
119 CryptoTestUtils::SetupCryptoServerConfigForTest( 120 CryptoTestUtils::SetupCryptoServerConfigForTest(
120 server_connection_->clock(), server_connection_->random_generator(), 121 server_connection_->clock(), server_connection_->random_generator(),
121 server_session_->config(), &server_crypto_config_, options); 122 server_session_->config(), &server_crypto_config_, options);
122 } 123 }
123 124
124 QuicCryptoServerStream* server_stream() { 125 QuicCryptoServerStream* server_stream() {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 protected: 180 protected:
180 // Every connection gets its own MockConnectionHelper, tracked separately 181 // Every connection gets its own MockConnectionHelper, tracked separately
181 // from the server and client state so their lifetimes persist through the 182 // from the server and client state so their lifetimes persist through the
182 // whole test. 183 // whole test.
183 std::vector<MockConnectionHelper*> helpers_; 184 std::vector<MockConnectionHelper*> helpers_;
184 185
185 // Server state 186 // Server state
186 PacketSavingConnection* server_connection_; 187 PacketSavingConnection* server_connection_;
187 scoped_ptr<TestQuicSpdyServerSession> server_session_; 188 scoped_ptr<TestQuicSpdyServerSession> server_session_;
188 QuicCryptoServerConfig server_crypto_config_; 189 QuicCryptoServerConfig server_crypto_config_;
190 QuicCompressedCertsCache server_compressed_certs_cache_;
189 QuicServerId server_id_; 191 QuicServerId server_id_;
190 192
191 // Client state 193 // Client state
192 PacketSavingConnection* client_connection_; 194 PacketSavingConnection* client_connection_;
193 QuicCryptoClientConfig client_crypto_config_; 195 QuicCryptoClientConfig client_crypto_config_;
194 scoped_ptr<TestQuicSpdyClientSession> client_session_; 196 scoped_ptr<TestQuicSpdyClientSession> client_session_;
195 197
196 CryptoHandshakeMessage message_; 198 CryptoHandshakeMessage message_;
197 scoped_ptr<QuicData> message_data_; 199 scoped_ptr<QuicData> message_data_;
198 CryptoTestUtils::FakeClientOptions client_options_; 200 CryptoTestUtils::FakeClientOptions client_options_;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 QUIC_NO_ERROR, ConnectionCloseSource::FROM_PEER); 520 QUIC_NO_ERROR, ConnectionCloseSource::FROM_PEER);
519 521
520 // The outstanding nonce verification RPC now completes. 522 // The outstanding nonce verification RPC now completes.
521 strike_register_client_->RunPendingVerifications(); 523 strike_register_client_->RunPendingVerifications();
522 } 524 }
523 525
524 } // namespace 526 } // namespace
525 527
526 } // namespace test 528 } // namespace test
527 } // namespace net 529 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/test_tools/crypto_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698