| 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 <sys/epoll.h> | 6 #include <sys/epoll.h> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 : initialized_(false), | 259 : initialized_(false), |
| 260 server_address_(IPEndPoint(Loopback4(), 0)), | 260 server_address_(IPEndPoint(Loopback4(), 0)), |
| 261 server_hostname_("example.com"), | 261 server_hostname_("example.com"), |
| 262 server_started_(false), | 262 server_started_(false), |
| 263 strike_register_no_startup_period_(false), | 263 strike_register_no_startup_period_(false), |
| 264 chlo_multiplier_(0), | 264 chlo_multiplier_(0), |
| 265 stream_factory_(nullptr) { | 265 stream_factory_(nullptr) { |
| 266 client_supported_versions_ = GetParam().client_supported_versions; | 266 client_supported_versions_ = GetParam().client_supported_versions; |
| 267 server_supported_versions_ = GetParam().server_supported_versions; | 267 server_supported_versions_ = GetParam().server_supported_versions; |
| 268 negotiated_version_ = GetParam().negotiated_version; | 268 negotiated_version_ = GetParam().negotiated_version; |
| 269 FLAGS_enable_quic_fec = GetParam().use_fec; | |
| 270 | 269 |
| 271 VLOG(1) << "Using Configuration: " << GetParam(); | 270 VLOG(1) << "Using Configuration: " << GetParam(); |
| 272 | 271 |
| 273 // Use different flow control windows for client/server. | 272 // Use different flow control windows for client/server. |
| 274 client_config_.SetInitialStreamFlowControlWindowToSend( | 273 client_config_.SetInitialStreamFlowControlWindowToSend( |
| 275 2 * kInitialStreamFlowControlWindowForTest); | 274 2 * kInitialStreamFlowControlWindowForTest); |
| 276 client_config_.SetInitialSessionFlowControlWindowToSend( | 275 client_config_.SetInitialSessionFlowControlWindowToSend( |
| 277 2 * kInitialSessionFlowControlWindowForTest); | 276 2 * kInitialSessionFlowControlWindowForTest); |
| 278 server_config_.SetInitialStreamFlowControlWindowToSend( | 277 server_config_.SetInitialStreamFlowControlWindowToSend( |
| 279 3 * kInitialStreamFlowControlWindowForTest); | 278 3 * kInitialStreamFlowControlWindowForTest); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 copt.push_back(kAFCW); | 363 copt.push_back(kAFCW); |
| 365 copt.push_back(kIFW5); | 364 copt.push_back(kIFW5); |
| 366 } | 365 } |
| 367 client_config_.SetConnectionOptionsToSend(copt); | 366 client_config_.SetConnectionOptionsToSend(copt); |
| 368 | 367 |
| 369 // Start the server first, because CreateQuicClient() attempts | 368 // Start the server first, because CreateQuicClient() attempts |
| 370 // to connect to the server. | 369 // to connect to the server. |
| 371 StartServer(); | 370 StartServer(); |
| 372 | 371 |
| 373 client_.reset(CreateQuicClient(client_writer_)); | 372 client_.reset(CreateQuicClient(client_writer_)); |
| 374 if (GetParam().use_fec) { | |
| 375 // Set FecPolicy to always protect data on all streams. | |
| 376 client_->SetFecPolicy(FEC_PROTECT_ALWAYS); | |
| 377 } | |
| 378 static EpollEvent event(EPOLLOUT, false); | 373 static EpollEvent event(EPOLLOUT, false); |
| 379 client_writer_->Initialize( | 374 client_writer_->Initialize( |
| 380 reinterpret_cast<QuicEpollConnectionHelper*>( | 375 reinterpret_cast<QuicEpollConnectionHelper*>( |
| 381 QuicConnectionPeer::GetHelper( | 376 QuicConnectionPeer::GetHelper( |
| 382 client_->client()->session()->connection())), | 377 client_->client()->session()->connection())), |
| 383 new ClientDelegate(client_->client())); | 378 new ClientDelegate(client_->client())); |
| 384 initialized_ = true; | 379 initialized_ = true; |
| 385 return client_->client()->connected(); | 380 return client_->client()->connected(); |
| 386 } | 381 } |
| 387 | 382 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 ContainsQuicTag(server_config_.ReceivedConnectionOptions(), kIW10)); | 986 ContainsQuicTag(server_config_.ReceivedConnectionOptions(), kIW10)); |
| 992 EXPECT_TRUE( | 987 EXPECT_TRUE( |
| 993 ContainsQuicTag(server_config_.ReceivedConnectionOptions(), kPRST)); | 988 ContainsQuicTag(server_config_.ReceivedConnectionOptions(), kPRST)); |
| 994 } | 989 } |
| 995 | 990 |
| 996 TEST_P(EndToEndTest, CorrectlyConfiguredFec) { | 991 TEST_P(EndToEndTest, CorrectlyConfiguredFec) { |
| 997 ASSERT_TRUE(Initialize()); | 992 ASSERT_TRUE(Initialize()); |
| 998 client_->client()->WaitForCryptoHandshakeConfirmed(); | 993 client_->client()->WaitForCryptoHandshakeConfirmed(); |
| 999 server_thread_->WaitForCryptoHandshakeConfirmed(); | 994 server_thread_->WaitForCryptoHandshakeConfirmed(); |
| 1000 | 995 |
| 1001 FecPolicy expected_policy = | 996 FecPolicy expected_policy = FEC_PROTECT_OPTIONAL; |
| 1002 GetParam().use_fec ? FEC_PROTECT_ALWAYS : FEC_PROTECT_OPTIONAL; | |
| 1003 | 997 |
| 1004 // Verify that server's FEC configuration is correct. | 998 // Verify that server's FEC configuration is correct. |
| 1005 server_thread_->Pause(); | 999 server_thread_->Pause(); |
| 1006 QuicDispatcher* dispatcher = | 1000 QuicDispatcher* dispatcher = |
| 1007 QuicServerPeer::GetDispatcher(server_thread_->server()); | 1001 QuicServerPeer::GetDispatcher(server_thread_->server()); |
| 1008 ASSERT_EQ(1u, dispatcher->session_map().size()); | 1002 ASSERT_EQ(1u, dispatcher->session_map().size()); |
| 1009 QuicSpdySession* session = dispatcher->session_map().begin()->second; | 1003 QuicSpdySession* session = dispatcher->session_map().begin()->second; |
| 1010 EXPECT_EQ(expected_policy, | 1004 EXPECT_EQ(expected_policy, |
| 1011 QuicSpdySessionPeer::GetHeadersStream(session)->fec_policy()); | 1005 QuicSpdySessionPeer::GetHeadersStream(session)->fec_policy()); |
| 1012 server_thread_->Resume(); | 1006 server_thread_->Resume(); |
| (...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 // sending requests for them. | 2419 // sending requests for them. |
| 2426 EXPECT_EQ(1u, client_->num_requests()); | 2420 EXPECT_EQ(1u, client_->num_requests()); |
| 2427 // Including response to original request, 12 responses in total were | 2421 // Including response to original request, 12 responses in total were |
| 2428 // recieved. | 2422 // recieved. |
| 2429 EXPECT_EQ(12u, client_->num_responses()); | 2423 EXPECT_EQ(12u, client_->num_responses()); |
| 2430 } | 2424 } |
| 2431 | 2425 |
| 2432 } // namespace | 2426 } // namespace |
| 2433 } // namespace test | 2427 } // namespace test |
| 2434 } // namespace net | 2428 } // namespace net |
| OLD | NEW |