| 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 "net/quic/quic_ack_notifier.h" | 7 #include "net/quic/quic_ack_notifier.h" |
| 8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
| 10 #include "net/quic/quic_write_blocked_list.h" | 10 #include "net/quic/quic_write_blocked_list.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" | 100 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" |
| 101 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" | 101 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" |
| 102 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" | 102 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" |
| 103 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" | 103 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" |
| 104 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; | 104 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void Initialize(bool stream_should_process_data) { | 107 void Initialize(bool stream_should_process_data) { |
| 108 connection_ = new StrictMock<MockConnection>(Perspective::IS_SERVER, | 108 connection_ = new StrictMock<MockConnection>(Perspective::IS_SERVER, |
| 109 supported_versions_); | 109 supported_versions_); |
| 110 session_.reset(new StrictMock<MockSession>(connection_)); | 110 session_.reset(new StrictMock<MockQuicSpdySession>(connection_)); |
| 111 | 111 |
| 112 // 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 |
| 113 // negotiated in the config. | 113 // negotiated in the config. |
| 114 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( | 114 QuicConfigPeer::SetReceivedInitialStreamFlowControlWindow( |
| 115 session_->config(), initial_flow_control_window_bytes_); | 115 session_->config(), initial_flow_control_window_bytes_); |
| 116 | 116 |
| 117 stream_.reset(new TestStream(kHeadersStreamId, session_.get(), | 117 stream_.reset(new TestStream(kHeadersStreamId, session_.get(), |
| 118 stream_should_process_data)); | 118 stream_should_process_data)); |
| 119 write_blocked_list_ = | 119 write_blocked_list_ = |
| 120 QuicSessionPeer::GetWriteBlockedStreams(session_.get()); | 120 QuicSessionPeer::GetWriteBlockedStreams(session_.get()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool fin_sent() { return ReliableQuicStreamPeer::FinSent(stream_.get()); } | 123 bool fin_sent() { return ReliableQuicStreamPeer::FinSent(stream_.get()); } |
| 124 bool rst_sent() { return ReliableQuicStreamPeer::RstSent(stream_.get()); } | 124 bool rst_sent() { return ReliableQuicStreamPeer::RstSent(stream_.get()); } |
| 125 | 125 |
| 126 void set_initial_flow_control_window_bytes(uint32 val) { | 126 void set_initial_flow_control_window_bytes(uint32 val) { |
| 127 initial_flow_control_window_bytes_ = val; | 127 initial_flow_control_window_bytes_ = val; |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool HasWriteBlockedStreams() { | 130 bool HasWriteBlockedStreams() { |
| 131 return write_blocked_list_->HasWriteBlockedCryptoOrHeadersStream() || | 131 return write_blocked_list_->HasWriteBlockedCryptoOrHeadersStream() || |
| 132 write_blocked_list_->HasWriteBlockedDataStreams(); | 132 write_blocked_list_->HasWriteBlockedDataStreams(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 protected: | 135 protected: |
| 136 MockConnection* connection_; | 136 MockConnection* connection_; |
| 137 scoped_ptr<MockSession> session_; | 137 scoped_ptr<MockQuicSpdySession> session_; |
| 138 scoped_ptr<TestStream> stream_; | 138 scoped_ptr<TestStream> stream_; |
| 139 SpdyHeaderBlock headers_; | 139 SpdyHeaderBlock headers_; |
| 140 QuicWriteBlockedList* write_blocked_list_; | 140 QuicWriteBlockedList* write_blocked_list_; |
| 141 uint32 initial_flow_control_window_bytes_; | 141 uint32 initial_flow_control_window_bytes_; |
| 142 QuicTime::Delta zero_; | 142 QuicTime::Delta zero_; |
| 143 QuicVersionVector supported_versions_; | 143 QuicVersionVector supported_versions_; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 TEST_F(ReliableQuicStreamTest, WriteAllData) { | 146 TEST_F(ReliableQuicStreamTest, WriteAllData) { |
| 147 Initialize(kShouldProcessData); | 147 Initialize(kShouldProcessData); |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 633 |
| 634 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset()); | 634 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset()); |
| 635 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); | 635 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); |
| 636 stream_->OnStreamReset(rst_frame); | 636 stream_->OnStreamReset(rst_frame); |
| 637 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); | 637 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); |
| 638 } | 638 } |
| 639 | 639 |
| 640 } // namespace | 640 } // namespace |
| 641 } // namespace test | 641 } // namespace test |
| 642 } // namespace net | 642 } // namespace net |
| OLD | NEW |