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

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

Issue 346303006: Removing deprecated flag FLAGS_enable_quic_stream_flow_control_2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted quic_flags.h include Created 6 years, 5 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_crypto_stream_test.cc ('k') | net/quic/quic_dispatcher.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/quic_data_stream.h" 5 #include "net/quic/quic_data_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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 ASSERT_EQ(data.data()[i + 1], buffer2[0]) << i; 278 ASSERT_EQ(data.data()[i + 1], buffer2[0]) << i;
279 } 279 }
280 } 280 }
281 281
282 TEST_P(QuicDataStreamTest, StreamFlowControlBlocked) { 282 TEST_P(QuicDataStreamTest, StreamFlowControlBlocked) {
283 // Tests that we send a BLOCKED frame to the peer when we attempt to write, 283 // Tests that we send a BLOCKED frame to the peer when we attempt to write,
284 // but are flow control blocked. 284 // but are flow control blocked.
285 if (GetParam() < QUIC_VERSION_17) { 285 if (GetParam() < QUIC_VERSION_17) {
286 return; 286 return;
287 } 287 }
288 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true);
289 288
290 Initialize(kShouldProcessData); 289 Initialize(kShouldProcessData);
291 290
292 // Set a small flow control limit. 291 // Set a small flow control limit.
293 const uint64 kWindow = 36; 292 const uint64 kWindow = 36;
294 QuicFlowControllerPeer::SetSendWindowOffset(stream_->flow_controller(), 293 QuicFlowControllerPeer::SetSendWindowOffset(stream_->flow_controller(),
295 kWindow); 294 kWindow);
296 EXPECT_EQ(kWindow, QuicFlowControllerPeer::SendWindowOffset( 295 EXPECT_EQ(kWindow, QuicFlowControllerPeer::SendWindowOffset(
297 stream_->flow_controller())); 296 stream_->flow_controller()));
298 297
(...skipping 18 matching lines...) Expand all
317 } 316 }
318 317
319 TEST_P(QuicDataStreamTest, StreamFlowControlNoWindowUpdateIfNotConsumed) { 318 TEST_P(QuicDataStreamTest, StreamFlowControlNoWindowUpdateIfNotConsumed) {
320 // The flow control receive window decreases whenever we add new bytes to the 319 // The flow control receive window decreases whenever we add new bytes to the
321 // sequencer, whether they are consumed immediately or buffered. However we 320 // sequencer, whether they are consumed immediately or buffered. However we
322 // only send WINDOW_UPDATE frames based on increasing number of bytes 321 // only send WINDOW_UPDATE frames based on increasing number of bytes
323 // consumed. 322 // consumed.
324 if (GetParam() < QUIC_VERSION_17) { 323 if (GetParam() < QUIC_VERSION_17) {
325 return; 324 return;
326 } 325 }
327 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true);
328 326
329 // Don't process data - it will be buffered instead. 327 // Don't process data - it will be buffered instead.
330 Initialize(!kShouldProcessData); 328 Initialize(!kShouldProcessData);
331 329
332 // Expect no WINDOW_UPDATE frames to be sent. 330 // Expect no WINDOW_UPDATE frames to be sent.
333 EXPECT_CALL(*connection_, SendWindowUpdate(_, _)).Times(0); 331 EXPECT_CALL(*connection_, SendWindowUpdate(_, _)).Times(0);
334 332
335 // Set a small flow control receive window. 333 // Set a small flow control receive window.
336 const uint64 kWindow = 36; 334 const uint64 kWindow = 36;
337 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 335 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(),
(...skipping 27 matching lines...) Expand all
365 QuicFlowControllerPeer::ReceiveWindowSize(stream_->flow_controller())); 363 QuicFlowControllerPeer::ReceiveWindowSize(stream_->flow_controller()));
366 } 364 }
367 365
368 TEST_P(QuicDataStreamTest, StreamFlowControlWindowUpdate) { 366 TEST_P(QuicDataStreamTest, StreamFlowControlWindowUpdate) {
369 // Tests that on receipt of data, the stream updates its receive window offset 367 // Tests that on receipt of data, the stream updates its receive window offset
370 // appropriately, and sends WINDOW_UPDATE frames when its receive window drops 368 // appropriately, and sends WINDOW_UPDATE frames when its receive window drops
371 // too low. 369 // too low.
372 if (GetParam() < QUIC_VERSION_17) { 370 if (GetParam() < QUIC_VERSION_17) {
373 return; 371 return;
374 } 372 }
375 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true);
376 373
377 Initialize(kShouldProcessData); 374 Initialize(kShouldProcessData);
378 375
379 // Set a small flow control limit. 376 // Set a small flow control limit.
380 const uint64 kWindow = 36; 377 const uint64 kWindow = 36;
381 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 378 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(),
382 kWindow); 379 kWindow);
383 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(), 380 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(),
384 kWindow); 381 kWindow);
385 EXPECT_EQ(kWindow, QuicFlowControllerPeer::ReceiveWindowOffset( 382 EXPECT_EQ(kWindow, QuicFlowControllerPeer::ReceiveWindowOffset(
(...skipping 28 matching lines...) Expand all
414 stream_->flow_controller())); 411 stream_->flow_controller()));
415 } 412 }
416 413
417 TEST_P(QuicDataStreamTest, ConnectionFlowControlWindowUpdate) { 414 TEST_P(QuicDataStreamTest, ConnectionFlowControlWindowUpdate) {
418 // Tests that on receipt of data, the connection updates its receive window 415 // Tests that on receipt of data, the connection updates its receive window
419 // offset appropriately, and sends WINDOW_UPDATE frames when its receive 416 // offset appropriately, and sends WINDOW_UPDATE frames when its receive
420 // window drops too low. 417 // window drops too low.
421 if (GetParam() < QUIC_VERSION_19) { 418 if (GetParam() < QUIC_VERSION_19) {
422 return; 419 return;
423 } 420 }
424 ValueRestore<bool> old_flag2(&FLAGS_enable_quic_stream_flow_control_2, true);
425 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, 421 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2,
426 true); 422 true);
427 423
428 Initialize(kShouldProcessData); 424 Initialize(kShouldProcessData);
429 425
430 // Set a small flow control limit for streams and connection. 426 // Set a small flow control limit for streams and connection.
431 const uint64 kWindow = 36; 427 const uint64 kWindow = 36;
432 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 428 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(),
433 kWindow); 429 kWindow);
434 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(), 430 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 MakeIOVector("a")); 467 MakeIOVector("a"));
472 stream_->OnStreamFrame(frame3); 468 stream_->OnStreamFrame(frame3);
473 } 469 }
474 470
475 TEST_P(QuicDataStreamTest, StreamFlowControlViolation) { 471 TEST_P(QuicDataStreamTest, StreamFlowControlViolation) {
476 // Tests that on if the peer sends too much data (i.e. violates the flow 472 // Tests that on if the peer sends too much data (i.e. violates the flow
477 // control protocol), then we terminate the connection. 473 // control protocol), then we terminate the connection.
478 if (GetParam() < QUIC_VERSION_17) { 474 if (GetParam() < QUIC_VERSION_17) {
479 return; 475 return;
480 } 476 }
481 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true);
482 477
483 // Stream should not process data, so that data gets buffered in the 478 // Stream should not process data, so that data gets buffered in the
484 // sequencer, triggering flow control limits. 479 // sequencer, triggering flow control limits.
485 Initialize(!kShouldProcessData); 480 Initialize(!kShouldProcessData);
486 481
487 // Set a small flow control limit. 482 // Set a small flow control limit.
488 const uint64 kWindow = 50; 483 const uint64 kWindow = 50;
489 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 484 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(),
490 kWindow); 485 kWindow);
491 486
(...skipping 11 matching lines...) Expand all
503 stream_->OnStreamFrame(frame); 498 stream_->OnStreamFrame(frame);
504 } 499 }
505 500
506 TEST_P(QuicDataStreamTest, ConnectionFlowControlViolation) { 501 TEST_P(QuicDataStreamTest, ConnectionFlowControlViolation) {
507 // Tests that on if the peer sends too much data (i.e. violates the flow 502 // Tests that on if the peer sends too much data (i.e. violates the flow
508 // control protocol), at the connection level (rather than the stream level) 503 // control protocol), at the connection level (rather than the stream level)
509 // then we terminate the connection. 504 // then we terminate the connection.
510 if (GetParam() < QUIC_VERSION_19) { 505 if (GetParam() < QUIC_VERSION_19) {
511 return; 506 return;
512 } 507 }
513 ValueRestore<bool> old_flag2(&FLAGS_enable_quic_stream_flow_control_2, true);
514 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, 508 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2,
515 true); 509 true);
516 510
517 // Stream should not process data, so that data gets buffered in the 511 // Stream should not process data, so that data gets buffered in the
518 // sequencer, triggering flow control limits. 512 // sequencer, triggering flow control limits.
519 Initialize(!kShouldProcessData); 513 Initialize(!kShouldProcessData);
520 514
521 // Set a small flow control window on streams, and connection. 515 // Set a small flow control window on streams, and connection.
522 const uint64 kStreamWindow = 50; 516 const uint64 kStreamWindow = 50;
523 const uint64 kConnectionWindow = 10; 517 const uint64 kConnectionWindow = 10;
(...skipping 17 matching lines...) Expand all
541 SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA)); 535 SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA));
542 stream_->OnStreamFrame(frame); 536 stream_->OnStreamFrame(frame);
543 } 537 }
544 538
545 TEST_P(QuicDataStreamTest, StreamFlowControlFinNotBlocked) { 539 TEST_P(QuicDataStreamTest, StreamFlowControlFinNotBlocked) {
546 // An attempt to write a FIN with no data should not be flow control blocked, 540 // An attempt to write a FIN with no data should not be flow control blocked,
547 // even if the send window is 0. 541 // even if the send window is 0.
548 if (GetParam() < QUIC_VERSION_17) { 542 if (GetParam() < QUIC_VERSION_17) {
549 return; 543 return;
550 } 544 }
551 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true);
552 545
553 Initialize(kShouldProcessData); 546 Initialize(kShouldProcessData);
554 547
555 // Set a flow control limit of zero. 548 // Set a flow control limit of zero.
556 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 0); 549 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 0);
557 EXPECT_EQ(0u, QuicFlowControllerPeer::ReceiveWindowOffset( 550 EXPECT_EQ(0u, QuicFlowControllerPeer::ReceiveWindowOffset(
558 stream_->flow_controller())); 551 stream_->flow_controller()));
559 552
560 // Send a frame with a FIN but no data. This should not be blocked. 553 // Send a frame with a FIN but no data. This should not be blocked.
561 string body = ""; 554 string body = "";
562 bool fin = true; 555 bool fin = true;
563 556
564 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); 557 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0);
565 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) 558 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _))
566 .WillOnce(Return(QuicConsumedData(0, fin))); 559 .WillOnce(Return(QuicConsumedData(0, fin)));
567 560
568 stream_->WriteOrBufferData(body, fin, NULL); 561 stream_->WriteOrBufferData(body, fin, NULL);
569 } 562 }
570 563
571 } // namespace 564 } // namespace
572 } // namespace test 565 } // namespace test
573 } // namespace net 566 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_stream_test.cc ('k') | net/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698