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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 QuicCryptoServerConfig crypto_config_; | 219 QuicCryptoServerConfig crypto_config_; |
220 QuicCompressedCertsCache compressed_certs_cache_; | 220 QuicCompressedCertsCache compressed_certs_cache_; |
221 std::unique_ptr<QuicSimpleServerSession> session_; | 221 std::unique_ptr<QuicSimpleServerSession> session_; |
222 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; | 222 std::unique_ptr<CryptoHandshakeMessage> handshake_message_; |
223 QuicConnectionVisitorInterface* visitor_; | 223 QuicConnectionVisitorInterface* visitor_; |
224 MockQuicHeadersStream* headers_stream_; | 224 MockQuicHeadersStream* headers_stream_; |
225 }; | 225 }; |
226 | 226 |
227 INSTANTIATE_TEST_CASE_P(Tests, | 227 INSTANTIATE_TEST_CASE_P(Tests, |
228 QuicSimpleServerSessionTest, | 228 QuicSimpleServerSessionTest, |
229 ::testing::ValuesIn(QuicSupportedVersions())); | 229 ::testing::ValuesIn(AllSupportedVersions())); |
230 | 230 |
231 TEST_P(QuicSimpleServerSessionTest, CloseStreamDueToReset) { | 231 TEST_P(QuicSimpleServerSessionTest, CloseStreamDueToReset) { |
232 // Open a stream, then reset it. | 232 // Open a stream, then reset it. |
233 // Send two bytes of payload to open it. | 233 // Send two bytes of payload to open it. |
234 QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT")); | 234 QuicStreamFrame data1(kClientDataStreamId1, false, 0, StringPiece("HT")); |
235 session_->OnStreamFrame(data1); | 235 session_->OnStreamFrame(data1); |
236 EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams()); | 236 EXPECT_EQ(1u, session_->GetNumOpenIncomingStreams()); |
237 | 237 |
238 // Receive a reset (and send a RST in response). | 238 // Receive a reset (and send a RST in response). |
239 QuicRstStreamFrame rst1(kClientDataStreamId1, QUIC_ERROR_PROCESSING_STREAM, | 239 QuicRstStreamFrame rst1(kClientDataStreamId1, QUIC_ERROR_PROCESSING_STREAM, |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 } | 513 } |
514 } | 514 } |
515 } | 515 } |
516 session_->PromisePushResources(request_url, push_resources, | 516 session_->PromisePushResources(request_url, push_resources, |
517 kClientDataStreamId1, request_headers); | 517 kClientDataStreamId1, request_headers); |
518 } | 518 } |
519 }; | 519 }; |
520 | 520 |
521 INSTANTIATE_TEST_CASE_P(Tests, | 521 INSTANTIATE_TEST_CASE_P(Tests, |
522 QuicSimpleServerSessionServerPushTest, | 522 QuicSimpleServerSessionServerPushTest, |
523 ::testing::ValuesIn(QuicSupportedVersions())); | 523 ::testing::ValuesIn(AllSupportedVersions())); |
524 | 524 |
525 TEST_P(QuicSimpleServerSessionServerPushTest, TestPromisePushResources) { | 525 TEST_P(QuicSimpleServerSessionServerPushTest, TestPromisePushResources) { |
526 // Tests that given more than kMaxOpenStreamForTest resources, all their | 526 // Tests that given more than kMaxOpenStreamForTest resources, all their |
527 // PUSH_PROMISE's will be sent out and only |kMaxOpenStreamForTest| streams | 527 // PUSH_PROMISE's will be sent out and only |kMaxOpenStreamForTest| streams |
528 // will be opened and send push response. | 528 // will be opened and send push response. |
529 | 529 |
530 if (session_->force_hol_blocking()) { | 530 if (session_->force_hol_blocking()) { |
531 return; | 531 return; |
532 } | 532 } |
533 size_t num_resources = kMaxStreamsForTest + 5; | 533 size_t num_resources = kMaxStreamsForTest + 5; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); | 624 .WillOnce(Return(QuicConsumedData(kStreamFlowControlWindowSize, false))); |
625 | 625 |
626 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); | 626 EXPECT_CALL(*connection_, SendBlocked(stream_to_open)); |
627 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); | 627 QuicRstStreamFrame rst(stream_got_reset, QUIC_STREAM_CANCELLED, 0); |
628 visitor_->OnRstStream(rst); | 628 visitor_->OnRstStream(rst); |
629 } | 629 } |
630 | 630 |
631 } // namespace | 631 } // namespace |
632 } // namespace test | 632 } // namespace test |
633 } // namespace net | 633 } // namespace net |
OLD | NEW |