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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 QuicSession* session = dispatcher->session_map().begin()->second; | 1268 QuicSession* session = dispatcher->session_map().begin()->second; |
1269 EXPECT_EQ(kClientStreamIFCW, | 1269 EXPECT_EQ(kClientStreamIFCW, |
1270 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); | 1270 session->config()->ReceivedInitialStreamFlowControlWindowBytes()); |
1271 EXPECT_EQ(kClientSessionIFCW, | 1271 EXPECT_EQ(kClientSessionIFCW, |
1272 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); | 1272 session->config()->ReceivedInitialSessionFlowControlWindowBytes()); |
1273 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( | 1273 EXPECT_EQ(kClientSessionIFCW, QuicFlowControllerPeer::SendWindowOffset( |
1274 session->flow_controller())); | 1274 session->flow_controller())); |
1275 server_thread_->Resume(); | 1275 server_thread_->Resume(); |
1276 } | 1276 } |
1277 | 1277 |
| 1278 TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) { |
| 1279 // The special headers and crypto streams should be subject to per-stream flow |
| 1280 // control limits, but should not be subject to connection level flow control. |
| 1281 const uint32 kStreamIFCW = 123456; |
| 1282 const uint32 kSessionIFCW = 234567; |
| 1283 set_client_initial_stream_flow_control_receive_window(kStreamIFCW); |
| 1284 set_client_initial_session_flow_control_receive_window(kSessionIFCW); |
| 1285 set_server_initial_stream_flow_control_receive_window(kStreamIFCW); |
| 1286 set_server_initial_session_flow_control_receive_window(kSessionIFCW); |
| 1287 |
| 1288 ASSERT_TRUE(Initialize()); |
| 1289 if (negotiated_version_ <= QUIC_VERSION_20) { |
| 1290 return; |
| 1291 } |
| 1292 |
| 1293 // Wait for crypto handshake to finish. This should have contributed to the |
| 1294 // crypto stream flow control window, but not affected the session flow |
| 1295 // control window. |
| 1296 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 1297 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1298 |
| 1299 QuicCryptoStream* crypto_stream = |
| 1300 QuicSessionPeer::GetCryptoStream(client_->client()->session()); |
| 1301 EXPECT_LT( |
| 1302 QuicFlowControllerPeer::SendWindowSize(crypto_stream->flow_controller()), |
| 1303 kStreamIFCW); |
| 1304 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( |
| 1305 client_->client()->session()->flow_controller())); |
| 1306 |
| 1307 // Send a request with no body, and verify that the connection level window |
| 1308 // has not been affected. |
| 1309 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1310 |
| 1311 QuicHeadersStream* headers_stream = |
| 1312 QuicSessionPeer::GetHeadersStream(client_->client()->session()); |
| 1313 EXPECT_LT( |
| 1314 QuicFlowControllerPeer::SendWindowSize(headers_stream->flow_controller()), |
| 1315 kStreamIFCW); |
| 1316 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::SendWindowSize( |
| 1317 client_->client()->session()->flow_controller())); |
| 1318 |
| 1319 // Server should be in a similar state: connection flow control window should |
| 1320 // not have any bytes marked as received. |
| 1321 server_thread_->Pause(); |
| 1322 QuicDispatcher* dispatcher = |
| 1323 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1324 QuicSession* session = dispatcher->session_map().begin()->second; |
| 1325 QuicFlowController* server_connection_flow_controller = |
| 1326 session->flow_controller(); |
| 1327 EXPECT_EQ(kSessionIFCW, QuicFlowControllerPeer::ReceiveWindowSize( |
| 1328 server_connection_flow_controller)); |
| 1329 server_thread_->Resume(); |
| 1330 } |
| 1331 |
1278 } // namespace | 1332 } // namespace |
1279 } // namespace test | 1333 } // namespace test |
1280 } // namespace tools | 1334 } // namespace tools |
1281 } // namespace net | 1335 } // namespace net |
OLD | NEW |