OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_flow_controller.h" | 5 #include "net/quic/quic_flow_controller.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "net/quic/quic_flags.h" | 8 #include "net/quic/quic_flags.h" |
9 #include "net/quic/quic_utils.h" | 9 #include "net/quic/quic_utils.h" |
10 #include "net/quic/test_tools/quic_connection_peer.h" | 10 #include "net/quic/test_tools/quic_connection_peer.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // Result is that once again we have a fully open receive window. | 114 // Result is that once again we have a fully open receive window. |
115 EXPECT_FALSE(flow_controller_->FlowControlViolation()); | 115 EXPECT_FALSE(flow_controller_->FlowControlViolation()); |
116 EXPECT_EQ(kInitialFlowControlWindowForTest, | 116 EXPECT_EQ(kInitialFlowControlWindowForTest, |
117 QuicFlowControllerPeer::ReceiveWindowSize(flow_controller_.get())); | 117 QuicFlowControllerPeer::ReceiveWindowSize(flow_controller_.get())); |
118 } | 118 } |
119 | 119 |
120 TEST_F(QuicFlowControllerTest, | 120 TEST_F(QuicFlowControllerTest, |
121 DisabledWhenQuicVersionDoesNotSupportFlowControl) { | 121 DisabledWhenQuicVersionDoesNotSupportFlowControl) { |
122 // Only support version 16: no flow control. | 122 // Only support version 16: no flow control. |
123 QuicVersionVector supported_versions; | 123 QuicConnectionPeer::SetSupportedVersions(&connection_, |
124 supported_versions.push_back(QUIC_VERSION_16); | 124 SupportedVersions(QUIC_VERSION_16)); |
125 QuicConnectionPeer::SetSupportedVersions(&connection_, supported_versions); | |
126 | 125 |
127 Initialize(); | 126 Initialize(); |
128 | 127 |
129 MockConnection connection(false); | 128 MockConnection connection(false); |
130 | 129 |
131 // Should not be enabled, and should not report as blocked. | 130 // Should not be enabled, and should not report as blocked. |
132 EXPECT_FALSE(flow_controller_->IsEnabled()); | 131 EXPECT_FALSE(flow_controller_->IsEnabled()); |
133 EXPECT_FALSE(flow_controller_->IsBlocked()); | 132 EXPECT_FALSE(flow_controller_->IsBlocked()); |
134 EXPECT_FALSE(flow_controller_->FlowControlViolation()); | 133 EXPECT_FALSE(flow_controller_->FlowControlViolation()); |
135 | 134 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 flow_controller_->AddBytesSent(send_window_); | 215 flow_controller_->AddBytesSent(send_window_); |
217 EXPECT_TRUE(flow_controller_->IsBlocked()); | 216 EXPECT_TRUE(flow_controller_->IsBlocked()); |
218 EXPECT_EQ(0u, flow_controller_->SendWindowSize()); | 217 EXPECT_EQ(0u, flow_controller_->SendWindowSize()); |
219 | 218 |
220 // BLOCKED frame should get sent as send offset has changed. | 219 // BLOCKED frame should get sent as send offset has changed. |
221 flow_controller_->MaybeSendBlocked(); | 220 flow_controller_->MaybeSendBlocked(); |
222 } | 221 } |
223 | 222 |
224 } // namespace test | 223 } // namespace test |
225 } // namespace net | 224 } // namespace net |
OLD | NEW |