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

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

Issue 667763003: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/quic/quic_crypto_server_stream.cc ('k') | net/quic/quic_fec_group.cc » ('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_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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 2 * kWindow / 3)); 396 2 * kWindow / 3));
397 stream_->OnStreamFrame(frame2); 397 stream_->OnStreamFrame(frame2);
398 EXPECT_EQ(kWindow, QuicFlowControllerPeer::ReceiveWindowSize( 398 EXPECT_EQ(kWindow, QuicFlowControllerPeer::ReceiveWindowSize(
399 stream_->flow_controller())); 399 stream_->flow_controller()));
400 } 400 }
401 401
402 TEST_P(QuicDataStreamTest, ConnectionFlowControlWindowUpdate) { 402 TEST_P(QuicDataStreamTest, ConnectionFlowControlWindowUpdate) {
403 // Tests that on receipt of data, the connection updates its receive window 403 // Tests that on receipt of data, the connection updates its receive window
404 // offset appropriately, and sends WINDOW_UPDATE frames when its receive 404 // offset appropriately, and sends WINDOW_UPDATE frames when its receive
405 // window drops too low. 405 // window drops too low.
406 if (GetParam() < QUIC_VERSION_19) {
407 return;
408 }
409 Initialize(kShouldProcessData); 406 Initialize(kShouldProcessData);
410 407
411 // Set a small flow control limit for streams and connection. 408 // Set a small flow control limit for streams and connection.
412 const uint64 kWindow = 36; 409 const uint64 kWindow = 36;
413 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 410 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(),
414 kWindow); 411 kWindow);
415 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(), 412 QuicFlowControllerPeer::SetMaxReceiveWindow(stream_->flow_controller(),
416 kWindow); 413 kWindow);
417 QuicFlowControllerPeer::SetReceiveWindowOffset(stream2_->flow_controller(), 414 QuicFlowControllerPeer::SetReceiveWindowOffset(stream2_->flow_controller(),
418 kWindow); 415 kWindow);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 QuicStreamFrame frame(kClientDataStreamId1, false, 0, MakeIOVector(body)); 474 QuicStreamFrame frame(kClientDataStreamId1, false, 0, MakeIOVector(body));
478 EXPECT_CALL(*connection_, 475 EXPECT_CALL(*connection_,
479 SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA)); 476 SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA));
480 stream_->OnStreamFrame(frame); 477 stream_->OnStreamFrame(frame);
481 } 478 }
482 479
483 TEST_P(QuicDataStreamTest, ConnectionFlowControlViolation) { 480 TEST_P(QuicDataStreamTest, ConnectionFlowControlViolation) {
484 // Tests that on if the peer sends too much data (i.e. violates the flow 481 // Tests that on if the peer sends too much data (i.e. violates the flow
485 // control protocol), at the connection level (rather than the stream level) 482 // control protocol), at the connection level (rather than the stream level)
486 // then we terminate the connection. 483 // then we terminate the connection.
487 if (GetParam() < QUIC_VERSION_19) {
488 return;
489 }
490 484
491 // Stream should not process data, so that data gets buffered in the 485 // Stream should not process data, so that data gets buffered in the
492 // sequencer, triggering flow control limits. 486 // sequencer, triggering flow control limits.
493 Initialize(!kShouldProcessData); 487 Initialize(!kShouldProcessData);
494 488
495 // Set a small flow control window on streams, and connection. 489 // Set a small flow control window on streams, and connection.
496 const uint64 kStreamWindow = 50; 490 const uint64 kStreamWindow = 50;
497 const uint64 kConnectionWindow = 10; 491 const uint64 kConnectionWindow = 10;
498 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(), 492 QuicFlowControllerPeer::SetReceiveWindowOffset(stream_->flow_controller(),
499 kStreamWindow); 493 kStreamWindow);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0); 528 EXPECT_CALL(*connection_, SendBlocked(kClientDataStreamId1)).Times(0);
535 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _)) 529 EXPECT_CALL(*session_, WritevData(kClientDataStreamId1, _, _, _, _, _))
536 .WillOnce(Return(QuicConsumedData(0, fin))); 530 .WillOnce(Return(QuicConsumedData(0, fin)));
537 531
538 stream_->WriteOrBufferData(body, fin, nullptr); 532 stream_->WriteOrBufferData(body, fin, nullptr);
539 } 533 }
540 534
541 } // namespace 535 } // namespace
542 } // namespace test 536 } // namespace test
543 } // namespace net 537 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_server_stream.cc ('k') | net/quic/quic_fec_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698