Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: net/quic/reliable_quic_stream_test.cc

Issue 182523002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed rch's comments in Patch set 1 of CL 181463007 Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_unacked_packet_map.cc ('k') | net/quic/test_tools/quic_framer_peer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_spdy_compressor.h" 9 #include "net/quic/quic_spdy_compressor.h"
10 #include "net/quic/quic_spdy_decompressor.h" 10 #include "net/quic/quic_spdy_decompressor.h"
(...skipping 15 matching lines...) Expand all
26 using testing::StrEq; 26 using testing::StrEq;
27 using testing::StrictMock; 27 using testing::StrictMock;
28 28
29 namespace net { 29 namespace net {
30 namespace test { 30 namespace test {
31 namespace { 31 namespace {
32 32
33 const char kData1[] = "FooAndBar"; 33 const char kData1[] = "FooAndBar";
34 const char kData2[] = "EepAndBaz"; 34 const char kData2[] = "EepAndBaz";
35 const size_t kDataLen = 9; 35 const size_t kDataLen = 9;
36 const QuicGuid kStreamId = 3; 36 const QuicConnectionId kStreamId = 3;
37 const bool kIsServer = true; 37 const bool kIsServer = true;
38 const bool kShouldProcessData = true; 38 const bool kShouldProcessData = true;
39 39
40 class TestStream : public ReliableQuicStream { 40 class TestStream : public ReliableQuicStream {
41 public: 41 public:
42 TestStream(QuicStreamId id, 42 TestStream(QuicStreamId id,
43 QuicSession* session, 43 QuicSession* session,
44 bool should_process_data) 44 bool should_process_data)
45 : ReliableQuicStream(id, session), 45 : ReliableQuicStream(id, session),
46 should_process_data_(should_process_data) {} 46 should_process_data_(should_process_data) {}
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 scoped_ptr<QuicSpdyDecompressor> decompressor_; 125 scoped_ptr<QuicSpdyDecompressor> decompressor_;
126 SpdyHeaderBlock headers_; 126 SpdyHeaderBlock headers_;
127 QuicWriteBlockedList* write_blocked_list_; 127 QuicWriteBlockedList* write_blocked_list_;
128 }; 128 };
129 129
130 TEST_F(ReliableQuicStreamTest, WriteAllData) { 130 TEST_F(ReliableQuicStreamTest, WriteAllData) {
131 Initialize(kShouldProcessData); 131 Initialize(kShouldProcessData);
132 132
133 connection_->options()->max_packet_length = 133 connection_->options()->max_packet_length =
134 1 + QuicPacketCreator::StreamFramePacketOverhead( 134 1 + QuicPacketCreator::StreamFramePacketOverhead(
135 connection_->version(), PACKET_8BYTE_GUID, !kIncludeVersion, 135 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion,
136 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); 136 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP);
137 EXPECT_CALL(*session_, WritevData(kStreamId, _, _, _, _)).WillOnce( 137 EXPECT_CALL(*session_, WritevData(kStreamId, _, _, _, _)).WillOnce(
138 Return(QuicConsumedData(kDataLen, true))); 138 Return(QuicConsumedData(kDataLen, true)));
139 stream_->WriteOrBufferData(kData1, false); 139 stream_->WriteOrBufferData(kData1, false);
140 EXPECT_FALSE(write_blocked_list_->HasWriteBlockedStreams()); 140 EXPECT_FALSE(write_blocked_list_->HasWriteBlockedStreams());
141 } 141 }
142 142
143 TEST_F(ReliableQuicStreamTest, NoBlockingIfNoDataOrFin) { 143 TEST_F(ReliableQuicStreamTest, NoBlockingIfNoDataOrFin) {
144 Initialize(kShouldProcessData); 144 Initialize(kShouldProcessData);
145 145
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 stream_->WriteOrBufferData(StringPiece(), true); 184 stream_->WriteOrBufferData(StringPiece(), true);
185 ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams()); 185 ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
186 } 186 }
187 187
188 TEST_F(ReliableQuicStreamTest, WriteOrBufferData) { 188 TEST_F(ReliableQuicStreamTest, WriteOrBufferData) {
189 Initialize(kShouldProcessData); 189 Initialize(kShouldProcessData);
190 190
191 EXPECT_FALSE(write_blocked_list_->HasWriteBlockedStreams()); 191 EXPECT_FALSE(write_blocked_list_->HasWriteBlockedStreams());
192 connection_->options()->max_packet_length = 192 connection_->options()->max_packet_length =
193 1 + QuicPacketCreator::StreamFramePacketOverhead( 193 1 + QuicPacketCreator::StreamFramePacketOverhead(
194 connection_->version(), PACKET_8BYTE_GUID, !kIncludeVersion, 194 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion,
195 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); 195 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP);
196 EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).WillOnce( 196 EXPECT_CALL(*session_, WritevData(_, _, _, _, _)).WillOnce(
197 Return(QuicConsumedData(kDataLen - 1, false))); 197 Return(QuicConsumedData(kDataLen - 1, false)));
198 stream_->WriteOrBufferData(kData1, false); 198 stream_->WriteOrBufferData(kData1, false);
199 EXPECT_TRUE(write_blocked_list_->HasWriteBlockedStreams()); 199 EXPECT_TRUE(write_blocked_list_->HasWriteBlockedStreams());
200 200
201 // Queue a bytes_consumed write. 201 // Queue a bytes_consumed write.
202 stream_->WriteOrBufferData(kData2, false); 202 stream_->WriteOrBufferData(kData2, false);
203 203
204 // Make sure we get the tail of the first write followed by the bytes_consumed 204 // Make sure we get the tail of the first write followed by the bytes_consumed
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // Now close the stream (any further resets being sent would break the 292 // Now close the stream (any further resets being sent would break the
293 // expectation above). 293 // expectation above).
294 stream_->OnClose(); 294 stream_->OnClose();
295 EXPECT_FALSE(fin_sent()); 295 EXPECT_FALSE(fin_sent());
296 EXPECT_TRUE(rst_sent()); 296 EXPECT_TRUE(rst_sent());
297 } 297 }
298 298
299 } // namespace 299 } // namespace
300 } // namespace test 300 } // namespace test
301 } // namespace net 301 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_unacked_packet_map.cc ('k') | net/quic/test_tools/quic_framer_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698