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 | 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); | 389 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, kMaxStreamsForTest); |
390 | 390 |
391 // Reset stream level flow control window to be 32KB. | 391 // Reset stream level flow control window to be 32KB. |
392 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( | 392 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( |
393 &config_, kStreamFlowControlWindowSize); | 393 &config_, kStreamFlowControlWindowSize); |
394 // Reset connection level flow control window to be 1.5 MB which is large | 394 // Reset connection level flow control window to be 1.5 MB which is large |
395 // enough that it won't block any stream to write before stream level flow | 395 // enough that it won't block any stream to write before stream level flow |
396 // control blocks it. | 396 // control blocks it. |
397 QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow( | 397 QuicConfigPeer::SetReceivedInitialSessionFlowControlWindow( |
398 &config_, kInitialSessionFlowControlWindowForTest); | 398 &config_, kInitialSessionFlowControlWindowForTest); |
| 399 // Enable server push. |
| 400 QuicTagVector copt; |
| 401 copt.push_back(kSPSH); |
| 402 QuicConfigPeer::SetReceivedConnectionOptions(&config_, copt); |
399 | 403 |
400 connection_ = new StrictMock<MockConnectionWithSendStreamData>( | 404 connection_ = new StrictMock<MockConnectionWithSendStreamData>( |
401 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); | 405 &helper_, Perspective::IS_SERVER, SupportedVersions(GetParam())); |
402 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_, | 406 session_.reset(new QuicSimpleServerSession(config_, connection_, &owner_, |
403 &crypto_config_, | 407 &crypto_config_, |
404 &compressed_certs_cache_)); | 408 &compressed_certs_cache_)); |
405 session_->Initialize(); | 409 session_->Initialize(); |
406 // Needed to make new session flow control window work. | 410 // Needed to make new session flow control window and server push work. |
407 session_->OnConfigNegotiated(); | 411 session_->OnConfigNegotiated(); |
408 | 412 |
409 visitor_ = QuicConnectionPeer::GetVisitor(connection_); | 413 visitor_ = QuicConnectionPeer::GetVisitor(connection_); |
410 headers_stream_ = new MockQuicHeadersStream(session_.get()); | 414 headers_stream_ = new MockQuicHeadersStream(session_.get()); |
411 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); | 415 QuicSpdySessionPeer::SetHeadersStream(session_.get(), headers_stream_); |
412 | 416 |
413 // Assume encryption already established. | 417 // Assume encryption already established. |
414 MockQuicCryptoServerStream* crypto_stream = new MockQuicCryptoServerStream( | 418 MockQuicCryptoServerStream* crypto_stream = new MockQuicCryptoServerStream( |
415 &crypto_config_, &compressed_certs_cache_, session_.get()); | 419 &crypto_config_, &compressed_certs_cache_, session_.get()); |
416 crypto_stream->set_encryption_established(true); | 420 crypto_stream->set_encryption_established(true); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); | 564 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); |
561 | 565 |
562 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); | 566 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); |
563 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); | 567 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); |
564 visitor_->OnRstStream(rst); | 568 visitor_->OnRstStream(rst); |
565 } | 569 } |
566 | 570 |
567 } // namespace | 571 } // namespace |
568 } // namespace test | 572 } // namespace test |
569 } // namespace net | 573 } // namespace net |
OLD | NEW |