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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 }; | 81 }; |
82 | 82 |
83 class MockQuicSimpleServerSession : public QuicSimpleServerSession { | 83 class MockQuicSimpleServerSession : public QuicSimpleServerSession { |
84 public: | 84 public: |
85 const size_t kMaxStreamsForTest = 100; | 85 const size_t kMaxStreamsForTest = 100; |
86 | 86 |
87 explicit MockQuicSimpleServerSession( | 87 explicit MockQuicSimpleServerSession( |
88 QuicConnection* connection, | 88 QuicConnection* connection, |
89 MockQuicServerSessionVisitor* owner, | 89 MockQuicServerSessionVisitor* owner, |
90 MockQuicServerSessionHelper* helper, | 90 MockQuicCryptoServerStreamHelper* helper, |
91 QuicCryptoServerConfig* crypto_config, | 91 QuicCryptoServerConfig* crypto_config, |
92 QuicCompressedCertsCache* compressed_certs_cache) | 92 QuicCompressedCertsCache* compressed_certs_cache) |
93 : QuicSimpleServerSession(DefaultQuicConfig(), | 93 : QuicSimpleServerSession(DefaultQuicConfig(), |
94 connection, | 94 connection, |
95 owner, | 95 owner, |
96 helper, | 96 helper, |
97 crypto_config, | 97 crypto_config, |
98 compressed_certs_cache) { | 98 compressed_certs_cache) { |
99 set_max_open_incoming_streams(kMaxStreamsForTest); | 99 set_max_open_incoming_streams(kMaxStreamsForTest); |
100 set_max_open_outgoing_streams(kMaxStreamsForTest); | 100 set_max_open_outgoing_streams(kMaxStreamsForTest); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 StringPiece StreamHeadersValue(const string& key) { | 226 StringPiece StreamHeadersValue(const string& key) { |
227 return (*stream_->mutable_headers())[key]; | 227 return (*stream_->mutable_headers())[key]; |
228 } | 228 } |
229 | 229 |
230 SpdyHeaderBlock response_headers_; | 230 SpdyHeaderBlock response_headers_; |
231 MockQuicConnectionHelper helper_; | 231 MockQuicConnectionHelper helper_; |
232 MockAlarmFactory alarm_factory_; | 232 MockAlarmFactory alarm_factory_; |
233 StrictMock<MockQuicConnection>* connection_; | 233 StrictMock<MockQuicConnection>* connection_; |
234 StrictMock<MockQuicServerSessionVisitor> session_owner_; | 234 StrictMock<MockQuicServerSessionVisitor> session_owner_; |
235 StrictMock<MockQuicServerSessionHelper> session_helper_; | 235 StrictMock<MockQuicCryptoServerStreamHelper> session_helper_; |
236 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; | 236 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; |
237 QuicCompressedCertsCache compressed_certs_cache_; | 237 QuicCompressedCertsCache compressed_certs_cache_; |
238 StrictMock<MockQuicSimpleServerSession> session_; | 238 StrictMock<MockQuicSimpleServerSession> session_; |
239 QuicSimpleServerStreamPeer* stream_; // Owned by session_. | 239 QuicSimpleServerStreamPeer* stream_; // Owned by session_. |
240 string headers_string_; | 240 string headers_string_; |
241 string body_; | 241 string body_; |
242 }; | 242 }; |
243 | 243 |
244 INSTANTIATE_TEST_CASE_P(Tests, | 244 INSTANTIATE_TEST_CASE_P(Tests, |
245 QuicSimpleServerStreamTest, | 245 QuicSimpleServerStreamTest, |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 }; | 643 }; |
644 StringPiece data(arr, arraysize(arr)); | 644 StringPiece data(arr, arraysize(arr)); |
645 QuicStreamFrame frame(stream_->id(), true, 0, data); | 645 QuicStreamFrame frame(stream_->id(), true, 0, data); |
646 // Verify that we don't crash when we get a invalid headers in stream frame. | 646 // Verify that we don't crash when we get a invalid headers in stream frame. |
647 stream_->OnStreamFrame(frame); | 647 stream_->OnStreamFrame(frame); |
648 } | 648 } |
649 | 649 |
650 } // namespace | 650 } // namespace |
651 } // namespace test | 651 } // namespace test |
652 } // namespace net | 652 } // namespace net |
OLD | NEW |