OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_stream.h" | 5 #include "net/tools/quic/quic_simple_server_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; | 237 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; |
238 QuicCompressedCertsCache compressed_certs_cache_; | 238 QuicCompressedCertsCache compressed_certs_cache_; |
239 StrictMock<MockQuicSimpleServerSession> session_; | 239 StrictMock<MockQuicSimpleServerSession> session_; |
240 QuicSimpleServerStreamPeer* stream_; // Owned by session_. | 240 QuicSimpleServerStreamPeer* stream_; // Owned by session_. |
241 string headers_string_; | 241 string headers_string_; |
242 string body_; | 242 string body_; |
243 }; | 243 }; |
244 | 244 |
245 INSTANTIATE_TEST_CASE_P(Tests, | 245 INSTANTIATE_TEST_CASE_P(Tests, |
246 QuicSimpleServerStreamTest, | 246 QuicSimpleServerStreamTest, |
247 ::testing::ValuesIn(QuicSupportedVersions())); | 247 ::testing::ValuesIn(AllSupportedVersions())); |
248 | 248 |
249 TEST_P(QuicSimpleServerStreamTest, TestFraming) { | 249 TEST_P(QuicSimpleServerStreamTest, TestFraming) { |
250 EXPECT_CALL(session_, WritevData(_, _, _, _, _, _)) | 250 EXPECT_CALL(session_, WritevData(_, _, _, _, _, _)) |
251 .Times(AnyNumber()) | 251 .Times(AnyNumber()) |
252 .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData)); | 252 .WillRepeatedly(Invoke(MockQuicSession::ConsumeAllData)); |
253 stream_->OnStreamHeaders(headers_string_); | 253 stream_->OnStreamHeaders(headers_string_); |
254 stream_->OnStreamHeadersComplete(false, headers_string_.size()); | 254 stream_->OnStreamHeadersComplete(false, headers_string_.size()); |
255 stream_->OnStreamFrame( | 255 stream_->OnStreamFrame( |
256 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_)); | 256 QuicStreamFrame(stream_->id(), /*fin=*/false, /*offset=*/0, body_)); |
257 EXPECT_EQ("11", StreamHeadersValue("content-length")); | 257 EXPECT_EQ("11", StreamHeadersValue("content-length")); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 }; | 644 }; |
645 StringPiece data(arr, arraysize(arr)); | 645 StringPiece data(arr, arraysize(arr)); |
646 QuicStreamFrame frame(stream_->id(), true, 0, data); | 646 QuicStreamFrame frame(stream_->id(), true, 0, data); |
647 // Verify that we don't crash when we get a invalid headers in stream frame. | 647 // Verify that we don't crash when we get a invalid headers in stream frame. |
648 stream_->OnStreamFrame(frame); | 648 stream_->OnStreamFrame(frame); |
649 } | 649 } |
650 | 650 |
651 } // namespace | 651 } // namespace |
652 } // namespace test | 652 } // namespace test |
653 } // namespace net | 653 } // namespace net |
OLD | NEW |