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

Side by Side Diff: net/tools/quic/quic_simple_server_session_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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/tools/quic/quic_simple_server_session.h" 5 #include "net/tools/quic/quic_simple_server_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 namespace { 147 namespace {
148 148
149 const size_t kMaxStreamsForTest = 10; 149 const size_t kMaxStreamsForTest = 10;
150 150
151 class QuicSimpleServerSessionTest 151 class QuicSimpleServerSessionTest
152 : public ::testing::TestWithParam<QuicVersion> { 152 : public ::testing::TestWithParam<QuicVersion> {
153 protected: 153 protected:
154 QuicSimpleServerSessionTest() 154 QuicSimpleServerSessionTest()
155 : crypto_config_(QuicCryptoServerConfig::TESTING, 155 : crypto_config_(QuicCryptoServerConfig::TESTING,
156 QuicRandom::GetInstance(), 156 QuicRandom::GetInstance(),
157 CryptoTestUtils::ProofSourceForTesting()) { 157 CryptoTestUtils::ProofSourceForTesting()),
158 compressed_certs_cache_(
159 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) {
158 FLAGS_quic_always_log_bugs_for_tests = true; 160 FLAGS_quic_always_log_bugs_for_tests = true;
159 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); 161 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest);
160 config_.SetInitialStreamFlowControlWindowToSend( 162 config_.SetInitialStreamFlowControlWindowToSend(
161 kInitialStreamFlowControlWindowForTest); 163 kInitialStreamFlowControlWindowForTest);
162 config_.SetInitialSessionFlowControlWindowToSend( 164 config_.SetInitialSessionFlowControlWindowToSend(
163 kInitialSessionFlowControlWindowForTest); 165 kInitialSessionFlowControlWindowForTest);
164 166
165 connection_ = new StrictMock<MockConnectionWithSendStreamData>( 167 connection_ = new StrictMock<MockConnectionWithSendStreamData>(
166 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); 168 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam()));
167 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_, 169 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_,
168 &crypto_config_)); 170 &crypto_config_,
171 &compressed_certs_cache_));
169 MockClock clock; 172 MockClock clock;
170 handshake_message_.reset(crypto_config_.AddDefaultConfig( 173 handshake_message_.reset(crypto_config_.AddDefaultConfig(
171 QuicRandom::GetInstance(), &clock, 174 QuicRandom::GetInstance(), &clock,
172 QuicCryptoServerConfig::ConfigOptions())); 175 QuicCryptoServerConfig::ConfigOptions()));
173 session_->Initialize(); 176 session_->Initialize();
174 visitor_ = QuicConnectionPeer::GetVisitor(connection_); 177 visitor_ = QuicConnectionPeer::GetVisitor(connection_);
175 headers_stream_ = new MockQuicHeadersStream(session_.get()); 178 headers_stream_ = new MockQuicHeadersStream(session_.get());
176 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); 179 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_);
177 // TODO(jri): Remove this line once tests pass. 180 // TODO(jri): Remove this line once tests pass.
178 FLAGS_quic_cede_correctly = false; 181 FLAGS_quic_cede_correctly = false;
179 } 182 }
180 183
181 StrictMock<MockQuicServerSessionVisitor> owner_; 184 StrictMock<MockQuicServerSessionVisitor> owner_;
182 MockConnectionHelper helper_; 185 MockConnectionHelper helper_;
183 StrictMock<MockConnectionWithSendStreamData>* connection_; 186 StrictMock<MockConnectionWithSendStreamData>* connection_;
184 QuicConfig config_; 187 QuicConfig config_;
185 QuicCryptoServerConfig crypto_config_; 188 QuicCryptoServerConfig crypto_config_;
189 QuicCompressedCertsCache compressed_certs_cache_;
186 scoped_ptr<QuicSimpleServerSession> session_; 190 scoped_ptr<QuicSimpleServerSession> session_;
187 scoped_ptr<CryptoHandshakeMessage> handshake_message_; 191 scoped_ptr<CryptoHandshakeMessage> handshake_message_;
188 QuicConnectionVisitorInterface* visitor_; 192 QuicConnectionVisitorInterface* visitor_;
189 MockQuicHeadersStream* headers_stream_; 193 MockQuicHeadersStream* headers_stream_;
190 }; 194 };
191 195
192 INSTANTIATE_TEST_CASE_P(Tests, 196 INSTANTIATE_TEST_CASE_P(Tests,
193 QuicSimpleServerSessionTest, 197 QuicSimpleServerSessionTest,
194 ::testing::ValuesIn(QuicSupportedVersions())); 198 ::testing::ValuesIn(QuicSupportedVersions()));
195 199
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 &config_, kStreamFlowControlWindowSize); 396 &config_, kStreamFlowControlWindowSize);
393 // Reset connection level flow control window to be 1.5 MB which is large 397 // Reset connection level flow control window to be 1.5 MB which is large
394 // enough that it won't block any stream to write before stream level flow 398 // enough that it won't block any stream to write before stream level flow
395 // control blocks it. 399 // control blocks it.
396 QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow( 400 QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow(
397 &config_, kInitialSessionFlowControlWindowForTest); 401 &config_, kInitialSessionFlowControlWindowForTest);
398 402
399 connection_ = new StrictMock<MockConnectionWithSendStreamData>( 403 connection_ = new StrictMock<MockConnectionWithSendStreamData>(
400 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); 404 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam()));
401 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_, 405 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_,
402 &crypto_config_)); 406 &crypto_config_,
407 &compressed_certs_cache_));
403 session_->Initialize(); 408 session_->Initialize();
404 // Needed to make new session flow control window work. 409 // Needed to make new session flow control window work.
405 session_->OnConfigNegotiated(); 410 session_->OnConfigNegotiated();
406 411
407 visitor_ = QuicConnectionPeer::GetVisitor(connection_); 412 visitor_ = QuicConnectionPeer::GetVisitor(connection_);
408 headers_stream_ = new MockQuicHeadersStream(session_.get()); 413 headers_stream_ = new MockQuicHeadersStream(session_.get());
409 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); 414 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_);
410 415
411 // Assume encryption already established. 416 // Assume encryption already established.
412 MockQuicCryptoServerStream* crypto_stream = 417 MockQuicCryptoServerStream* crypto_stream =
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); 563 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false)));
559 564
560 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); 565 EXPECT_CALL(*connection_, SendBlocked(stream_to_open));
561 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); 566 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0);
562 visitor_->OnRstStream(rst); 567 visitor_->OnRstStream(rst);
563 } 568 }
564 569
565 } // namespace 570 } // namespace
566 } // namespace test 571 } // namespace test
567 } // namespace net 572 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_server_session.cc ('k') | net/tools/quic/quic_simple_server_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698