| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 packet_loss_threshold_(1.0f), | 308 packet_loss_threshold_(1.0f), |
| 309 max_disabled_reasons_(3), | 309 max_disabled_reasons_(3), |
| 310 threshold_timeouts_with_open_streams_(2), | 310 threshold_timeouts_with_open_streams_(2), |
| 311 threshold_public_resets_post_handshake_(2), | 311 threshold_public_resets_post_handshake_(2), |
| 312 receive_buffer_size_(0), | 312 receive_buffer_size_(0), |
| 313 delay_tcp_race_(true), | 313 delay_tcp_race_(true), |
| 314 close_sessions_on_ip_change_(false), | 314 close_sessions_on_ip_change_(false), |
| 315 disable_quic_on_timeout_with_open_streams_(false), | 315 disable_quic_on_timeout_with_open_streams_(false), |
| 316 idle_connection_timeout_seconds_(kIdleConnectionTimeoutSeconds), | 316 idle_connection_timeout_seconds_(kIdleConnectionTimeoutSeconds), |
| 317 migrate_sessions_on_network_change_(false), | 317 migrate_sessions_on_network_change_(false), |
| 318 migrate_sessions_early_(false) { | 318 migrate_sessions_early_(false), |
| 319 force_hol_blocking_(false) { |
| 319 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); | 320 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
| 320 } | 321 } |
| 321 | 322 |
| 322 ~QuicStreamFactoryTestBase() { | 323 ~QuicStreamFactoryTestBase() { |
| 323 // If |factory_| was initialized, then it took over ownership of |clock_|. | 324 // If |factory_| was initialized, then it took over ownership of |clock_|. |
| 324 // If |factory_| was not initialized, then |clock_| needs to be destroyed. | 325 // If |factory_| was not initialized, then |clock_| needs to be destroyed. |
| 325 if (!factory_) { | 326 if (!factory_) { |
| 326 delete clock_; | 327 delete clock_; |
| 327 } | 328 } |
| 328 } | 329 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 340 enable_port_selection_, always_require_handshake_confirmation_, | 341 enable_port_selection_, always_require_handshake_confirmation_, |
| 341 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, | 342 disable_connection_pooling_, load_server_info_timeout_srtt_multiplier_, |
| 342 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, | 343 enable_connection_racing_, enable_non_blocking_io_, disable_disk_cache_, |
| 343 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, | 344 prefer_aes_, max_number_of_lossy_connections_, packet_loss_threshold_, |
| 344 max_disabled_reasons_, threshold_timeouts_with_open_streams_, | 345 max_disabled_reasons_, threshold_timeouts_with_open_streams_, |
| 345 threshold_public_resets_post_handshake_, receive_buffer_size_, | 346 threshold_public_resets_post_handshake_, receive_buffer_size_, |
| 346 delay_tcp_race_, /*max_server_configs_stored_in_properties*/ 0, | 347 delay_tcp_race_, /*max_server_configs_stored_in_properties*/ 0, |
| 347 close_sessions_on_ip_change_, | 348 close_sessions_on_ip_change_, |
| 348 disable_quic_on_timeout_with_open_streams_, | 349 disable_quic_on_timeout_with_open_streams_, |
| 349 idle_connection_timeout_seconds_, migrate_sessions_on_network_change_, | 350 idle_connection_timeout_seconds_, migrate_sessions_on_network_change_, |
| 350 migrate_sessions_early_, QuicTagVector(), | 351 migrate_sessions_early_, force_hol_blocking_, QuicTagVector(), |
| 351 /*enable_token_binding*/ false)); | 352 /*enable_token_binding*/ false)); |
| 352 factory_->set_require_confirmation(false); | 353 factory_->set_require_confirmation(false); |
| 353 EXPECT_FALSE(factory_->has_quic_server_info_factory()); | 354 EXPECT_FALSE(factory_->has_quic_server_info_factory()); |
| 354 factory_->set_quic_server_info_factory(new MockQuicServerInfoFactory()); | 355 factory_->set_quic_server_info_factory(new MockQuicServerInfoFactory()); |
| 355 EXPECT_TRUE(factory_->has_quic_server_info_factory()); | 356 EXPECT_TRUE(factory_->has_quic_server_info_factory()); |
| 356 } | 357 } |
| 357 | 358 |
| 358 void InitializeConnectionMigrationTest( | 359 void InitializeConnectionMigrationTest( |
| 359 NetworkChangeNotifier::NetworkList connected_networks) { | 360 NetworkChangeNotifier::NetworkList connected_networks) { |
| 360 scoped_mock_network_change_notifier_.reset( | 361 scoped_mock_network_change_notifier_.reset( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 int max_disabled_reasons_; | 534 int max_disabled_reasons_; |
| 534 int threshold_timeouts_with_open_streams_; | 535 int threshold_timeouts_with_open_streams_; |
| 535 int threshold_public_resets_post_handshake_; | 536 int threshold_public_resets_post_handshake_; |
| 536 int receive_buffer_size_; | 537 int receive_buffer_size_; |
| 537 bool delay_tcp_race_; | 538 bool delay_tcp_race_; |
| 538 bool close_sessions_on_ip_change_; | 539 bool close_sessions_on_ip_change_; |
| 539 bool disable_quic_on_timeout_with_open_streams_; | 540 bool disable_quic_on_timeout_with_open_streams_; |
| 540 int idle_connection_timeout_seconds_; | 541 int idle_connection_timeout_seconds_; |
| 541 bool migrate_sessions_on_network_change_; | 542 bool migrate_sessions_on_network_change_; |
| 542 bool migrate_sessions_early_; | 543 bool migrate_sessions_early_; |
| 544 bool force_hol_blocking_; |
| 543 }; | 545 }; |
| 544 | 546 |
| 545 class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, | 547 class QuicStreamFactoryTest : public QuicStreamFactoryTestBase, |
| 546 public ::testing::TestWithParam<TestParams> { | 548 public ::testing::TestWithParam<TestParams> { |
| 547 protected: | 549 protected: |
| 548 QuicStreamFactoryTest() | 550 QuicStreamFactoryTest() |
| 549 : QuicStreamFactoryTestBase(GetParam().version, | 551 : QuicStreamFactoryTestBase(GetParam().version, |
| 550 GetParam().enable_connection_racing) {} | 552 GetParam().enable_connection_racing) {} |
| 551 }; | 553 }; |
| 552 | 554 |
| (...skipping 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4411 EXPECT_NE(session1, session2); | 4413 EXPECT_NE(session1, session2); |
| 4412 | 4414 |
| 4413 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); | 4415 EXPECT_EQ(QuicServerId(origin1_, privacy_mode_), session1->server_id()); |
| 4414 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); | 4416 EXPECT_EQ(QuicServerId(origin2_, privacy_mode_), session2->server_id()); |
| 4415 | 4417 |
| 4416 EXPECT_TRUE(AllDataConsumed()); | 4418 EXPECT_TRUE(AllDataConsumed()); |
| 4417 } | 4419 } |
| 4418 | 4420 |
| 4419 } // namespace test | 4421 } // namespace test |
| 4420 } // namespace net | 4422 } // namespace net |
| OLD | NEW |