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

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

Issue 1497113003: Add a queued_data_bytes() method to ReliableQuicStream. Not used outside of tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@108727610
Patch Set: Created 5 years 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
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | no next file » | 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_connection.h" 7 #include "net/quic/quic_connection.h"
8 #include "net/quic/quic_flags.h" 8 #include "net/quic/quic_flags.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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
189 TEST_F(ReliableQuicStreamTest, BlockIfOnlySomeDataConsumed) { 189 TEST_F(ReliableQuicStreamTest, BlockIfOnlySomeDataConsumed) {
190 Initialize(kShouldProcessData); 190 Initialize(kShouldProcessData);
191 191
192 // Write some data and no fin. If we consume some but not all of the data, 192 // Write some data and no fin. If we consume some but not all of the data,
193 // we should be write blocked a not all the data was consumed. 193 // we should be write blocked a not all the data was consumed.
194 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) 194 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
195 .WillOnce(Return(QuicConsumedData(1, false))); 195 .WillOnce(Return(QuicConsumedData(1, false)));
196 stream_->WriteOrBufferData(StringPiece(kData1, 2), false, nullptr); 196 stream_->WriteOrBufferData(StringPiece(kData1, 2), false, nullptr);
197 ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams()); 197 ASSERT_EQ(1u, write_blocked_list_->NumBlockedStreams());
198 EXPECT_EQ(1u, stream_->queued_data_bytes());
198 } 199 }
199 200
200 TEST_F(ReliableQuicStreamTest, BlockIfFinNotConsumedWithData) { 201 TEST_F(ReliableQuicStreamTest, BlockIfFinNotConsumedWithData) {
201 Initialize(kShouldProcessData); 202 Initialize(kShouldProcessData);
202 203
203 // Write some data and no fin. If we consume all the data but not the fin, 204 // Write some data and no fin. If we consume all the data but not the fin,
204 // we should be write blocked because the fin was not consumed. 205 // we should be write blocked because the fin was not consumed.
205 // (This should never actually happen as the fin should be sent out with the 206 // (This should never actually happen as the fin should be sent out with the
206 // last data) 207 // last data)
207 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _)) 208 EXPECT_CALL(*session_, WritevData(kTestStreamId, _, _, _, _, _))
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // Receive remaining data and FIN for the request. 756 // Receive remaining data and FIN for the request.
756 QuicStreamFrame frame2(stream_->id(), true, 0, StringPiece("End")); 757 QuicStreamFrame frame2(stream_->id(), true, 0, StringPiece("End"));
757 stream_->OnStreamFrame(frame2); 758 stream_->OnStreamFrame(frame2);
758 EXPECT_TRUE(stream_->fin_received()); 759 EXPECT_TRUE(stream_->fin_received());
759 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); 760 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset());
760 } 761 }
761 762
762 } // namespace 763 } // namespace
763 } // namespace test 764 } // namespace test
764 } // namespace net 765 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698