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

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

Issue 355573007: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added NET_EXPORT_PRIVATE for ContainsQuicTag Created 6 years, 5 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_unacked_packet_map.h » ('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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 624
625 // Processing of second invalid stream reset should not result in the 625 // Processing of second invalid stream reset should not result in the
626 // connection being closed for a second time. 626 // connection being closed for a second time.
627 QuicRstStreamFrame rst2(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0); 627 QuicRstStreamFrame rst2(kLargeInvalidStreamId, QUIC_STREAM_NO_ERROR, 0);
628 session_.OnRstStream(rst2); 628 session_.OnRstStream(rst2);
629 } 629 }
630 630
631 TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedStream) { 631 TEST_P(QuicSessionTest, HandshakeUnblocksFlowControlBlockedStream) {
632 // Test that if a stream is flow control blocked, then on receipt of the SHLO 632 // Test that if a stream is flow control blocked, then on receipt of the SHLO
633 // containing a suitable send window offset, the stream becomes unblocked. 633 // containing a suitable send window offset, the stream becomes unblocked.
634 if (version() < QUIC_VERSION_17) { 634 if (version() <= QUIC_VERSION_16) {
635 return; 635 return;
636 } 636 }
637 637
638 // Ensure that Writev consumes all the data it is given (simulate no socket 638 // Ensure that Writev consumes all the data it is given (simulate no socket
639 // blocking). 639 // blocking).
640 session_.set_writev_consumes_all_data(true); 640 session_.set_writev_consumes_all_data(true);
641 641
642 // Create a stream, and send enough data to make it flow control blocked. 642 // Create a stream, and send enough data to make it flow control blocked.
643 TestStream* stream2 = session_.CreateOutgoingDataStream(); 643 TestStream* stream2 = session_.CreateOutgoingDataStream();
644 string body(kDefaultFlowControlSendWindow, '.'); 644 string body(kDefaultFlowControlSendWindow, '.');
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 857
858 EXPECT_EQ(kInitialConnectionBytesConsumed + kByteOffset, 858 EXPECT_EQ(kInitialConnectionBytesConsumed + kByteOffset,
859 session_.flow_controller()->bytes_consumed()); 859 session_.flow_controller()->bytes_consumed());
860 EXPECT_EQ(kInitialConnectionHighestReceivedOffset + kByteOffset, 860 EXPECT_EQ(kInitialConnectionHighestReceivedOffset + kByteOffset,
861 session_.flow_controller()->highest_received_byte_offset()); 861 session_.flow_controller()->highest_received_byte_offset());
862 } 862 }
863 863
864 TEST_P(QuicSessionTest, FlowControlWithInvalidFinalOffset) { 864 TEST_P(QuicSessionTest, FlowControlWithInvalidFinalOffset) {
865 // Test that if we receive a stream RST with a highest byte offset that 865 // Test that if we receive a stream RST with a highest byte offset that
866 // violates flow control, that we close the connection. 866 // violates flow control, that we close the connection.
867 if (version() < QUIC_VERSION_17) { 867 if (version() <= QUIC_VERSION_16) {
868 return; 868 return;
869 } 869 }
870 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, 870 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2,
871 true); 871 true);
872 872
873 const uint64 kLargeOffset = kInitialSessionFlowControlWindowForTest + 1; 873 const uint64 kLargeOffset = kInitialSessionFlowControlWindowForTest + 1;
874 EXPECT_CALL(*connection_, 874 EXPECT_CALL(*connection_,
875 SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA)) 875 SendConnectionClose(QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA))
876 .Times(2); 876 .Times(2);
877 877
(...skipping 19 matching lines...) Expand all
897 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2, 897 ValueRestore<bool> old_flag(&FLAGS_enable_quic_connection_flow_control_2,
898 true); 898 true);
899 // Test that after successful version negotiation, flow control is disabled 899 // Test that after successful version negotiation, flow control is disabled
900 // appropriately at both the connection and stream level. 900 // appropriately at both the connection and stream level.
901 901
902 // Initially both stream and connection flow control are enabled. 902 // Initially both stream and connection flow control are enabled.
903 TestStream* stream = session_.CreateOutgoingDataStream(); 903 TestStream* stream = session_.CreateOutgoingDataStream();
904 EXPECT_TRUE(stream->flow_controller()->IsEnabled()); 904 EXPECT_TRUE(stream->flow_controller()->IsEnabled());
905 EXPECT_TRUE(session_.flow_controller()->IsEnabled()); 905 EXPECT_TRUE(session_.flow_controller()->IsEnabled());
906 906
907 // Version 17 implies that stream flow control is enabled, but connection 907 // Version 18 implies that stream flow control is enabled, but connection
908 // level is disabled. 908 // level is disabled.
909 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_17); 909 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_18);
910 EXPECT_FALSE(session_.flow_controller()->IsEnabled()); 910 EXPECT_FALSE(session_.flow_controller()->IsEnabled());
911 EXPECT_TRUE(stream->flow_controller()->IsEnabled()); 911 EXPECT_TRUE(stream->flow_controller()->IsEnabled());
912 912
913 // Version 16 means all flow control is disabled. 913 // Version 16 means all flow control is disabled.
914 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_16); 914 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_16);
915 EXPECT_FALSE(session_.flow_controller()->IsEnabled()); 915 EXPECT_FALSE(session_.flow_controller()->IsEnabled());
916 EXPECT_FALSE(stream->flow_controller()->IsEnabled()); 916 EXPECT_FALSE(stream->flow_controller()->IsEnabled());
917 } 917 }
918 918
919 } // namespace 919 } // namespace
920 } // namespace test 920 } // namespace test
921 } // namespace net 921 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_unacked_packet_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698