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

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

Issue 242583002: Disable QuicFlowController for QUIC versions < QUIC_VERSION_17 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/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_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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 private: 67 private:
68 bool should_process_data_; 68 bool should_process_data_;
69 string data_; 69 string data_;
70 }; 70 };
71 71
72 class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> { 72 class ReliableQuicStreamTest : public ::testing::TestWithParam<bool> {
73 public: 73 public:
74 ReliableQuicStreamTest() 74 ReliableQuicStreamTest()
75 : initial_flow_control_window_bytes_(kMaxPacketSize), 75 : initial_flow_control_window_bytes_(kMaxPacketSize),
76 zero_(QuicTime::Delta::Zero()) { 76 zero_(QuicTime::Delta::Zero()),
77 supported_versions_(QuicSupportedVersions()) {
77 headers_[":host"] = "www.google.com"; 78 headers_[":host"] = "www.google.com";
78 headers_[":path"] = "/index.hml"; 79 headers_[":path"] = "/index.hml";
79 headers_[":scheme"] = "https"; 80 headers_[":scheme"] = "https";
80 headers_["cookie"] = 81 headers_["cookie"] =
81 "__utma=208381060.1228362404.1372200928.1372200928.1372200928.1; " 82 "__utma=208381060.1228362404.1372200928.1372200928.1372200928.1; "
82 "__utmc=160408618; " 83 "__utmc=160408618; "
83 "GX=DQAAAOEAAACWJYdewdE9rIrW6qw3PtVi2-d729qaa-74KqOsM1NVQblK4VhX" 84 "GX=DQAAAOEAAACWJYdewdE9rIrW6qw3PtVi2-d729qaa-74KqOsM1NVQblK4VhX"
84 "hoALMsy6HOdDad2Sz0flUByv7etmo3mLMidGrBoljqO9hSVA40SLqpG_iuKKSHX" 85 "hoALMsy6HOdDad2Sz0flUByv7etmo3mLMidGrBoljqO9hSVA40SLqpG_iuKKSHX"
85 "RW3Np4bq0F0SDGDNsW0DSmTS9ufMRrlpARJDS7qAI6M3bghqJp4eABKZiRqebHT" 86 "RW3Np4bq0F0SDGDNsW0DSmTS9ufMRrlpARJDS7qAI6M3bghqJp4eABKZiRqebHT"
86 "pMU-RXvTI5D5oCF1vYxYofH_l1Kviuiy3oQ1kS1enqWgbhJ2t61_SNdv-1XJIS0" 87 "pMU-RXvTI5D5oCF1vYxYofH_l1Kviuiy3oQ1kS1enqWgbhJ2t61_SNdv-1XJIS0"
87 "O3YeHLmVCs62O6zp89QwakfAWK9d3IDQvVSJzCQsvxvNIvaZFa567MawWlXg0Rh" 88 "O3YeHLmVCs62O6zp89QwakfAWK9d3IDQvVSJzCQsvxvNIvaZFa567MawWlXg0Rh"
88 "1zFMi5vzcns38-8_Sns; " 89 "1zFMi5vzcns38-8_Sns; "
89 "GA=v*2%2Fmem*57968640*47239936%2Fmem*57968640*47114716%2Fno-nm-" 90 "GA=v*2%2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dH6iujMcHkbE5l18ehJDwTWmBKBzVD87naobhMMrF6VvnDGxQVGp9Ir_b"
98 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6" 99 "Rgj3RWUoPumQVCxtSOBdX0GlJOEcDTNCzQIm9BSfetog_eP_TfYubKudt5eMsXmN6"
99 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG" 100 "QnyXHeGeK2UINUzJ-D30AFcpqYgH9_1BvYSpi7fc7_ydBU8TaD8ZRxvtnzXqj0RfG"
100 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk" 101 "tuHghmv3aD-uzSYJ75XDdzKdizZ86IG6Fbn1XFhYZM-fbHhm3mVEXnyRW4ZuNOLFk"
101 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn" 102 "Fas6LMcVC6Q8QLlHYbXBpdNFuGbuZGUnav5C-2I_-46lL0NGg3GewxGKGHvHEfoyn"
102 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr" 103 "EFFlEYHsBQ98rXImL8ySDycdLEFvBPdtctPmWCfTxwmoSMLHU2SCVDhbqMWU5b0yr"
103 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo "; 104 "JBCScs_ejbKaqBDoB7ZGxTvqlrB__2ZmnHHjCr8RgMRtKNtIeuZAo ";
104 } 105 }
105 106
107 void set_supported_versions(const QuicVersionVector& versions) {
108 supported_versions_ = versions;
109 }
110
106 void Initialize(bool stream_should_process_data) { 111 void Initialize(bool stream_should_process_data) {
107 connection_ = new StrictMock<MockConnection>(kIsServer); 112 connection_ =
113 new StrictMock<MockConnection>(kIsServer, supported_versions_);
108 session_.reset(new StrictMock<MockSession>(connection_)); 114 session_.reset(new StrictMock<MockSession>(connection_));
109 115
110 // New streams rely on having the peer's flow control receive window 116 // New streams rely on having the peer's flow control receive window
111 // negotiated in the config. 117 // negotiated in the config.
112 session_->config()->set_peer_initial_flow_control_window_bytes( 118 session_->config()->set_peer_initial_flow_control_window_bytes(
113 initial_flow_control_window_bytes_); 119 initial_flow_control_window_bytes_);
114 120
115 stream_.reset(new TestStream(kStreamId, session_.get(), 121 stream_.reset(new TestStream(kStreamId, session_.get(),
116 stream_should_process_data)); 122 stream_should_process_data));
117 stream2_.reset(new TestStream(kStreamId + 2, session_.get(), 123 stream2_.reset(new TestStream(kStreamId + 2, session_.get(),
(...skipping 11 matching lines...) Expand all
129 135
130 protected: 136 protected:
131 MockConnection* connection_; 137 MockConnection* connection_;
132 scoped_ptr<MockSession> session_; 138 scoped_ptr<MockSession> session_;
133 scoped_ptr<TestStream> stream_; 139 scoped_ptr<TestStream> stream_;
134 scoped_ptr<TestStream> stream2_; 140 scoped_ptr<TestStream> stream2_;
135 SpdyHeaderBlock headers_; 141 SpdyHeaderBlock headers_;
136 QuicWriteBlockedList* write_blocked_list_; 142 QuicWriteBlockedList* write_blocked_list_;
137 uint32 initial_flow_control_window_bytes_; 143 uint32 initial_flow_control_window_bytes_;
138 QuicTime::Delta zero_; 144 QuicTime::Delta zero_;
145 QuicVersionVector supported_versions_;
139 }; 146 };
140 147
141 TEST_F(ReliableQuicStreamTest, WriteAllData) { 148 TEST_F(ReliableQuicStreamTest, WriteAllData) {
142 Initialize(kShouldProcessData); 149 Initialize(kShouldProcessData);
143 150
144 connection_->options()->max_packet_length = 151 connection_->options()->max_packet_length =
145 1 + QuicPacketCreator::StreamFramePacketOverhead( 152 1 + QuicPacketCreator::StreamFramePacketOverhead(
146 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion, 153 connection_->version(), PACKET_8BYTE_CONNECTION_ID, !kIncludeVersion,
147 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP); 154 PACKET_6BYTE_SEQUENCE_NUMBER, NOT_IN_FEC_GROUP);
148 EXPECT_CALL(*session_, WritevData(kStreamId, _, _, _, _)).WillOnce( 155 EXPECT_CALL(*session_, WritevData(kStreamId, _, _, _, _)).WillOnce(
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 QuicWindowUpdateFrame window_update_3(stream_->id(), 9999); 341 QuicWindowUpdateFrame window_update_3(stream_->id(), 9999);
335 QuicWindowUpdateFrame window_update_4(stream_->id(), 5678); 342 QuicWindowUpdateFrame window_update_4(stream_->id(), 5678);
336 stream_->OnWindowUpdateFrame(window_update_2); 343 stream_->OnWindowUpdateFrame(window_update_2);
337 stream_->OnWindowUpdateFrame(window_update_3); 344 stream_->OnWindowUpdateFrame(window_update_3);
338 stream_->OnWindowUpdateFrame(window_update_4); 345 stream_->OnWindowUpdateFrame(window_update_4);
339 EXPECT_EQ(window_update_3.byte_offset, 346 EXPECT_EQ(window_update_3.byte_offset,
340 QuicFlowControllerPeer::SendWindowOffset( 347 QuicFlowControllerPeer::SendWindowOffset(
341 stream_.get()->flow_controller())); 348 stream_.get()->flow_controller()));
342 } 349 }
343 350
351 TEST_F(ReliableQuicStreamTest, StreamFlowControlShouldNotBlockInLessThanQ017) {
352 // TODO(rjshade): Remove this test when we no longer have any versions <
353 // QUIC_VERSION_17.
354 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control, true);
355
356 // Make sure we are using a version which does not support flow control.
357 const QuicVersionVector versions = {QUIC_VERSION_16};
358 set_supported_versions(versions);
359
360 // Peer is not talking QUIC_VERSION_17 so assumes that it can send a zero
361 // length flow control receive window with no consequences.
362 set_initial_flow_control_window_bytes(0);
363
364 Initialize(kShouldProcessData);
365
366 // The stream should _not_ be flow control blocked, because we are not talking
367 // a version which has flow control enabled.
368 EXPECT_FALSE(stream_->flow_controller()->IsBlocked());
369 }
370
344 void SaveProxyAckNotifierDelegate( 371 void SaveProxyAckNotifierDelegate(
345 scoped_refptr<QuicAckNotifier::DelegateInterface>* delegate_out, 372 scoped_refptr<QuicAckNotifier::DelegateInterface>* delegate_out,
346 QuicAckNotifier::DelegateInterface* delegate) { 373 QuicAckNotifier::DelegateInterface* delegate) {
347 *delegate_out = delegate; 374 *delegate_out = delegate;
348 } 375 }
349 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithQuicAckNotifier) { 376 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithQuicAckNotifier) {
350 Initialize(kShouldProcessData); 377 Initialize(kShouldProcessData);
351 378
352 scoped_refptr<MockAckNotifierDelegate> delegate( 379 scoped_refptr<MockAckNotifierDelegate> delegate(
353 new StrictMock<MockAckNotifierDelegate>); 380 new StrictMock<MockAckNotifierDelegate>);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 536
510 // Handle the acks. 537 // Handle the acks.
511 proxy_delegate->OnAckNotification(1, 2, 3, 4, zero_); 538 proxy_delegate->OnAckNotification(1, 2, 3, 4, zero_);
512 EXPECT_CALL(*delegate, OnAckNotification(11, 22, 33, 44, zero_)); 539 EXPECT_CALL(*delegate, OnAckNotification(11, 22, 33, 44, zero_));
513 proxy_delegate->OnAckNotification(10, 20, 30, 40, zero_); 540 proxy_delegate->OnAckNotification(10, 20, 30, 40, zero_);
514 } 541 }
515 542
516 } // namespace 543 } // namespace
517 } // namespace test 544 } // namespace test
518 } // namespace net 545 } // 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