| 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 <memory> | 7 #include <memory> |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
| 17 #include "net/base/mock_network_change_notifier.h" | 17 #include "net/base/mock_network_change_notifier.h" |
| 18 #include "net/cert/cert_verifier.h" | 18 #include "net/cert/cert_verifier.h" |
| 19 #include "net/cert/ct_policy_enforcer.h" | 19 #include "net/cert/ct_policy_enforcer.h" |
| 20 #include "net/cert/multi_log_ct_verifier.h" | 20 #include "net/cert/multi_log_ct_verifier.h" |
| 21 #include "net/dns/mock_host_resolver.h" | 21 #include "net/dns/mock_host_resolver.h" |
| 22 #include "net/http/http_network_session.h" |
| 22 #include "net/http/http_response_headers.h" | 23 #include "net/http/http_response_headers.h" |
| 23 #include "net/http/http_response_info.h" | 24 #include "net/http/http_response_info.h" |
| 24 #include "net/http/http_server_properties_impl.h" | 25 #include "net/http/http_server_properties_impl.h" |
| 25 #include "net/http/http_util.h" | 26 #include "net/http/http_util.h" |
| 26 #include "net/http/transport_security_state.h" | 27 #include "net/http/transport_security_state.h" |
| 27 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" | 28 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" |
| 28 #include "net/quic/chromium/mock_crypto_client_stream_factory.h" | 29 #include "net/quic/chromium/mock_crypto_client_stream_factory.h" |
| 29 #include "net/quic/chromium/mock_quic_data.h" | 30 #include "net/quic/chromium/mock_quic_data.h" |
| 30 #include "net/quic/chromium/properties_based_quic_server_info.h" | 31 #include "net/quic/chromium/properties_based_quic_server_info.h" |
| 31 #include "net/quic/chromium/quic_http_utils.h" | 32 #include "net/quic/chromium/quic_http_utils.h" |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 MockCryptoClientStream::ZERO_RTT); | 480 MockCryptoClientStream::ZERO_RTT); |
| 480 const QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); | 481 const QuicConfig* config = QuicStreamFactoryPeer::GetConfig(factory_.get()); |
| 481 EXPECT_EQ(500, config->IdleNetworkTimeout().ToSeconds()); | 482 EXPECT_EQ(500, config->IdleNetworkTimeout().ToSeconds()); |
| 482 | 483 |
| 483 QuicStreamFactoryPeer::SetTaskRunner(factory_.get(), runner_.get()); | 484 QuicStreamFactoryPeer::SetTaskRunner(factory_.get(), runner_.get()); |
| 484 | 485 |
| 485 const AlternativeService alternative_service1( | 486 const AlternativeService alternative_service1( |
| 486 kProtoQUIC, host_port_pair_.host(), host_port_pair_.port()); | 487 kProtoQUIC, host_port_pair_.host(), host_port_pair_.port()); |
| 487 AlternativeServiceInfoVector alternative_service_info_vector; | 488 AlternativeServiceInfoVector alternative_service_info_vector; |
| 488 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 489 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
| 489 alternative_service_info_vector.push_back( | 490 alternative_service_info_vector.push_back(AlternativeServiceInfo( |
| 490 AlternativeServiceInfo(alternative_service1, expiration)); | 491 alternative_service1, expiration, |
| 492 HttpNetworkSession::Params().quic_supported_versions)); |
| 491 http_server_properties_.SetAlternativeServices( | 493 http_server_properties_.SetAlternativeServices( |
| 492 url::SchemeHostPort(url_), alternative_service_info_vector); | 494 url::SchemeHostPort(url_), alternative_service_info_vector); |
| 493 | 495 |
| 494 HostPortPair host_port_pair2(kServer2HostName, kDefaultServerPort); | 496 HostPortPair host_port_pair2(kServer2HostName, kDefaultServerPort); |
| 495 url::SchemeHostPort server2("https", kServer2HostName, kDefaultServerPort); | 497 url::SchemeHostPort server2("https", kServer2HostName, kDefaultServerPort); |
| 496 const AlternativeService alternative_service2( | 498 const AlternativeService alternative_service2( |
| 497 kProtoQUIC, host_port_pair2.host(), host_port_pair2.port()); | 499 kProtoQUIC, host_port_pair2.host(), host_port_pair2.port()); |
| 498 AlternativeServiceInfoVector alternative_service_info_vector2; | 500 AlternativeServiceInfoVector alternative_service_info_vector2; |
| 499 alternative_service_info_vector2.push_back( | 501 alternative_service_info_vector2.push_back(AlternativeServiceInfo( |
| 500 AlternativeServiceInfo(alternative_service2, expiration)); | 502 alternative_service2, expiration, |
| 503 HttpNetworkSession::Params().quic_supported_versions)); |
| 501 | 504 |
| 502 http_server_properties_.SetAlternativeServices( | 505 http_server_properties_.SetAlternativeServices( |
| 503 server2, alternative_service_info_vector2); | 506 server2, alternative_service_info_vector2); |
| 504 // Verify that the properties of both QUIC servers are stored in the | 507 // Verify that the properties of both QUIC servers are stored in the |
| 505 // HTTP properties map. | 508 // HTTP properties map. |
| 506 EXPECT_EQ(2U, http_server_properties_.alternative_service_map().size()); | 509 EXPECT_EQ(2U, http_server_properties_.alternative_service_map().size()); |
| 507 | 510 |
| 508 http_server_properties_.SetMaxServerConfigsStoredInProperties( | 511 http_server_properties_.SetMaxServerConfigsStoredInProperties( |
| 509 kMaxQuicServersToPersist); | 512 kMaxQuicServersToPersist); |
| 510 | 513 |
| (...skipping 4561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5072 // Clear all cached states. | 5075 // Clear all cached states. |
| 5073 factory_->ClearCachedStatesInCryptoConfig( | 5076 factory_->ClearCachedStatesInCryptoConfig( |
| 5074 base::Callback<bool(const GURL&)>()); | 5077 base::Callback<bool(const GURL&)>()); |
| 5075 EXPECT_TRUE(test_cases[0].state->certs().empty()); | 5078 EXPECT_TRUE(test_cases[0].state->certs().empty()); |
| 5076 EXPECT_TRUE(test_cases[1].state->certs().empty()); | 5079 EXPECT_TRUE(test_cases[1].state->certs().empty()); |
| 5077 EXPECT_TRUE(test_cases[2].state->certs().empty()); | 5080 EXPECT_TRUE(test_cases[2].state->certs().empty()); |
| 5078 } | 5081 } |
| 5079 | 5082 |
| 5080 } // namespace test | 5083 } // namespace test |
| 5081 } // namespace net | 5084 } // namespace net |
| OLD | NEW |