Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: components/cronet/url_request_context_config_unittest.cc

Issue 2711153007: Add Cronet experimental option to disable ipv6 (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 "\"disable_ipv6\":true}",
xunjieli 2017/02/27 15:37:39 nit: Add a comment before this line and link a crb
mgersh 2017/02/28 18:29:57 Done.
55 // Data reduction proxy key. 56 // Data reduction proxy key.
56 "", 57 "",
57 // Data reduction proxy. 58 // Data reduction proxy.
58 "", 59 "",
59 // Fallback data reduction proxy. 60 // Fallback data reduction proxy.
60 "", 61 "",
61 // Data reduction proxy secure proxy check URL. 62 // Data reduction proxy secure proxy check URL.
62 "", 63 "",
63 // MockCertVerifier to use for testing purposes. 64 // MockCertVerifier to use for testing purposes.
64 std::unique_ptr<net::CertVerifier>(), 65 std::unique_ptr<net::CertVerifier>(),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 105
105 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); 106 EXPECT_TRUE(params->quic_close_sessions_on_ip_change);
106 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); 107 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change);
107 108
108 // Check race_cert_verification. 109 // Check race_cert_verification.
109 EXPECT_TRUE(params->quic_race_cert_verification); 110 EXPECT_TRUE(params->quic_race_cert_verification);
110 111
111 // Check AsyncDNS resolver is enabled. 112 // Check AsyncDNS resolver is enabled.
112 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); 113 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue());
113 114
115 // Check IPv6 is disabled.
116 EXPECT_EQ(net::ADDRESS_FAMILY_IPV4,
117 context->host_resolver()->GetDefaultAddressFamily());
118
114 net::HostResolver::RequestInfo info(net::HostPortPair("abcde", 80)); 119 net::HostResolver::RequestInfo info(net::HostPortPair("abcde", 80));
115 net::AddressList addresses; 120 net::AddressList addresses;
116 EXPECT_EQ(net::OK, context->host_resolver()->ResolveFromCache( 121 EXPECT_EQ(net::OK, context->host_resolver()->ResolveFromCache(
117 info, &addresses, net::NetLogWithSource())); 122 info, &addresses, net::NetLogWithSource()));
118 } 123 }
119 124
120 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { 125 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) {
121 URLRequestContextConfig config( 126 URLRequestContextConfig config(
122 // Enable QUIC. 127 // Enable QUIC.
123 true, 128 true,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 context->GetNetworkSessionParams(); 176 context->GetNetworkSessionParams();
172 177
173 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); 178 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
174 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); 179 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change);
175 EXPECT_TRUE(params->quic_migrate_sessions_early); 180 EXPECT_TRUE(params->quic_migrate_sessions_early);
176 } 181 }
177 182
178 // See stale_host_resolver_unittest.cc for test of StaleDNS options. 183 // See stale_host_resolver_unittest.cc for test of StaleDNS options.
179 184
180 } // namespace cronet 185 } // namespace cronet
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698