OLD | NEW |
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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 : public ::testing::TestWithParam<QuicVersion> { | 160 : public ::testing::TestWithParam<QuicVersion> { |
161 protected: | 161 protected: |
162 QuicSimpleServerSessionTest() | 162 QuicSimpleServerSessionTest() |
163 : crypto_config_(QuicCryptoServerConfig::TESTING, | 163 : crypto_config_(QuicCryptoServerConfig::TESTING, |
164 QuicRandom::GetInstance(), | 164 QuicRandom::GetInstance(), |
165 CryptoTestUtils::ProofSourceForTesting()), | 165 CryptoTestUtils::ProofSourceForTesting()), |
166 compressed_certs_cache_( | 166 compressed_certs_cache_( |
167 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { | 167 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize) { |
168 FLAGS_quic_always_log_bugs_for_tests = true; | 168 FLAGS_quic_always_log_bugs_for_tests = true; |
169 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 169 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
| 170 config_.SetMaxIncomingDynamicStreamsToSend(kMaxStreamsForTest); |
| 171 QuicConfigPeer::SetReceivedMaxIncomingDynamicStreams(&config_, |
| 172 kMaxStreamsForTest); |
170 config_.SetInitialStreamFlowControlWindowToSend( | 173 config_.SetInitialStreamFlowControlWindowToSend( |
171 kInitialStreamFlowControlWindowForTest); | 174 kInitialStreamFlowControlWindowForTest); |
172 config_.SetInitialSessionFlowControlWindowToSend( | 175 config_.SetInitialSessionFlowControlWindowToSend( |
173 kInitialSessionFlowControlWindowForTest); | 176 kInitialSessionFlowControlWindowForTest); |
174 | 177 |
175 connection_ = new StrictMock<MockQuicConnectionWithSendStreamData>( | 178 connection_ = new StrictMock<MockQuicConnectionWithSendStreamData>( |
176 &helper_, &alarm_factory_, Perspective::IS_SERVER, | 179 &helper_, &alarm_factory_, Perspective::IS_SERVER, |
177 SupportedVersions(GetParam())); | 180 SupportedVersions(GetParam())); |
178 session_.reset(new QuicSimpleServerSession( | 181 session_.reset(new QuicSimpleServerSession( |
179 config_, connection_, &owner_, &session_helper_, &crypto_config_, | 182 config_, connection_, &owner_, &session_helper_, &crypto_config_, |
180 &compressed_certs_cache_)); | 183 &compressed_certs_cache_)); |
181 MockClock clock; | 184 MockClock clock; |
182 handshake_message_.reset(crypto_config_.AddDefaultConfig( | 185 handshake_message_.reset(crypto_config_.AddDefaultConfig( |
183 QuicRandom::GetInstance(), &clock, | 186 QuicRandom::GetInstance(), &clock, |
184 QuicCryptoServerConfig::ConfigOptions())); | 187 QuicCryptoServerConfig::ConfigOptions())); |
185 session_->Initialize(); | 188 session_->Initialize(); |
186 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 189 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
187 headers_stream_ = new MockQuicHeadersStream(session_.get()); | 190 headers_stream_ = new MockQuicHeadersStream(session_.get()); |
188 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); | 191 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); |
189 // TODO(jri): Remove this line once tests pass. | 192 // TODO(jri): Remove this line once tests pass. |
190 FLAGS_quic_cede_correctly = false; | 193 FLAGS_quic_cede_correctly = false; |
| 194 |
| 195 session_->OnConfigNegotiated(); |
191 } | 196 } |
192 | 197 |
193 StrictMock<MockQuicServerSessionVisitor> owner_; | 198 StrictMock<MockQuicServerSessionVisitor> owner_; |
194 StrictMock<MockQuicServerSessionHelper> session_helper_; | 199 StrictMock<MockQuicServerSessionHelper> session_helper_; |
195 MockQuicConnectionHelper helper_; | 200 MockQuicConnectionHelper helper_; |
196 MockAlarmFactory alarm_factory_; | 201 MockAlarmFactory alarm_factory_; |
197 StrictMock<MockQuicConnectionWithSendStreamData>* connection_; | 202 StrictMock<MockQuicConnectionWithSendStreamData>* connection_; |
198 QuicConfig config_; | 203 QuicConfig config_; |
199 QuicCryptoServerConfig crypto_config_; | 204 QuicCryptoServerConfig crypto_config_; |
200 QuicCompressedCertsCache compressed_certs_cache_; | 205 QuicCompressedCertsCache compressed_certs_cache_; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); | 579 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); |
575 | 580 |
576 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); | 581 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); |
577 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); | 582 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); |
578 visitor_->OnRstStream(rst); | 583 visitor_->OnRstStream(rst); |
579 } | 584 } |
580 | 585 |
581 } // namespace | 586 } // namespace |
582 } // namespace test | 587 } // namespace test |
583 } // namespace net | 588 } // namespace net |
OLD | NEW |