OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
8 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
9 #include "net/quic/quic_utils.h" | 11 #include "net/quic/quic_utils.h" |
10 #include "net/quic/quic_write_blocked_list.h" | 12 #include "net/quic/quic_write_blocked_list.h" |
11 #include "net/quic/spdy_utils.h" | 13 #include "net/quic/spdy_utils.h" |
12 #include "net/quic/test_tools/quic_config_peer.h" | 14 #include "net/quic/test_tools/quic_config_peer.h" |
13 #include "net/quic/test_tools/quic_connection_peer.h" | 15 #include "net/quic/test_tools/quic_connection_peer.h" |
14 #include "net/quic/test_tools/quic_flow_controller_peer.h" | 16 #include "net/quic/test_tools/quic_flow_controller_peer.h" |
15 #include "net/quic/test_tools/quic_session_peer.h" | 17 #include "net/quic/test_tools/quic_session_peer.h" |
16 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6" | 99 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6" |
98 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" | 100 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" |
99 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" | 101 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" |
100 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" | 102 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" |
101 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" | 103 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" |
102 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; | 104 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; |
103 } | 105 } |
104 | 106 |
105 void Initialize(bool stream_should_process_data) { | 107 void Initialize(bool stream_should_process_data) { |
106 connection_ = new StrictMock<MockConnection>( | 108 connection_ = new StrictMock<MockConnection>( |
107 &helper_, Perspective::IS_SERVER, supported_versions_); | 109 &helper_, &alarm_factory_, Perspective::IS_SERVER, supported_versions_); |
108 session_.reset(new StrictMock<MockQuicSpdySession>(connection_)); | 110 session_.reset(new StrictMock<MockQuicSpdySession>(connection_)); |
109 | 111 |
110 // New streams rely on having the peer's flow control receive window | 112 // New streams rely on having the peer's flow control receive window |
111 // negotiated in the config. | 113 // negotiated in the config. |
112 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( | 114 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( |
113 session_->config(), initial_flow_control_window_bytes_); | 115 session_->config(), initial_flow_control_window_bytes_); |
114 | 116 |
115 stream_ = new TestStream(kTestStreamId, session_.get(), | 117 stream_ = new TestStream(kTestStreamId, session_.get(), |
116 stream_should_process_data); | 118 stream_should_process_data); |
117 // session_ now owns stream_. | 119 // session_ now owns stream_. |
(...skipping 23 matching lines...) Expand all Loading... |
141 QuicIOVector /*iov*/, | 143 QuicIOVector /*iov*/, |
142 QuicStreamOffset /*offset*/, | 144 QuicStreamOffset /*offset*/, |
143 bool /*fin*/, | 145 bool /*fin*/, |
144 QuicAckListenerInterface* /*ack_notifier_delegate*/) { | 146 QuicAckListenerInterface* /*ack_notifier_delegate*/) { |
145 session_->CloseStream(id); | 147 session_->CloseStream(id); |
146 return QuicConsumedData(1, false); | 148 return QuicConsumedData(1, false); |
147 } | 149 } |
148 | 150 |
149 protected: | 151 protected: |
150 MockConnectionHelper helper_; | 152 MockConnectionHelper helper_; |
| 153 MockAlarmFactory alarm_factory_; |
151 MockConnection* connection_; | 154 MockConnection* connection_; |
152 std::unique_ptr<MockQuicSpdySession> session_; | 155 std::unique_ptr<MockQuicSpdySession> session_; |
153 TestStream* stream_; | 156 TestStream* stream_; |
154 SpdyHeaderBlock headers_; | 157 SpdyHeaderBlock headers_; |
155 QuicWriteBlockedList* write_blocked_list_; | 158 QuicWriteBlockedList* write_blocked_list_; |
156 uint32_t initial_flow_control_window_bytes_; | 159 uint32_t initial_flow_control_window_bytes_; |
157 QuicTime::Delta zero_; | 160 QuicTime::Delta zero_; |
158 QuicVersionVector supported_versions_; | 161 QuicVersionVector supported_versions_; |
159 const QuicStreamId kTestStreamId = 5u; | 162 const QuicStreamId kTestStreamId = 5u; |
160 }; | 163 }; |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 // Receive remaining data and FIN for the request. | 660 // Receive remaining data and FIN for the request. |
658 QuicStreamFrame frame2(stream_->id(), true, 0, StringPiece("End")); | 661 QuicStreamFrame frame2(stream_->id(), true, 0, StringPiece("End")); |
659 stream_->OnStreamFrame(frame2); | 662 stream_->OnStreamFrame(frame2); |
660 EXPECT_TRUE(stream_->fin_received()); | 663 EXPECT_TRUE(stream_->fin_received()); |
661 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); | 664 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); |
662 } | 665 } |
663 | 666 |
664 } // namespace | 667 } // namespace |
665 } // namespace test | 668 } // namespace test |
666 } // namespace net | 669 } // namespace net |
OLD | NEW |