| 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 <list> | 7 #include <list> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return stream->request_headers_; | 84 return stream->request_headers_; |
| 85 } | 85 } |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 class MockQuicSimpleServerSession : public QuicSimpleServerSession { | 88 class MockQuicSimpleServerSession : public QuicSimpleServerSession { |
| 89 public: | 89 public: |
| 90 const size_t kMaxStreamsForTest = 100; | 90 const size_t kMaxStreamsForTest = 100; |
| 91 | 91 |
| 92 explicit MockQuicSimpleServerSession( | 92 explicit MockQuicSimpleServerSession( |
| 93 QuicConnection* connection, | 93 QuicConnection* connection, |
| 94 MockQuicServerSessionVisitor* owner, | 94 MockQuicSessionVisitor* owner, |
| 95 MockQuicCryptoServerStreamHelper* helper, | 95 MockQuicCryptoServerStreamHelper* helper, |
| 96 QuicCryptoServerConfig* crypto_config, | 96 QuicCryptoServerConfig* crypto_config, |
| 97 QuicCompressedCertsCache* compressed_certs_cache) | 97 QuicCompressedCertsCache* compressed_certs_cache) |
| 98 : QuicSimpleServerSession(DefaultQuicConfig(), | 98 : QuicSimpleServerSession(DefaultQuicConfig(), |
| 99 connection, | 99 connection, |
| 100 owner, | 100 owner, |
| 101 helper, | 101 helper, |
| 102 crypto_config, | 102 crypto_config, |
| 103 compressed_certs_cache) { | 103 compressed_certs_cache) { |
| 104 set_max_open_incoming_streams(kMaxStreamsForTest); | 104 set_max_open_incoming_streams(kMaxStreamsForTest); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 | 228 |
| 229 string StreamHeadersValue(const string& key) { | 229 string StreamHeadersValue(const string& key) { |
| 230 return (*stream_->mutable_headers())[key].as_string(); | 230 return (*stream_->mutable_headers())[key].as_string(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 SpdyHeaderBlock response_headers_; | 233 SpdyHeaderBlock response_headers_; |
| 234 MockQuicConnectionHelper helper_; | 234 MockQuicConnectionHelper helper_; |
| 235 MockAlarmFactory alarm_factory_; | 235 MockAlarmFactory alarm_factory_; |
| 236 StrictMock<MockQuicConnection>* connection_; | 236 StrictMock<MockQuicConnection>* connection_; |
| 237 StrictMock<MockQuicServerSessionVisitor> session_owner_; | 237 StrictMock<MockQuicSessionVisitor> session_owner_; |
| 238 StrictMock<MockQuicCryptoServerStreamHelper> session_helper_; | 238 StrictMock<MockQuicCryptoServerStreamHelper> session_helper_; |
| 239 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; | 239 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; |
| 240 QuicCompressedCertsCache compressed_certs_cache_; | 240 QuicCompressedCertsCache compressed_certs_cache_; |
| 241 StrictMock<MockQuicSimpleServerSession> session_; | 241 StrictMock<MockQuicSimpleServerSession> session_; |
| 242 QuicSimpleServerStreamPeer* stream_; // Owned by session_. | 242 QuicSimpleServerStreamPeer* stream_; // Owned by session_. |
| 243 string headers_string_; | 243 string headers_string_; |
| 244 string body_; | 244 string body_; |
| 245 QuicHeaderList header_list_; | 245 QuicHeaderList header_list_; |
| 246 }; | 246 }; |
| 247 | 247 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 }; | 641 }; |
| 642 StringPiece data(arr, arraysize(arr)); | 642 StringPiece data(arr, arraysize(arr)); |
| 643 QuicStreamFrame frame(stream_->id(), true, 0, data); | 643 QuicStreamFrame frame(stream_->id(), true, 0, data); |
| 644 // Verify that we don't crash when we get a invalid headers in stream frame. | 644 // Verify that we don't crash when we get a invalid headers in stream frame. |
| 645 stream_->OnStreamFrame(frame); | 645 stream_->OnStreamFrame(frame); |
| 646 } | 646 } |
| 647 | 647 |
| 648 } // namespace | 648 } // namespace |
| 649 } // namespace test | 649 } // namespace test |
| 650 } // namespace net | 650 } // namespace net |
| OLD | NEW |