| 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_connection.h" | 7 #include "net/quic/quic_connection.h" |
| 8 #include "net/quic/quic_spdy_compressor.h" | 8 #include "net/quic/quic_spdy_compressor.h" |
| 9 #include "net/quic/quic_spdy_decompressor.h" | 9 #include "net/quic/quic_spdy_decompressor.h" |
| 10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 scoped_ptr<QuicSpdyDecompressor> decompressor_; | 92 scoped_ptr<QuicSpdyDecompressor> decompressor_; |
| 93 SpdyHeaderBlock headers_; | 93 SpdyHeaderBlock headers_; |
| 94 BlockedList<QuicStreamId>* write_blocked_list_; | 94 BlockedList<QuicStreamId>* write_blocked_list_; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 TEST_F(ReliableQuicStreamTest, WriteAllData) { | 97 TEST_F(ReliableQuicStreamTest, WriteAllData) { |
| 98 Initialize(kShouldProcessData); | 98 Initialize(kShouldProcessData); |
| 99 | 99 |
| 100 connection_->options()->max_packet_length = | 100 connection_->options()->max_packet_length = |
| 101 1 + QuicPacketCreator::StreamFramePacketOverhead( | 101 1 + QuicPacketCreator::StreamFramePacketOverhead( |
| 102 1, PACKET_8BYTE_GUID, !kIncludeVersion, | 102 PACKET_8BYTE_GUID, !kIncludeVersion, |
| 103 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); | 103 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); |
| 104 // TODO(rch): figure out how to get StrEq working here. | 104 // TODO(rch): figure out how to get StrEq working here. |
| 105 //EXPECT_CALL(*session_, WriteData(kStreamId, StrEq(kData1), _, _)).WillOnce( | 105 //EXPECT_CALL(*session_, WriteData(kStreamId, StrEq(kData1), _, _)).WillOnce( |
| 106 EXPECT_CALL(*session_, WriteData(kStreamId, _, _, _)).WillOnce( | 106 EXPECT_CALL(*session_, WriteData(kStreamId, _, _, _)).WillOnce( |
| 107 Return(QuicConsumedData(kDataLen, true))); | 107 Return(QuicConsumedData(kDataLen, true))); |
| 108 EXPECT_EQ(kDataLen, stream_->WriteData(kData1, false).bytes_consumed); | 108 EXPECT_EQ(kDataLen, stream_->WriteData(kData1, false).bytes_consumed); |
| 109 EXPECT_TRUE(write_blocked_list_->IsEmpty()); | 109 EXPECT_TRUE(write_blocked_list_->IsEmpty()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 // TODO(rtenneti): Death tests crash on OS_ANDROID. | 112 // TODO(rtenneti): Death tests crash on OS_ANDROID. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 stream_->WriteData(StringPiece(), true); | 160 stream_->WriteData(StringPiece(), true); |
| 161 ASSERT_EQ(1, write_blocked_list_->NumObjects()); | 161 ASSERT_EQ(1, write_blocked_list_->NumObjects()); |
| 162 } | 162 } |
| 163 | 163 |
| 164 TEST_F(ReliableQuicStreamTest, WriteData) { | 164 TEST_F(ReliableQuicStreamTest, WriteData) { |
| 165 Initialize(kShouldProcessData); | 165 Initialize(kShouldProcessData); |
| 166 | 166 |
| 167 EXPECT_TRUE(write_blocked_list_->IsEmpty()); | 167 EXPECT_TRUE(write_blocked_list_->IsEmpty()); |
| 168 connection_->options()->max_packet_length = | 168 connection_->options()->max_packet_length = |
| 169 1 + QuicPacketCreator::StreamFramePacketOverhead( | 169 1 + QuicPacketCreator::StreamFramePacketOverhead( |
| 170 1, PACKET_8BYTE_GUID, !kIncludeVersion, | 170 PACKET_8BYTE_GUID, !kIncludeVersion, |
| 171 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); | 171 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); |
| 172 // TODO(rch): figure out how to get StrEq working here. | 172 // TODO(rch): figure out how to get StrEq working here. |
| 173 //EXPECT_CALL(*session_, WriteData(_, StrEq(kData1), _, _)).WillOnce( | 173 //EXPECT_CALL(*session_, WriteData(_, StrEq(kData1), _, _)).WillOnce( |
| 174 EXPECT_CALL(*session_, WriteData(_, _, _, _)).WillOnce( | 174 EXPECT_CALL(*session_, WriteData(_, _, _, _)).WillOnce( |
| 175 Return(QuicConsumedData(kDataLen - 1, false))); | 175 Return(QuicConsumedData(kDataLen - 1, false))); |
| 176 // The return will be kDataLen, because the last byte gets buffered. | 176 // The return will be kDataLen, because the last byte gets buffered. |
| 177 EXPECT_EQ(kDataLen, stream_->WriteData(kData1, false).bytes_consumed); | 177 EXPECT_EQ(kDataLen, stream_->WriteData(kData1, false).bytes_consumed); |
| 178 EXPECT_FALSE(write_blocked_list_->IsEmpty()); | 178 EXPECT_FALSE(write_blocked_list_->IsEmpty()); |
| 179 | 179 |
| 180 // Queue a bytes_consumed write. | 180 // Queue a bytes_consumed write. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_HEADER_ID)) | 390 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_HEADER_ID)) |
| 391 .Times(0); | 391 .Times(0); |
| 392 QuicStreamFrame frame2(stream_->id(), false, compressed_headers.length(), | 392 QuicStreamFrame frame2(stream_->id(), false, compressed_headers.length(), |
| 393 "body data"); | 393 "body data"); |
| 394 stream_->OnStreamFrame(frame2); | 394 stream_->OnStreamFrame(frame2); |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace | 397 } // namespace |
| 398 } // namespace test | 398 } // namespace test |
| 399 } // namespace net | 399 } // namespace net |
| OLD | NEW |