| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "net/cert/cert_verifier.h" | 10 #include "net/cert/cert_verifier.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 "{\"QUIC\":{\"max_server_configs_stored_in_properties\":2," | 44 "{\"QUIC\":{\"max_server_configs_stored_in_properties\":2," |
| 45 "\"delay_tcp_race\":true," | 45 "\"delay_tcp_race\":true," |
| 46 "\"prefer_aes\":true," | 46 "\"prefer_aes\":true," |
| 47 "\"user_agent_id\":\"Custom QUIC UAID\"," | 47 "\"user_agent_id\":\"Custom QUIC UAID\"," |
| 48 "\"idle_connection_timeout_seconds\":300," | 48 "\"idle_connection_timeout_seconds\":300," |
| 49 "\"close_sessions_on_ip_change\":true," | 49 "\"close_sessions_on_ip_change\":true," |
| 50 "\"race_cert_verification\":true," | 50 "\"race_cert_verification\":true," |
| 51 "\"connection_options\":\"TIME,TBBR,REJ\"}," | 51 "\"connection_options\":\"TIME,TBBR,REJ\"}," |
| 52 "\"AsyncDNS\":{\"enable\":true}," | 52 "\"AsyncDNS\":{\"enable\":true}," |
| 53 "\"HostResolverRules\":{\"host_resolver_rules\":" | 53 "\"HostResolverRules\":{\"host_resolver_rules\":" |
| 54 "\"MAP * 127.0.0.1\"}}", | 54 "\"MAP * 127.0.0.1\"}," |
| 55 // See http://crbug.com/696569. |
| 56 "\"disable_ipv6\":true}", |
| 55 // Data reduction proxy key. | 57 // Data reduction proxy key. |
| 56 "", | 58 "", |
| 57 // Data reduction proxy. | 59 // Data reduction proxy. |
| 58 "", | 60 "", |
| 59 // Fallback data reduction proxy. | 61 // Fallback data reduction proxy. |
| 60 "", | 62 "", |
| 61 // Data reduction proxy secure proxy check URL. | 63 // Data reduction proxy secure proxy check URL. |
| 62 "", | 64 "", |
| 63 // MockCertVerifier to use for testing purposes. | 65 // MockCertVerifier to use for testing purposes. |
| 64 std::unique_ptr<net::CertVerifier>(), | 66 std::unique_ptr<net::CertVerifier>(), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 106 |
| 105 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); | 107 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); |
| 106 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); | 108 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); |
| 107 | 109 |
| 108 // Check race_cert_verification. | 110 // Check race_cert_verification. |
| 109 EXPECT_TRUE(params->quic_race_cert_verification); | 111 EXPECT_TRUE(params->quic_race_cert_verification); |
| 110 | 112 |
| 111 // Check AsyncDNS resolver is enabled. | 113 // Check AsyncDNS resolver is enabled. |
| 112 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); | 114 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); |
| 113 | 115 |
| 116 // Check IPv6 is disabled. |
| 117 EXPECT_EQ(net::ADDRESS_FAMILY_IPV4, |
| 118 context->host_resolver()->GetDefaultAddressFamily()); |
| 119 |
| 114 net::HostResolver::RequestInfo info(net::HostPortPair("abcde", 80)); | 120 net::HostResolver::RequestInfo info(net::HostPortPair("abcde", 80)); |
| 115 net::AddressList addresses; | 121 net::AddressList addresses; |
| 116 EXPECT_EQ(net::OK, context->host_resolver()->ResolveFromCache( | 122 EXPECT_EQ(net::OK, context->host_resolver()->ResolveFromCache( |
| 117 info, &addresses, net::NetLogWithSource())); | 123 info, &addresses, net::NetLogWithSource())); |
| 118 } | 124 } |
| 119 | 125 |
| 120 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { | 126 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { |
| 121 URLRequestContextConfig config( | 127 URLRequestContextConfig config( |
| 122 // Enable QUIC. | 128 // Enable QUIC. |
| 123 true, | 129 true, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 context->GetNetworkSessionParams(); | 177 context->GetNetworkSessionParams(); |
| 172 | 178 |
| 173 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); | 179 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); |
| 174 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); | 180 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); |
| 175 EXPECT_TRUE(params->quic_migrate_sessions_early); | 181 EXPECT_TRUE(params->quic_migrate_sessions_early); |
| 176 } | 182 } |
| 177 | 183 |
| 178 // See stale_host_resolver_unittest.cc for test of StaleDNS options. | 184 // See stale_host_resolver_unittest.cc for test of StaleDNS options. |
| 179 | 185 |
| 180 } // namespace cronet | 186 } // namespace cronet |
| OLD | NEW |