| 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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 packet_loss_threshold_(1.0f), | 291 packet_loss_threshold_(1.0f), |
| 292 max_disabled_reasons_(3), | 292 max_disabled_reasons_(3), |
| 293 threshold_timeouts_with_open_streams_(2), | 293 threshold_timeouts_with_open_streams_(2), |
| 294 threshold_public_resets_post_handshake_(2), | 294 threshold_public_resets_post_handshake_(2), |
| 295 receive_buffer_size_(0), | 295 receive_buffer_size_(0), |
| 296 delay_tcp_race_(true), | 296 delay_tcp_race_(true), |
| 297 close_sessions_on_ip_change_(false), | 297 close_sessions_on_ip_change_(false), |
| 298 disable_quic_on_timeout_with_open_streams_(false), | 298 disable_quic_on_timeout_with_open_streams_(false), |
| 299 idle_connection_timeout_seconds_(kIdleConnectionTimeoutSeconds), | 299 idle_connection_timeout_seconds_(kIdleConnectionTimeoutSeconds), |
| 300 migrate_sessions_on_network_change_(false), | 300 migrate_sessions_on_network_change_(false), |
| 301 migrate_sessions_early_(false) { | 301 migrate_sessions_early_(false), |
| 302 race_cert_verification_(false) { |
| 302 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); | 303 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
| 303 } | 304 } |
| 304 | 305 |
| 305 ~QuicStreamFactoryTestBase() { | 306 ~QuicStreamFactoryTestBase() { |
| 306 // If |factory_| was initialized, then it took over ownership of |clock_|. | 307 // If |factory_| was initialized, then it took over ownership of |clock_|. |
| 307 // If |factory_| was not initialized, then |clock_| needs to be destroyed. | 308 // If |factory_| was not initialized, then |clock_| needs to be destroyed. |
| 308 if (!factory_) { | 309 if (!factory_) { |
| 309 delete clock_; | 310 delete clock_; |
| 310 } | 311 } |
| 311 } | 312 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 323 enable_port_selection_, always_require_handshake_confirmation_, | 324 enable_port_selection_, always_require_handshake_confirmation_, |
| 324 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, | 325 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, |
| 325 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, | 326 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, |
| 326 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, | 327 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, |
| 327 max_disabled_reasons_, threshold_timeouts_with_open_streams_, | 328 max_disabled_reasons_, threshold_timeouts_with_open_streams_, |
| 328 threshold_public_resets_post_handshake_, receive_buffer_size_, | 329 threshold_public_resets_post_handshake_, receive_buffer_size_, |
| 329 delay_tcp_race_, /*max_server_configs_stored_in_properties*/ 0, | 330 delay_tcp_race_, /*max_server_configs_stored_in_properties*/ 0, |
| 330 close_sessions_on_ip_change_, | 331 close_sessions_on_ip_change_, |
| 331 disable_quic_on_timeout_with_open_streams_, | 332 disable_quic_on_timeout_with_open_streams_, |
| 332 idle_connection_timeout_seconds_, migrate_sessions_on_network_change_, | 333 idle_connection_timeout_seconds_, migrate_sessions_on_network_change_, |
| 333 migrate_sessions_early_, QuicTagVector(), | 334 migrate_sessions_early_, race_cert_verification_, QuicTagVector(), |
| 334 /*enable_token_binding*/ false)); | 335 /*enable_token_binding*/ false)); |
| 335 factory_->set_require_confirmation(false); | 336 factory_->set_require_confirmation(false); |
| 336 EXPECT_FALSE(factory_->has_quic_server_info_factory()); | 337 EXPECT_FALSE(factory_->has_quic_server_info_factory()); |
| 337 factory_->set_quic_server_info_factory(new MockQuicServerInfoFactory()); | 338 factory_->set_quic_server_info_factory(new MockQuicServerInfoFactory()); |
| 338 EXPECT_TRUE(factory_->has_quic_server_info_factory()); | 339 EXPECT_TRUE(factory_->has_quic_server_info_factory()); |
| 339 } | 340 } |
| 340 | 341 |
| 341 void InitializeConnectionMigrationTest( | 342 void InitializeConnectionMigrationTest( |
| 342 NetworkChangeNotifier::NetworkList connected_networks) { | 343 NetworkChangeNotifier::NetworkList connected_networks) { |
| 343 scoped_mock_network_change_notifier_.reset( | 344 scoped_mock_network_change_notifier_.reset( |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 int max_disabled_reasons_; | 516 int max_disabled_reasons_; |
| 516 int threshold_timeouts_with_open_streams_; | 517 int threshold_timeouts_with_open_streams_; |
| 517 int threshold_public_resets_post_handshake_; | 518 int threshold_public_resets_post_handshake_; |
| 518 int receive_buffer_size_; | 519 int receive_buffer_size_; |
| 519 bool delay_tcp_race_; | 520 bool delay_tcp_race_; |
| 520 bool close_sessions_on_ip_change_; | 521 bool close_sessions_on_ip_change_; |
| 521 bool disable_quic_on_timeout_with_open_streams_; | 522 bool disable_quic_on_timeout_with_open_streams_; |
| 522 int idle_connection_timeout_seconds_; | 523 int idle_connection_timeout_seconds_; |
| 523 bool migrate_sessions_on_network_change_; | 524 bool migrate_sessions_on_network_change_; |
| 524 bool migrate_sessions_early_; | 525 bool migrate_sessions_early_; |
| 526 bool race_cert_verification_; |
| 525 }; | 527 }; |
| 526 | 528 |
| 527 class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, | 529 class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, |
| 528 public ::testing::TestWithParam<TestParams> { | 530 public ::testing::TestWithParam<TestParams> { |
| 529 protected: | 531 protected: |
| 530 QuicStreamFactoryTest() | 532 QuicStreamFactoryTest() |
| 531 : QuicStreamFactoryTestBase(GetParam().version, | 533 : QuicStreamFactoryTestBase(GetParam().version, |
| 532 GetParam().enable_connection_racing) {} | 534 GetParam().enable_connection_racing) {} |
| 533 }; | 535 }; |
| 534 | 536 |
| (...skipping 3796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4331 EXPECT_NE(session1, session2); | 4333 EXPECT_NE(session1, session2); |
| 4332 | 4334 |
| 4333 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); | 4335 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); |
| 4334 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); | 4336 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); |
| 4335 | 4337 |
| 4336 EXPECT_TRUE(AllDataConsumed()); | 4338 EXPECT_TRUE(AllDataConsumed()); |
| 4337 } | 4339 } |
| 4338 | 4340 |
| 4339 } // namespace test | 4341 } // namespace test |
| 4340 } // namespace net | 4342 } // namespace net |
| OLD | NEW |