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 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 | 2519 |
2520 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; | 2520 MockRead reads2[] = {MockRead(SYNCHRONOUS, ERR_IO_PENDING, 0)}; |
2521 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); | 2521 SequencedSocketData socket_data2(reads2, arraysize(reads2), nullptr, 0); |
2522 socket_factory_.AddSocketDataProvider(&socket_data2); | 2522 socket_factory_.AddSocketDataProvider(&socket_data2); |
2523 | 2523 |
2524 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), | 2524 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), |
2525 host_port_pair_.port()); | 2525 host_port_pair_.port()); |
2526 AlternativeServiceInfoVector alternative_service_info_vector; | 2526 AlternativeServiceInfoVector alternative_service_info_vector; |
2527 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 2527 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
2528 alternative_service_info_vector.push_back( | 2528 alternative_service_info_vector.push_back( |
2529 AlternativeServiceInfo(alternative_service1, 1.0, expiration)); | 2529 AlternativeServiceInfo(alternative_service1, expiration)); |
2530 | 2530 |
2531 http_server_properties_.SetAlternativeServices( | 2531 http_server_properties_.SetAlternativeServices( |
2532 host_port_pair_, alternative_service_info_vector); | 2532 host_port_pair_, alternative_service_info_vector); |
2533 | 2533 |
2534 crypto_client_stream_factory_.set_handshake_mode( | 2534 crypto_client_stream_factory_.set_handshake_mode( |
2535 MockCryptoClientStream::ZERO_RTT); | 2535 MockCryptoClientStream::ZERO_RTT); |
2536 host_resolver_.set_synchronous_mode(true); | 2536 host_resolver_.set_synchronous_mode(true); |
2537 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), | 2537 host_resolver_.rules()->AddIPLiteralRule(host_port_pair_.host(), |
2538 "192.168.0.1", ""); | 2538 "192.168.0.1", ""); |
2539 | 2539 |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3618 const QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); | 3618 const QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); |
3619 EXPECT_EQ(500, config->IdleConnectionStateLifetime().ToSeconds()); | 3619 EXPECT_EQ(500, config->IdleConnectionStateLifetime().ToSeconds()); |
3620 | 3620 |
3621 QuicStreamFactoryPeer::SetTaskRunner(factory_.get(), runner_.get()); | 3621 QuicStreamFactoryPeer::SetTaskRunner(factory_.get(), runner_.get()); |
3622 | 3622 |
3623 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), | 3623 const AlternativeService alternative_service1(QUIC, host_port_pair_.host(), |
3624 host_port_pair_.port()); | 3624 host_port_pair_.port()); |
3625 AlternativeServiceInfoVector alternative_service_info_vector; | 3625 AlternativeServiceInfoVector alternative_service_info_vector; |
3626 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 3626 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
3627 alternative_service_info_vector.push_back( | 3627 alternative_service_info_vector.push_back( |
3628 AlternativeServiceInfo(alternative_service1, 1.0, expiration)); | 3628 AlternativeServiceInfo(alternative_service1, expiration)); |
3629 | 3629 |
3630 http_server_properties_.SetAlternativeServices( | 3630 http_server_properties_.SetAlternativeServices( |
3631 host_port_pair_, alternative_service_info_vector); | 3631 host_port_pair_, alternative_service_info_vector); |
3632 http_server_properties_.SetMaxServerConfigsStoredInProperties( | 3632 http_server_properties_.SetMaxServerConfigsStoredInProperties( |
3633 kMaxQuicServersToPersist); | 3633 kMaxQuicServersToPersist); |
3634 | 3634 |
3635 QuicServerId quic_server_id(kDefaultServerHostName, 80, | 3635 QuicServerId quic_server_id(kDefaultServerHostName, 80, |
3636 PRIVACY_MODE_DISABLED); | 3636 PRIVACY_MODE_DISABLED); |
3637 QuicServerInfoFactory* quic_server_info_factory = | 3637 QuicServerInfoFactory* quic_server_info_factory = |
3638 new PropertiesBasedQuicServerInfoFactory( | 3638 new PropertiesBasedQuicServerInfoFactory( |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3902 EXPECT_TRUE(stream2.get()); | 3902 EXPECT_TRUE(stream2.get()); |
3903 | 3903 |
3904 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); | 3904 EXPECT_TRUE(socket_data1.AllReadDataConsumed()); |
3905 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); | 3905 EXPECT_TRUE(socket_data1.AllWriteDataConsumed()); |
3906 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); | 3906 EXPECT_TRUE(socket_data2.AllReadDataConsumed()); |
3907 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); | 3907 EXPECT_TRUE(socket_data2.AllWriteDataConsumed()); |
3908 } | 3908 } |
3909 | 3909 |
3910 } // namespace test | 3910 } // namespace test |
3911 } // namespace net | 3911 } // namespace net |
OLD | NEW |