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 "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "net/base/test_data_directory.h" | 10 #include "net/base/test_data_directory.h" |
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 | 2318 |
2319 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 2319 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
2320 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 2320 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
2321 socket_factory_.AddSocketDataProvider(&socket_data2); | 2321 socket_factory_.AddSocketDataProvider(&socket_data2); |
2322 | 2322 |
2323 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), | 2323 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), |
2324 host_port_pair_.port()); | 2324 host_port_pair_.port()); |
2325 AlternativeServiceInfoVector alternative_service_info_vector; | 2325 AlternativeServiceInfoVector alternative_service_info_vector; |
2326 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 2326 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
2327 alternative_service_info_vector.push_back( | 2327 alternative_service_info_vector.push_back( |
2328 AlternativeServiceInfo(alternative_service1, expiration)); | 2328 AlternativeServiceInfo(alternative_service1, 1.0, expiration)); |
2329 | 2329 |
2330 http_server_properties_.SetAlternativeServices( | 2330 http_server_properties_.SetAlternativeServices( |
2331 host_port_pair_, alternative_service_info_vector); | 2331 host_port_pair_, alternative_service_info_vector); |
2332 | 2332 |
2333 crypto_client_stream_factory_.set_handshake_mode( | 2333 crypto_client_stream_factory_.set_handshake_mode( |
2334 MockCryptoClientStream::ZERO_RTT); | 2334 MockCryptoClientStream::ZERO_RTT); |
2335 host_resolver_.set_synchronous_mode(true); | 2335 host_resolver_.set_synchronous_mode(true); |
2336 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2336 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
2337 "192.168.0.1", ""); | 2337 "192.168.0.1", ""); |
2338 | 2338 |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3391 const QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); | 3391 const QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); |
3392 EXPECT_EQ(500, config->IdleConnectionStateLifetime().ToSeconds()); | 3392 EXPECT_EQ(500, config->IdleConnectionStateLifetime().ToSeconds()); |
3393 | 3393 |
3394 QuicStreamFactoryPeer::SetTaskRunner(factory_.get(), runner_.get()); | 3394 QuicStreamFactoryPeer::SetTaskRunner(factory_.get(), runner_.get()); |
3395 | 3395 |
3396 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), | 3396 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), |
3397 host_port_pair_.port()); | 3397 host_port_pair_.port()); |
3398 AlternativeServiceInfoVector alternative_service_info_vector; | 3398 AlternativeServiceInfoVector alternative_service_info_vector; |
3399 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 3399 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
3400 alternative_service_info_vector.push_back( | 3400 alternative_service_info_vector.push_back( |
3401 AlternativeServiceInfo(alternative_service1, expiration)); | 3401 AlternativeServiceInfo(alternative_service1, 1.0, expiration)); |
3402 | 3402 |
3403 http_server_properties_.SetAlternativeServices( | 3403 http_server_properties_.SetAlternativeServices( |
3404 host_port_pair_, alternative_service_info_vector); | 3404 host_port_pair_, alternative_service_info_vector); |
3405 http_server_properties_.SetMaxServerConfigsStoredInProperties( | 3405 http_server_properties_.SetMaxServerConfigsStoredInProperties( |
3406 kMaxQuicServersToPersist); | 3406 kMaxQuicServersToPersist); |
3407 | 3407 |
3408 QuicServerId quic_server_id(kDefaultServerHostName, 80, | 3408 QuicServerId quic_server_id(kDefaultServerHostName, 80, |
3409 PRIVACY_MODE_DISABLED); | 3409 PRIVACY_MODE_DISABLED); |
3410 QuicServerInfoFactory* quic_server_info_factory = | 3410 QuicServerInfoFactory* quic_server_info_factory = |
3411 new PropertiesBasedQuicServerInfoFactory( | 3411 new PropertiesBasedQuicServerInfoFactory( |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3675 EXPECT_TRUE(stream2.get()); | 3675 EXPECT_TRUE(stream2.get()); |
3676 | 3676 |
3677 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 3677 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
3678 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 3678 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
3679 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 3679 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
3680 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 3680 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
3681 } | 3681 } |
3682 | 3682 |
3683 } // namespace test | 3683 } // namespace test |
3684 } // namespace net | 3684 } // namespace net |
OLD | NEW |