| 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 "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
| 9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
| 10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 namespace { | 145 namespace { |
| 146 | 146 |
| 147 class QuicSimpleServerStreamTest | 147 class QuicSimpleServerStreamTest |
| 148 : public ::testing::TestWithParam<QuicVersion> { | 148 : public ::testing::TestWithParam<QuicVersion> { |
| 149 public: | 149 public: |
| 150 QuicSimpleServerStreamTest() | 150 QuicSimpleServerStreamTest() |
| 151 : connection_( | 151 : connection_( |
| 152 new StrictMock<MockConnection>(&helper_, | 152 new StrictMock<MockConnection>(&helper_, |
| 153 &alarm_factory_, |
| 153 Perspective::IS_SERVER, | 154 Perspective::IS_SERVER, |
| 154 SupportedVersions(GetParam()))), | 155 SupportedVersions(GetParam()))), |
| 155 session_owner_(new StrictMock<MockQuicServerSessionVisitor>()), | 156 session_owner_(new StrictMock<MockQuicServerSessionVisitor>()), |
| 156 crypto_config_(new QuicCryptoServerConfig( | 157 crypto_config_(new QuicCryptoServerConfig( |
| 157 QuicCryptoServerConfig::TESTING, | 158 QuicCryptoServerConfig::TESTING, |
| 158 QuicRandom::GetInstance(), | 159 QuicRandom::GetInstance(), |
| 159 ::net::test::CryptoTestUtils::ProofSourceForTesting())), | 160 ::net::test::CryptoTestUtils::ProofSourceForTesting())), |
| 160 compressed_certs_cache_( | 161 compressed_certs_cache_( |
| 161 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), | 162 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), |
| 162 session_(connection_, | 163 session_(connection_, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const string& StreamBody() { | 198 const string& StreamBody() { |
| 198 return QuicSimpleServerStreamPeer::body(stream_); | 199 return QuicSimpleServerStreamPeer::body(stream_); |
| 199 } | 200 } |
| 200 | 201 |
| 201 StringPiece StreamHeadersValue(const string& key) { | 202 StringPiece StreamHeadersValue(const string& key) { |
| 202 return (*stream_->mutable_headers())[key]; | 203 return (*stream_->mutable_headers())[key]; |
| 203 } | 204 } |
| 204 | 205 |
| 205 SpdyHeaderBlock response_headers_; | 206 SpdyHeaderBlock response_headers_; |
| 206 MockConnectionHelper helper_; | 207 MockConnectionHelper helper_; |
| 208 MockAlarmFactory alarm_factory_; |
| 207 StrictMock<MockConnection>* connection_; | 209 StrictMock<MockConnection>* connection_; |
| 208 StrictMock<MockQuicServerSessionVisitor>* session_owner_; | 210 StrictMock<MockQuicServerSessionVisitor>* session_owner_; |
| 209 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; | 211 std::unique_ptr<QuicCryptoServerConfig> crypto_config_; |
| 210 QuicCompressedCertsCache compressed_certs_cache_; | 212 QuicCompressedCertsCache compressed_certs_cache_; |
| 211 StrictMock<MockQuicSimpleServerSession> session_; | 213 StrictMock<MockQuicSimpleServerSession> session_; |
| 212 QuicSimpleServerStreamPeer* stream_; // Owned by session_. | 214 QuicSimpleServerStreamPeer* stream_; // Owned by session_. |
| 213 string headers_string_; | 215 string headers_string_; |
| 214 string body_; | 216 string body_; |
| 215 }; | 217 }; |
| 216 | 218 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 }; | 638 }; |
| 637 StringPiece data(arr, arraysize(arr)); | 639 StringPiece data(arr, arraysize(arr)); |
| 638 QuicStreamFrame frame(stream_->id(), true, 0, data); | 640 QuicStreamFrame frame(stream_->id(), true, 0, data); |
| 639 // Verify that we don't crash when we get a invalid headers in stream frame. | 641 // Verify that we don't crash when we get a invalid headers in stream frame. |
| 640 stream_->OnStreamFrame(frame); | 642 stream_->OnStreamFrame(frame); |
| 641 } | 643 } |
| 642 | 644 |
| 643 } // namespace | 645 } // namespace |
| 644 } // namespace test | 646 } // namespace test |
| 645 } // namespace net | 647 } // namespace net |
| OLD | NEW |