OLD | NEW |
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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 | 416 |
417 TEST_P(QuicDataStreamTest, ConnectionFlowControlWindowUpdate) { | 417 TEST_P(QuicDataStreamTest, ConnectionFlowControlWindowUpdate) { |
418 // Tests that on receipt of data, the connection updates its receive window | 418 // Tests that on receipt of data, the connection updates its receive window |
419 // offset appropriately, and sends WINDOW_UPDATE frames when its receive | 419 // offset appropriately, and sends WINDOW_UPDATE frames when its receive |
420 // window drops too low. | 420 // window drops too low. |
421 if (GetParam() < QUIC_VERSION_19) { | 421 if (GetParam() < QUIC_VERSION_19) { |
422 return; | 422 return; |
423 } | 423 } |
424 ValueRestore<bool> old_flag2(&FLAGS_enable_quic_stream_flow_control_2, true); | 424 ValueRestore<bool> old_flag2(&FLAGS_enable_quic_stream_flow_control_2, true); |
425 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control, true); | 425 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, |
| 426 true); |
426 | 427 |
427 Initialize(kShouldProcessData); | 428 Initialize(kShouldProcessData); |
428 | 429 |
429 // Set a small flow control limit for streams and connection. | 430 // Set a small flow control limit for streams and connection. |
430 const uint64 kWindow = 36; | 431 const uint64 kWindow = 36; |
431 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), | 432 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), |
432 kWindow); | 433 kWindow); |
433 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(), | 434 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(), |
434 kWindow); | 435 kWindow); |
435 QuicFlowControllerPeer::SetReceiveWindowOffset(stream2_->flow_controller(), | 436 QuicFlowControllerPeer::SetReceiveWindowOffset(stream2_->flow_controller(), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 504 } |
504 | 505 |
505 TEST_P(QuicDataStreamTest, ConnectionFlowControlViolation) { | 506 TEST_P(QuicDataStreamTest, ConnectionFlowControlViolation) { |
506 // Tests that on if the peer sends too much data (i.e. violates the flow | 507 // Tests that on if the peer sends too much data (i.e. violates the flow |
507 // control protocol), at the connection level (rather than the stream level) | 508 // control protocol), at the connection level (rather than the stream level) |
508 // then we terminate the connection. | 509 // then we terminate the connection. |
509 if (GetParam() < QUIC_VERSION_19) { | 510 if (GetParam() < QUIC_VERSION_19) { |
510 return; | 511 return; |
511 } | 512 } |
512 ValueRestore<bool> old_flag2(&FLAGS_enable_quic_stream_flow_control_2, true); | 513 ValueRestore<bool> old_flag2(&FLAGS_enable_quic_stream_flow_control_2, true); |
513 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control, true); | 514 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, |
| 515 true); |
514 | 516 |
515 // Stream should not process data, so that data gets buffered in the | 517 // Stream should not process data, so that data gets buffered in the |
516 // sequencer, triggering flow control limits. | 518 // sequencer, triggering flow control limits. |
517 Initialize(!kShouldProcessData); | 519 Initialize(!kShouldProcessData); |
518 | 520 |
519 // Set a small flow control window on streams, and connection. | 521 // Set a small flow control window on streams, and connection. |
520 const uint64 kStreamWindow = 50; | 522 const uint64 kStreamWindow = 50; |
521 const uint64 kConnectionWindow = 10; | 523 const uint64 kConnectionWindow = 10; |
522 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), | 524 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), |
523 kStreamWindow); | 525 kStreamWindow); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); | 564 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); |
563 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) | 565 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) |
564 .WillOnce(Return(QuicConsumedData(0, fin))); | 566 .WillOnce(Return(QuicConsumedData(0, fin))); |
565 | 567 |
566 stream_->WriteOrBufferData(body, fin, NULL); | 568 stream_->WriteOrBufferData(body, fin, NULL); |
567 } | 569 } |
568 | 570 |
569 } // namespace | 571 } // namespace |
570 } // namespace test | 572 } // namespace test |
571 } // namespace net | 573 } // namespace net |
OLD | NEW |