| 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/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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_18); | 898 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_18); |
| 899 EXPECT_FALSE(session_.flow_controller()->IsEnabled()); | 899 EXPECT_FALSE(session_.flow_controller()->IsEnabled()); |
| 900 EXPECT_TRUE(stream->flow_controller()->IsEnabled()); | 900 EXPECT_TRUE(stream->flow_controller()->IsEnabled()); |
| 901 | 901 |
| 902 // Version 16 means all flow control is disabled. | 902 // Version 16 means all flow control is disabled. |
| 903 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_16); | 903 session_.OnSuccessfulVersionNegotiation(QUIC_VERSION_16); |
| 904 EXPECT_FALSE(session_.flow_controller()->IsEnabled()); | 904 EXPECT_FALSE(session_.flow_controller()->IsEnabled()); |
| 905 EXPECT_FALSE(stream->flow_controller()->IsEnabled()); | 905 EXPECT_FALSE(stream->flow_controller()->IsEnabled()); |
| 906 } | 906 } |
| 907 | 907 |
| 908 TEST_P(QuicSessionTest, WindowUpdateUnblocksHeadersStream) { |
| 909 // Test that a flow control blocked headers stream gets unblocked on recipt of |
| 910 // a WINDOW_UPDATE frame. Regression test for b/17413860. |
| 911 if (version() < QUIC_VERSION_21) { |
| 912 return; |
| 913 } |
| 914 |
| 915 // Set the headers stream to be flow control blocked. |
| 916 QuicHeadersStream* headers_stream = |
| 917 QuicSessionPeer::GetHeadersStream(&session_); |
| 918 QuicFlowControllerPeer::SetSendWindowOffset(headers_stream->flow_controller(), |
| 919 0); |
| 920 EXPECT_TRUE(headers_stream->flow_controller()->IsBlocked()); |
| 921 |
| 922 // Unblock the headers stream by supplying a WINDOW_UPDATE. |
| 923 QuicWindowUpdateFrame window_update_frame(headers_stream->id(), |
| 924 2 * kDefaultFlowControlSendWindow); |
| 925 vector<QuicWindowUpdateFrame> frames; |
| 926 frames.push_back(window_update_frame); |
| 927 session_.OnWindowUpdateFrames(frames); |
| 928 EXPECT_FALSE(headers_stream->flow_controller()->IsBlocked()); |
| 929 } |
| 930 |
| 908 TEST_P(QuicSessionTest, TooManyUnfinishedStreamsCauseConnectionClose) { | 931 TEST_P(QuicSessionTest, TooManyUnfinishedStreamsCauseConnectionClose) { |
| 909 if (version() < QUIC_VERSION_18) { | 932 if (version() < QUIC_VERSION_18) { |
| 910 return; | 933 return; |
| 911 } | 934 } |
| 912 // If a buggy/malicious peer creates too many streams that are not ended with | 935 // If a buggy/malicious peer creates too many streams that are not ended with |
| 913 // a FIN or RST then we send a connection close. | 936 // a FIN or RST then we send a connection close. |
| 914 ValueRestore<bool> old_flag(&FLAGS_close_quic_connection_unfinished_streams, | 937 ValueRestore<bool> old_flag(&FLAGS_close_quic_connection_unfinished_streams, |
| 915 true); | 938 true); |
| 916 | 939 |
| 917 EXPECT_CALL(*connection_, | 940 EXPECT_CALL(*connection_, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 930 frames.push_back(data1); | 953 frames.push_back(data1); |
| 931 session_.OnStreamFrames(frames); | 954 session_.OnStreamFrames(frames); |
| 932 EXPECT_EQ(1u, session_.GetNumOpenStreams()); | 955 EXPECT_EQ(1u, session_.GetNumOpenStreams()); |
| 933 session_.CloseStream(i); | 956 session_.CloseStream(i); |
| 934 } | 957 } |
| 935 } | 958 } |
| 936 | 959 |
| 937 } // namespace | 960 } // namespace |
| 938 } // namespace test | 961 } // namespace test |
| 939 } // namespace net | 962 } // namespace net |
| OLD | NEW |