| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 "\"UnknownOption\":{\"foo\":true}," | 53 "\"UnknownOption\":{\"foo\":true}," |
| 54 "\"HostResolverRules\":{\"host_resolver_rules\":" | 54 "\"HostResolverRules\":{\"host_resolver_rules\":" |
| 55 "\"MAP * 127.0.0.1\"}," | 55 "\"MAP * 127.0.0.1\"}," |
| 56 // See http://crbug.com/696569. | 56 // See http://crbug.com/696569. |
| 57 "\"disable_ipv6\":true}", | 57 "\"disable_ipv6_on_wifi\":true}", |
| 58 // Data reduction proxy key. | 58 // Data reduction proxy key. |
| 59 "", | 59 "", |
| 60 // Data reduction proxy. | 60 // Data reduction proxy. |
| 61 "", | 61 "", |
| 62 // Fallback data reduction proxy. | 62 // Fallback data reduction proxy. |
| 63 "", | 63 "", |
| 64 // Data reduction proxy secure proxy check URL. | 64 // Data reduction proxy secure proxy check URL. |
| 65 "", | 65 "", |
| 66 // MockCertVerifier to use for testing purposes. | 66 // MockCertVerifier to use for testing purposes. |
| 67 std::unique_ptr<net::CertVerifier>(), | 67 std::unique_ptr<net::CertVerifier>(), |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); | 109 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); |
| 110 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); | 110 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); |
| 111 | 111 |
| 112 // Check race_cert_verification. | 112 // Check race_cert_verification. |
| 113 EXPECT_TRUE(params->quic_race_cert_verification); | 113 EXPECT_TRUE(params->quic_race_cert_verification); |
| 114 | 114 |
| 115 // Check AsyncDNS resolver is enabled. | 115 // Check AsyncDNS resolver is enabled. |
| 116 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); | 116 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); |
| 117 | 117 |
| 118 // Check IPv6 is disabled. | 118 // Check IPv6 is disabled when on wifi. |
| 119 EXPECT_EQ(net::ADDRESS_FAMILY_IPV4, | 119 EXPECT_TRUE(context->host_resolver()->GetNoIPv6OnWifi()); |
| 120 context->host_resolver()->GetDefaultAddressFamily()); | |
| 121 | 120 |
| 122 net::HostResolver::RequestInfo info(net::HostPortPair("abcde", 80)); | 121 net::HostResolver::RequestInfo info(net::HostPortPair("abcde", 80)); |
| 123 net::AddressList addresses; | 122 net::AddressList addresses; |
| 124 EXPECT_EQ(net::OK, context->host_resolver()->ResolveFromCache( | 123 EXPECT_EQ(net::OK, context->host_resolver()->ResolveFromCache( |
| 125 info, &addresses, net::NetLogWithSource())); | 124 info, &addresses, net::NetLogWithSource())); |
| 126 } | 125 } |
| 127 | 126 |
| 128 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { | 127 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { |
| 129 URLRequestContextConfig config( | 128 URLRequestContextConfig config( |
| 130 // Enable QUIC. | 129 // Enable QUIC. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 context->GetNetworkSessionParams(); | 178 context->GetNetworkSessionParams(); |
| 180 | 179 |
| 181 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); | 180 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); |
| 182 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); | 181 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); |
| 183 EXPECT_TRUE(params->quic_migrate_sessions_early); | 182 EXPECT_TRUE(params->quic_migrate_sessions_early); |
| 184 } | 183 } |
| 185 | 184 |
| 186 // See stale_host_resolver_unittest.cc for test of StaleDNS options. | 185 // See stale_host_resolver_unittest.cc for test of StaleDNS options. |
| 187 | 186 |
| 188 } // namespace cronet | 187 } // namespace cronet |
| OLD | NEW |