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

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

Issue 242453002: Pull out flow control functionality from ReliableQuicStream into a new (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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_session.cc ('k') | net/quic/quic_stream_sequencer.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 (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/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 573 }
574 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control, true); 574 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control, true);
575 575
576 // Ensure that Writev consumes all the data it is given (simulate no socket 576 // Ensure that Writev consumes all the data it is given (simulate no socket
577 // blocking). 577 // blocking).
578 session_.set_writev_consumes_all_data(true); 578 session_.set_writev_consumes_all_data(true);
579 579
580 // Create a stream, and send enough data to make it flow control blocked. 580 // Create a stream, and send enough data to make it flow control blocked.
581 TestStream* stream2 = session_.CreateOutgoingDataStream(); 581 TestStream* stream2 = session_.CreateOutgoingDataStream();
582 string body(kDefaultFlowControlSendWindow, '.'); 582 string body(kDefaultFlowControlSendWindow, '.');
583 EXPECT_FALSE(stream2->IsFlowControlBlocked()); 583 EXPECT_FALSE(stream2->flow_controller()->IsBlocked());
584 stream2->SendBody(body, false); 584 stream2->SendBody(body, false);
585 EXPECT_TRUE(stream2->IsFlowControlBlocked()); 585 EXPECT_TRUE(stream2->flow_controller()->IsBlocked());
586 586
587 // Now complete the crypto handshake, resulting in an increased flow control 587 // Now complete the crypto handshake, resulting in an increased flow control
588 // send window. 588 // send window.
589 CryptoHandshakeMessage msg; 589 CryptoHandshakeMessage msg;
590 session_.GetCryptoStream()->OnHandshakeMessage(msg); 590 session_.GetCryptoStream()->OnHandshakeMessage(msg);
591 591
592 // Stream is now unblocked. 592 // Stream is now unblocked.
593 EXPECT_FALSE(stream2->IsFlowControlBlocked()); 593 EXPECT_FALSE(stream2->flow_controller()->IsBlocked());
594 } 594 }
595 595
596 TEST_P(QuicSessionTest, InvalidFlowControlWindowInHandshake) { 596 TEST_P(QuicSessionTest, InvalidFlowControlWindowInHandshake) {
597 // Test that receipt of an invalid (< default) flow control window from peer 597 // Test that receipt of an invalid (< default) flow control window from peer
598 // results in the connection being torn down. 598 // results in the connection being torn down.
599 if (version() < QUIC_VERSION_17) { 599 if (version() < QUIC_VERSION_17) {
600 return; 600 return;
601 } 601 }
602 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control, true); 602 ValueRestore<bool> old_flag(&FLAGS_enable_quic_stream_flow_control, true);
603 603
(...skipping 10 matching lines...) Expand all
614 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_FLOW_CONTROL_ERROR)); 614 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_FLOW_CONTROL_ERROR));
615 string expected_error("Peer sent us an invalid flow control send window: "); 615 string expected_error("Peer sent us an invalid flow control send window: ");
616 expected_error.append(reinterpret_cast<const char*>(&kInvalidWindow), 616 expected_error.append(reinterpret_cast<const char*>(&kInvalidWindow),
617 sizeof(kInvalidWindow)); 617 sizeof(kInvalidWindow));
618 EXPECT_DFATAL(session_.OnConfigNegotiated(), expected_error); 618 EXPECT_DFATAL(session_.OnConfigNegotiated(), expected_error);
619 } 619 }
620 620
621 } // namespace 621 } // namespace
622 } // namespace test 622 } // namespace test
623 } // namespace net 623 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_stream_sequencer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698