| 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/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 max_number_of_lossy_connections_(0), | 314 max_number_of_lossy_connections_(0), |
| 315 packet_loss_threshold_(1.0f), | 315 packet_loss_threshold_(1.0f), |
| 316 max_disabled_reasons_(3), | 316 max_disabled_reasons_(3), |
| 317 threshold_timeouts_with_open_streams_(2), | 317 threshold_timeouts_with_open_streams_(2), |
| 318 threshold_public_resets_post_handshake_(2), | 318 threshold_public_resets_post_handshake_(2), |
| 319 receive_buffer_size_(0), | 319 receive_buffer_size_(0), |
| 320 delay_tcp_race_(true), | 320 delay_tcp_race_(true), |
| 321 close_sessions_on_ip_change_(false), | 321 close_sessions_on_ip_change_(false), |
| 322 disable_quic_on_timeout_with_open_streams_(false), | 322 disable_quic_on_timeout_with_open_streams_(false), |
| 323 idle_connection_timeout_seconds_(kIdleConnectionTimeoutSeconds), | 323 idle_connection_timeout_seconds_(kIdleConnectionTimeoutSeconds), |
| 324 packet_reader_yield_after_duration_milliseconds_( |
| 325 kQuicYieldAfterDurationMilliseconds), |
| 324 migrate_sessions_on_network_change_(false), | 326 migrate_sessions_on_network_change_(false), |
| 325 migrate_sessions_early_(false), | 327 migrate_sessions_early_(false), |
| 326 allow_server_migration_(false), | 328 allow_server_migration_(false), |
| 327 force_hol_blocking_(false), | 329 force_hol_blocking_(false), |
| 328 race_cert_verification_(false) { | 330 race_cert_verification_(false) { |
| 329 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); | 331 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
| 330 } | 332 } |
| 331 | 333 |
| 332 ~QuicStreamFactoryTestBase() { | 334 ~QuicStreamFactoryTestBase() { |
| 333 // If |factory_| was initialized, then it took over ownership of |clock_|. | 335 // If |factory_| was initialized, then it took over ownership of |clock_|. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 348 kDefaultMaxPacketSize, string(), SupportedVersions(version_), | 350 kDefaultMaxPacketSize, string(), SupportedVersions(version_), |
| 349 enable_port_selection_, always_require_handshake_confirmation_, | 351 enable_port_selection_, always_require_handshake_confirmation_, |
| 350 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, | 352 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, |
| 351 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, | 353 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, |
| 352 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, | 354 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, |
| 353 max_disabled_reasons_, threshold_timeouts_with_open_streams_, | 355 max_disabled_reasons_, threshold_timeouts_with_open_streams_, |
| 354 threshold_public_resets_post_handshake_, receive_buffer_size_, | 356 threshold_public_resets_post_handshake_, receive_buffer_size_, |
| 355 delay_tcp_race_, /*max_server_configs_stored_in_properties*/ 0, | 357 delay_tcp_race_, /*max_server_configs_stored_in_properties*/ 0, |
| 356 close_sessions_on_ip_change_, | 358 close_sessions_on_ip_change_, |
| 357 disable_quic_on_timeout_with_open_streams_, | 359 disable_quic_on_timeout_with_open_streams_, |
| 358 idle_connection_timeout_seconds_, migrate_sessions_on_network_change_, | 360 idle_connection_timeout_seconds_, |
| 359 migrate_sessions_early_, allow_server_migration_, force_hol_blocking_, | 361 packet_reader_yield_after_duration_milliseconds_, |
| 360 race_cert_verification_, QuicTagVector(), | 362 migrate_sessions_on_network_change_, migrate_sessions_early_, |
| 363 allow_server_migration_, force_hol_blocking_, race_cert_verification_, |
| 364 QuicTagVector(), |
| 361 /*enable_token_binding*/ false)); | 365 /*enable_token_binding*/ false)); |
| 362 factory_->set_require_confirmation(false); | 366 factory_->set_require_confirmation(false); |
| 363 EXPECT_FALSE(factory_->has_quic_server_info_factory()); | 367 EXPECT_FALSE(factory_->has_quic_server_info_factory()); |
| 364 factory_->set_quic_server_info_factory(new MockQuicServerInfoFactory()); | 368 factory_->set_quic_server_info_factory(new MockQuicServerInfoFactory()); |
| 365 EXPECT_TRUE(factory_->has_quic_server_info_factory()); | 369 EXPECT_TRUE(factory_->has_quic_server_info_factory()); |
| 366 } | 370 } |
| 367 | 371 |
| 368 void InitializeConnectionMigrationTest( | 372 void InitializeConnectionMigrationTest( |
| 369 NetworkChangeNotifier::NetworkList connected_networks) { | 373 NetworkChangeNotifier::NetworkList connected_networks) { |
| 370 scoped_mock_network_change_notifier_.reset( | 374 scoped_mock_network_change_notifier_.reset( |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 int max_number_of_lossy_connections_; | 616 int max_number_of_lossy_connections_; |
| 613 double packet_loss_threshold_; | 617 double packet_loss_threshold_; |
| 614 int max_disabled_reasons_; | 618 int max_disabled_reasons_; |
| 615 int threshold_timeouts_with_open_streams_; | 619 int threshold_timeouts_with_open_streams_; |
| 616 int threshold_public_resets_post_handshake_; | 620 int threshold_public_resets_post_handshake_; |
| 617 int receive_buffer_size_; | 621 int receive_buffer_size_; |
| 618 bool delay_tcp_race_; | 622 bool delay_tcp_race_; |
| 619 bool close_sessions_on_ip_change_; | 623 bool close_sessions_on_ip_change_; |
| 620 bool disable_quic_on_timeout_with_open_streams_; | 624 bool disable_quic_on_timeout_with_open_streams_; |
| 621 int idle_connection_timeout_seconds_; | 625 int idle_connection_timeout_seconds_; |
| 626 int packet_reader_yield_after_duration_milliseconds_; |
| 622 bool migrate_sessions_on_network_change_; | 627 bool migrate_sessions_on_network_change_; |
| 623 bool migrate_sessions_early_; | 628 bool migrate_sessions_early_; |
| 624 bool allow_server_migration_; | 629 bool allow_server_migration_; |
| 625 bool force_hol_blocking_; | 630 bool force_hol_blocking_; |
| 626 bool race_cert_verification_; | 631 bool race_cert_verification_; |
| 627 }; | 632 }; |
| 628 | 633 |
| 629 class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, | 634 class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, |
| 630 public ::testing::TestWithParam<TestParams> { | 635 public ::testing::TestWithParam<TestParams> { |
| 631 protected: | 636 protected: |
| (...skipping 4546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5178 // Clear all cached states. | 5183 // Clear all cached states. |
| 5179 factory_->ClearCachedStatesInCryptoConfig( | 5184 factory_->ClearCachedStatesInCryptoConfig( |
| 5180 base::Callback<bool(const GURL&)>()); | 5185 base::Callback<bool(const GURL&)>()); |
| 5181 EXPECT_TRUE(test_cases[0].state->certs().empty()); | 5186 EXPECT_TRUE(test_cases[0].state->certs().empty()); |
| 5182 EXPECT_TRUE(test_cases[1].state->certs().empty()); | 5187 EXPECT_TRUE(test_cases[1].state->certs().empty()); |
| 5183 EXPECT_TRUE(test_cases[2].state->certs().empty()); | 5188 EXPECT_TRUE(test_cases[2].state->certs().empty()); |
| 5184 } | 5189 } |
| 5185 | 5190 |
| 5186 } // namespace test | 5191 } // namespace test |
| 5187 } // namespace net | 5192 } // namespace net |
| OLD | NEW |