| 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/quic/core/quic_spdy_stream.h" | 5 #include "net/quic/core/quic_spdy_stream.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "net/quic/core/quic_connection.h" | 10 #include "net/quic/core/quic_connection.h" |
| 11 #include "net/quic/core/quic_utils.h" | 11 #include "net/quic/core/quic_utils.h" |
| 12 #include "net/quic/core/quic_write_blocked_list.h" | 12 #include "net/quic/core/quic_write_blocked_list.h" |
| 13 #include "net/quic/core/spdy_utils.h" | 13 #include "net/quic/core/spdy_utils.h" |
| 14 #include "net/quic/platform/api/quic_ptr_util.h" | 14 #include "net/quic/platform/api/quic_ptr_util.h" |
| 15 #include "net/quic/platform/api/quic_string_piece.h" | 15 #include "net/quic/platform/api/quic_string_piece.h" |
| 16 #include "net/quic/platform/api/quic_test.h" |
| 16 #include "net/quic/platform/api/quic_text_utils.h" | 17 #include "net/quic/platform/api/quic_text_utils.h" |
| 17 #include "net/quic/test_tools/quic_flow_controller_peer.h" | 18 #include "net/quic/test_tools/quic_flow_controller_peer.h" |
| 18 #include "net/quic/test_tools/quic_session_peer.h" | 19 #include "net/quic/test_tools/quic_session_peer.h" |
| 19 #include "net/quic/test_tools/quic_stream_peer.h" | 20 #include "net/quic/test_tools/quic_stream_peer.h" |
| 20 #include "net/quic/test_tools/quic_test_utils.h" | 21 #include "net/quic/test_tools/quic_test_utils.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | |
| 22 #include "testing/gtest/include/gtest/gtest.h" | |
| 23 | 22 |
| 24 using std::string; | 23 using std::string; |
| 25 using testing::AnyNumber; | 24 using testing::AnyNumber; |
| 26 using testing::Invoke; | 25 using testing::Invoke; |
| 27 using testing::Return; | 26 using testing::Return; |
| 28 using testing::StrictMock; | 27 using testing::StrictMock; |
| 29 using testing::_; | 28 using testing::_; |
| 30 | 29 |
| 31 namespace net { | 30 namespace net { |
| 32 namespace test { | 31 namespace test { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 57 using QuicStream::WriteOrBufferData; | 56 using QuicStream::WriteOrBufferData; |
| 58 using QuicStream::CloseWriteSide; | 57 using QuicStream::CloseWriteSide; |
| 59 | 58 |
| 60 const string& data() const { return data_; } | 59 const string& data() const { return data_; } |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 bool should_process_data_; | 62 bool should_process_data_; |
| 64 string data_; | 63 string data_; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 class QuicSpdyStreamTest : public ::testing::TestWithParam<QuicVersion> { | 66 class QuicSpdyStreamTest : public QuicTestWithParam<QuicVersion> { |
| 68 public: | 67 public: |
| 69 QuicSpdyStreamTest() { | 68 QuicSpdyStreamTest() { |
| 70 headers_[":host"] = "www.google.com"; | 69 headers_[":host"] = "www.google.com"; |
| 71 headers_[":path"] = "/index.hml"; | 70 headers_[":path"] = "/index.hml"; |
| 72 headers_[":scheme"] = "https"; | 71 headers_[":scheme"] = "https"; |
| 73 headers_["cookie"] = | 72 headers_["cookie"] = |
| 74 "__utma=208381060.1228362404.1372200928.1372200928.1372200928.1; " | 73 "__utma=208381060.1228362404.1372200928.1372200928.1372200928.1; " |
| 75 "__utmc=160408618; " | 74 "__utmc=160408618; " |
| 76 "GX=DQAAAOEAAACWJYdewdE9rIrW6qw3PtVi2-d729qaa-74KqOsM1NVQblK4VhX" | 75 "GX=DQAAAOEAAACWJYdewdE9rIrW6qw3PtVi2-d729qaa-74KqOsM1NVQblK4VhX" |
| 77 "hoALMsy6HOdDad2Sz0flUByv7etmo3mLMidGrBoljqO9hSVA40SLqpG_iuKKSHX" | 76 "hoALMsy6HOdDad2Sz0flUByv7etmo3mLMidGrBoljqO9hSVA40SLqpG_iuKKSHX" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 session_->ActivateStream(QuicWrapUnique(stream2_)); | 108 session_->ActivateStream(QuicWrapUnique(stream2_)); |
| 110 } | 109 } |
| 111 | 110 |
| 112 QuicHeaderList ProcessHeaders(bool fin, const SpdyHeaderBlock& headers) { | 111 QuicHeaderList ProcessHeaders(bool fin, const SpdyHeaderBlock& headers) { |
| 113 QuicHeaderList h = AsHeaderList(headers); | 112 QuicHeaderList h = AsHeaderList(headers); |
| 114 stream_->OnStreamHeaderList(fin, h.uncompressed_header_bytes(), h); | 113 stream_->OnStreamHeaderList(fin, h.uncompressed_header_bytes(), h); |
| 115 return h; | 114 return h; |
| 116 } | 115 } |
| 117 | 116 |
| 118 protected: | 117 protected: |
| 119 QuicFlagSaver flags_; // Save/restore all QUIC flag values. | |
| 120 MockQuicConnectionHelper helper_; | 118 MockQuicConnectionHelper helper_; |
| 121 MockAlarmFactory alarm_factory_; | 119 MockAlarmFactory alarm_factory_; |
| 122 MockQuicConnection* connection_; | 120 MockQuicConnection* connection_; |
| 123 std::unique_ptr<MockQuicSpdySession> session_; | 121 std::unique_ptr<MockQuicSpdySession> session_; |
| 124 | 122 |
| 125 // Owned by the |session_|. | 123 // Owned by the |session_|. |
| 126 TestStream* stream_; | 124 TestStream* stream_; |
| 127 TestStream* stream2_; | 125 TestStream* stream2_; |
| 128 | 126 |
| 129 SpdyHeaderBlock headers_; | 127 SpdyHeaderBlock headers_; |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 | 943 |
| 946 // Writing Trailers should fail, as the FIN has already been sent. | 944 // Writing Trailers should fail, as the FIN has already been sent. |
| 947 // populated with the number of body bytes written. | 945 // populated with the number of body bytes written. |
| 948 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), | 946 EXPECT_QUIC_BUG(stream_->WriteTrailers(SpdyHeaderBlock(), nullptr), |
| 949 "Trailers cannot be sent after a FIN"); | 947 "Trailers cannot be sent after a FIN"); |
| 950 } | 948 } |
| 951 | 949 |
| 952 } // namespace | 950 } // namespace |
| 953 } // namespace test | 951 } // namespace test |
| 954 } // namespace net | 952 } // namespace net |
| OLD | NEW |