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_flags.h" | 9 #include "net/quic/quic_flags.h" |
10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 QuicTime::Delta zero_; | 146 QuicTime::Delta zero_; |
147 QuicVersionVector supported_versions_; | 147 QuicVersionVector supported_versions_; |
148 }; | 148 }; |
149 | 149 |
150 TEST_F(ReliableQuicStreamTest, WriteAllData) { | 150 TEST_F(ReliableQuicStreamTest, WriteAllData) { |
151 Initialize(kShouldProcessData); | 151 Initialize(kShouldProcessData); |
152 | 152 |
153 connection_->options()->max_packet_length = | 153 connection_->options()->max_packet_length = |
154 1 + QuicPacketCreator::StreamFramePacketOverhead( | 154 1 + QuicPacketCreator::StreamFramePacketOverhead( |
155 connection_->version(), PACKET_8BYTE_CONNECTION_ID, | 155 connection_->version(), PACKET_8BYTE_CONNECTION_ID, |
156 !kIncludeVersion, PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); | 156 !kIncludeVersion, PACKET_6BYTE_SEQUENCE_NUMBER, 0u, |
| 157 NOT_IN_FEC_GROUP); |
157 EXPECT_CALL(*session_, WritevData(kHeadersStreamId, _, _, _, _)) | 158 EXPECT_CALL(*session_, WritevData(kHeadersStreamId, _, _, _, _)) |
158 .WillOnce(Return(QuicConsumedData(kDataLen, true))); | 159 .WillOnce(Return(QuicConsumedData(kDataLen, true))); |
159 stream_->WriteOrBufferData(kData1, false, NULL); | 160 stream_->WriteOrBufferData(kData1, false, NULL); |
160 EXPECT_FALSE(HasWriteBlockedStreams()); | 161 EXPECT_FALSE(HasWriteBlockedStreams()); |
161 } | 162 } |
162 | 163 |
163 TEST_F(ReliableQuicStreamTest, NoBlockingIfNoDataOrFin) { | 164 TEST_F(ReliableQuicStreamTest, NoBlockingIfNoDataOrFin) { |
164 Initialize(kShouldProcessData); | 165 Initialize(kShouldProcessData); |
165 | 166 |
166 // Write no data and no fin. If we consume nothing we should not be write | 167 // Write no data and no fin. If we consume nothing we should not be write |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams()); | 205 ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams()); |
205 } | 206 } |
206 | 207 |
207 TEST_F(ReliableQuicStreamTest, WriteOrBufferData) { | 208 TEST_F(ReliableQuicStreamTest, WriteOrBufferData) { |
208 Initialize(kShouldProcessData); | 209 Initialize(kShouldProcessData); |
209 | 210 |
210 EXPECT_FALSE(HasWriteBlockedStreams()); | 211 EXPECT_FALSE(HasWriteBlockedStreams()); |
211 connection_->options()->max_packet_length = | 212 connection_->options()->max_packet_length = |
212 1 + QuicPacketCreator::StreamFramePacketOverhead( | 213 1 + QuicPacketCreator::StreamFramePacketOverhead( |
213 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, | 214 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, |
214 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); | 215 PACKET_6BYTE_SEQUENCE_NUMBER, 0u, NOT_IN_FEC_GROUP); |
215 EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).WillOnce( | 216 EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).WillOnce( |
216 Return(QuicConsumedData(kDataLen - 1, false))); | 217 Return(QuicConsumedData(kDataLen - 1, false))); |
217 stream_->WriteOrBufferData(kData1, false, NULL); | 218 stream_->WriteOrBufferData(kData1, false, NULL); |
218 EXPECT_TRUE(HasWriteBlockedStreams()); | 219 EXPECT_TRUE(HasWriteBlockedStreams()); |
219 | 220 |
220 // Queue a bytes_consumed write. | 221 // Queue a bytes_consumed write. |
221 stream_->WriteOrBufferData(kData2, false, NULL); | 222 stream_->WriteOrBufferData(kData2, false, NULL); |
222 | 223 |
223 // Make sure we get the tail of the first write followed by the bytes_consumed | 224 // Make sure we get the tail of the first write followed by the bytes_consumed |
224 InSequence s; | 225 InSequence s; |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 549 |
549 // Handle the acks. | 550 // Handle the acks. |
550 proxy_delegate->OnAckNotification(1, 2, 3, 4, zero_); | 551 proxy_delegate->OnAckNotification(1, 2, 3, 4, zero_); |
551 EXPECT_CALL(*delegate, OnAckNotification(11, 22, 33, 44, zero_)); | 552 EXPECT_CALL(*delegate, OnAckNotification(11, 22, 33, 44, zero_)); |
552 proxy_delegate->OnAckNotification(10, 20, 30, 40, zero_); | 553 proxy_delegate->OnAckNotification(10, 20, 30, 40, zero_); |
553 } | 554 } |
554 | 555 |
555 } // namespace | 556 } // namespace |
556 } // namespace test | 557 } // namespace test |
557 } // namespace net | 558 } // namespace net |
OLD | NEW |