OLD | NEW |
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_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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 QuicWindowUpdateFrame window_update_3(stream_->id(), 9999); | 419 QuicWindowUpdateFrame window_update_3(stream_->id(), 9999); |
420 QuicWindowUpdateFrame window_update_4(stream_->id(), 5678); | 420 QuicWindowUpdateFrame window_update_4(stream_->id(), 5678); |
421 stream_->OnWindowUpdateFrame(window_update_2); | 421 stream_->OnWindowUpdateFrame(window_update_2); |
422 stream_->OnWindowUpdateFrame(window_update_3); | 422 stream_->OnWindowUpdateFrame(window_update_3); |
423 stream_->OnWindowUpdateFrame(window_update_4); | 423 stream_->OnWindowUpdateFrame(window_update_4); |
424 EXPECT_EQ( | 424 EXPECT_EQ( |
425 window_update_3.byte_offset, | 425 window_update_3.byte_offset, |
426 QuicFlowControllerPeer::SendWindowOffset(stream_->flow_controller())); | 426 QuicFlowControllerPeer::SendWindowOffset(stream_->flow_controller())); |
427 } | 427 } |
428 | 428 |
429 TEST_F(ReliableQuicStreamTest, StreamFlowControlShouldNotBlockInLessThanQ017) { | |
430 // TODO(rjshade): Remove this test when we no longer have any versions < | |
431 // QUIC_VERSION_17. | |
432 | |
433 // Make sure we are using a version which does not support flow control. | |
434 QuicVersion kTestQuicVersions[] = {QUIC_VERSION_16}; | |
435 QuicVersionVector versions; | |
436 for (size_t i = 0; i < arraysize(kTestQuicVersions); ++i) { | |
437 versions.push_back(kTestQuicVersions[i]); | |
438 } | |
439 set_supported_versions(versions); | |
440 | |
441 // Peer is not talking QUIC_VERSION_17 so assumes that it can send a zero | |
442 // length flow control receive window with no consequences. | |
443 set_initial_flow_control_window_bytes(0); | |
444 | |
445 Initialize(kShouldProcessData); | |
446 | |
447 // The stream should _not_ be flow control blocked, because we are not talking | |
448 // a version which has flow control enabled. | |
449 EXPECT_FALSE(stream_->flow_controller()->IsBlocked()); | |
450 } | |
451 | |
452 void SaveProxyAckNotifierDelegate( | 429 void SaveProxyAckNotifierDelegate( |
453 scoped_refptr<QuicAckNotifier::DelegateInterface>* delegate_out, | 430 scoped_refptr<QuicAckNotifier::DelegateInterface>* delegate_out, |
454 QuicAckNotifier::DelegateInterface* delegate) { | 431 QuicAckNotifier::DelegateInterface* delegate) { |
455 *delegate_out = delegate; | 432 *delegate_out = delegate; |
456 } | 433 } |
457 | 434 |
458 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithQuicAckNotifier) { | 435 TEST_F(ReliableQuicStreamTest, WriteOrBufferDataWithQuicAckNotifier) { |
459 Initialize(kShouldProcessData); | 436 Initialize(kShouldProcessData); |
460 | 437 |
461 scoped_refptr<MockAckNotifierDelegate> delegate( | 438 scoped_refptr<MockAckNotifierDelegate> delegate( |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 643 |
667 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset()); | 644 EXPECT_FALSE(stream_->HasFinalReceivedByteOffset()); |
668 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); | 645 QuicRstStreamFrame rst_frame(stream_->id(), QUIC_STREAM_CANCELLED, 1234); |
669 stream_->OnStreamReset(rst_frame); | 646 stream_->OnStreamReset(rst_frame); |
670 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); | 647 EXPECT_TRUE(stream_->HasFinalReceivedByteOffset()); |
671 } | 648 } |
672 | 649 |
673 } // namespace | 650 } // namespace |
674 } // namespace test | 651 } // namespace test |
675 } // namespace net | 652 } // namespace net |
OLD | NEW |