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_flags.h" | 9 #include "net/quic/quic_flags.h" |
10 #include "net/quic/quic_utils.h" | 10 #include "net/quic/quic_utils.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 TEST_F(ReliableQuicStreamTest, StreamFlowControlMultipleWindowUpdates) { | 318 TEST_F(ReliableQuicStreamTest, StreamFlowControlMultipleWindowUpdates) { |
319 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true); | 319 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true); |
320 set_initial_flow_control_window_bytes(1000); | 320 set_initial_flow_control_window_bytes(1000); |
321 | 321 |
322 Initialize(kShouldProcessData); | 322 Initialize(kShouldProcessData); |
323 | 323 |
324 // If we receive multiple WINDOW_UPDATES (potentially out of order), then we | 324 // If we receive multiple WINDOW_UPDATES (potentially out of order), then we |
325 // want to make sure we latch the largest offset we see. | 325 // want to make sure we latch the largest offset we see. |
326 | 326 |
327 // Initially should be default. | 327 // Initially should be default. |
328 EXPECT_EQ(initial_flow_control_window_bytes_, | 328 EXPECT_EQ( |
329 QuicFlowControllerPeer::SendWindowOffset( | 329 initial_flow_control_window_bytes_, |
330 stream_.get()->flow_controller())); | 330 QuicFlowControllerPeer::SendWindowOffset(stream_->flow_controller())); |
331 | 331 |
332 // Check a single WINDOW_UPDATE results in correct offset. | 332 // Check a single WINDOW_UPDATE results in correct offset. |
333 QuicWindowUpdateFrame window_update_1(stream_->id(), 1234); | 333 QuicWindowUpdateFrame window_update_1(stream_->id(), 1234); |
334 stream_->OnWindowUpdateFrame(window_update_1); | 334 stream_->OnWindowUpdateFrame(window_update_1); |
335 EXPECT_EQ(window_update_1.byte_offset, | 335 EXPECT_EQ( |
336 QuicFlowControllerPeer::SendWindowOffset( | 336 window_update_1.byte_offset, |
337 stream_.get()->flow_controller())); | 337 QuicFlowControllerPeer::SendWindowOffset(stream_->flow_controller())); |
338 | 338 |
339 // Now send a few more WINDOW_UPDATES and make sure that only the largest is | 339 // Now send a few more WINDOW_UPDATES and make sure that only the largest is |
340 // remembered. | 340 // remembered. |
341 QuicWindowUpdateFrame window_update_2(stream_->id(), 1); | 341 QuicWindowUpdateFrame window_update_2(stream_->id(), 1); |
342 QuicWindowUpdateFrame window_update_3(stream_->id(), 9999); | 342 QuicWindowUpdateFrame window_update_3(stream_->id(), 9999); |
343 QuicWindowUpdateFrame window_update_4(stream_->id(), 5678); | 343 QuicWindowUpdateFrame window_update_4(stream_->id(), 5678); |
344 stream_->OnWindowUpdateFrame(window_update_2); | 344 stream_->OnWindowUpdateFrame(window_update_2); |
345 stream_->OnWindowUpdateFrame(window_update_3); | 345 stream_->OnWindowUpdateFrame(window_update_3); |
346 stream_->OnWindowUpdateFrame(window_update_4); | 346 stream_->OnWindowUpdateFrame(window_update_4); |
347 EXPECT_EQ(window_update_3.byte_offset, | 347 EXPECT_EQ( |
348 QuicFlowControllerPeer::SendWindowOffset( | 348 window_update_3.byte_offset, |
349 stream_.get()->flow_controller())); | 349 QuicFlowControllerPeer::SendWindowOffset(stream_->flow_controller())); |
350 } | 350 } |
351 | 351 |
352 TEST_F(ReliableQuicStreamTest, StreamFlowControlShouldNotBlockInLessThanQ017) { | 352 TEST_F(ReliableQuicStreamTest, StreamFlowControlShouldNotBlockInLessThanQ017) { |
353 // TODO(rjshade): Remove this test when we no longer have any versions < | 353 // TODO(rjshade): Remove this test when we no longer have any versions < |
354 // QUIC_VERSION_17. | 354 // QUIC_VERSION_17. |
355 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true); | 355 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control_2, true); |
356 | 356 |
357 // Make sure we are using a version which does not support flow control. | 357 // Make sure we are using a version which does not support flow control. |
358 QuicVersion kTestQuicVersions[] = {QUIC_VERSION_16}; | 358 QuicVersion kTestQuicVersions[] = {QUIC_VERSION_16}; |
359 QuicVersionVector versions; | 359 QuicVersionVector versions; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 548 |
549 // Handle the acks. | 549 // Handle the acks. |
550 proxy_delegate->OnAckNotification(1, 2, 3, 4, zero_); | 550 proxy_delegate->OnAckNotification(1, 2, 3, 4, zero_); |
551 EXPECT_CALL(*delegate, OnAckNotification(11, 22, 33, 44, zero_)); | 551 EXPECT_CALL(*delegate, OnAckNotification(11, 22, 33, 44, zero_)); |
552 proxy_delegate->OnAckNotification(10, 20, 30, 40, zero_); | 552 proxy_delegate->OnAckNotification(10, 20, 30, 40, zero_); |
553 } | 553 } |
554 | 554 |
555 } // namespace | 555 } // namespace |
556 } // namespace test | 556 } // namespace test |
557 } // namespace net | 557 } // namespace net |
OLD | NEW |