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

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

Issue 2751113004: Revert of [Cronet] Write effective experimental options to NetLog (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « components/cronet/url_request_context_config.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "net/http/http_network_session.h" 11 #include "net/http/http_network_session.h"
12 #include "net/log/net_log.h" 12 #include "net/log/net_log.h"
13 #include "net/log/net_log_with_source.h" 13 #include "net/log/net_log_with_source.h"
14 #include "net/proxy/proxy_config.h" 14 #include "net/proxy/proxy_config.h"
15 #include "net/proxy/proxy_config_service_fixed.h" 15 #include "net/proxy/proxy_config_service_fixed.h"
16 #include "net/url_request/url_request_context.h" 16 #include "net/url_request/url_request_context.h"
17 #include "net/url_request/url_request_context_builder.h" 17 #include "net/url_request/url_request_context_builder.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 namespace cronet { 20 namespace cronet {
21 21
22 TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) { 22 TEST(URLRequestContextConfigTest, TestExperimentalOptionPassing) {
23 URLRequestContextConfig config( 23 URLRequestContextConfig config(
24 // Enable QUIC. 24 // Enable QUIC.
25 true, 25 true,
26 // QUIC User Agent ID. 26 // QUIC User Agent ID.
27 "Default QUIC User Agent ID", 27 "Default QUIC User Agent ID",
28 // Enable SPDY. 28 // Enable SPDY.
29 true, 29 true,
30 // Enable SDCH. 30 // Enable SDCH.
31 false, 31 false,
32 // Type of http cache. 32 // Type of http cache.
(...skipping 10 matching lines...) Expand all
43 // JSON encoded experimental options. 43 // JSON encoded experimental options.
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 "\"UnknownOption\":{\"foo\":true},"
54 "\"HostResolverRules\":{\"host_resolver_rules\":" 53 "\"HostResolverRules\":{\"host_resolver_rules\":"
55 "\"MAP * 127.0.0.1\"}," 54 "\"MAP * 127.0.0.1\"},"
56 // See http://crbug.com/696569. 55 // See http://crbug.com/696569.
57 "\"disable_ipv6\":true}", 56 "\"disable_ipv6\":true}",
58 // Data reduction proxy key. 57 // Data reduction proxy key.
59 "", 58 "",
60 // Data reduction proxy. 59 // Data reduction proxy.
61 "", 60 "",
62 // Fallback data reduction proxy. 61 // Fallback data reduction proxy.
63 "", 62 "",
64 // Data reduction proxy secure proxy check URL. 63 // Data reduction proxy secure proxy check URL.
65 "", 64 "",
66 // MockCertVerifier to use for testing purposes. 65 // MockCertVerifier to use for testing purposes.
67 std::unique_ptr<net::CertVerifier>(), 66 std::unique_ptr<net::CertVerifier>(),
68 // Enable network quality estimator. 67 // Enable network quality estimator.
69 false, 68 false,
70 // Enable Public Key Pinning bypass for local trust anchors. 69 // Enable Public Key Pinning bypass for local trust anchors.
71 true, 70 true,
72 // Certificate verifier cache data. 71 // Certificate verifier cache data.
73 ""); 72 "");
74 73
75 base::MessageLoop message_loop; 74 base::MessageLoop message_loop;
76 net::URLRequestContextBuilder builder; 75 net::URLRequestContextBuilder builder;
77 net::NetLog net_log; 76 net::NetLog net_log;
78 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); 77 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr);
79 EXPECT_FALSE(config.effective_experimental_options->HasKey("UnknownOption"));
80 // Set a ProxyConfigService to avoid DCHECK failure when building. 78 // Set a ProxyConfigService to avoid DCHECK failure when building.
81 builder.set_proxy_config_service( 79 builder.set_proxy_config_service(
82 base::MakeUnique<net::ProxyConfigServiceFixed>( 80 base::MakeUnique<net::ProxyConfigServiceFixed>(
83 net::ProxyConfig::CreateDirect())); 81 net::ProxyConfig::CreateDirect()));
84 std::unique_ptr<net::URLRequestContext> context(builder.Build()); 82 std::unique_ptr<net::URLRequestContext> context(builder.Build());
85 const net::HttpNetworkSession::Params* params = 83 const net::HttpNetworkSession::Params* params =
86 context->GetNetworkSessionParams(); 84 context->GetNetworkSessionParams();
87 // Check Quic Connection options. 85 // Check Quic Connection options.
88 net::QuicTagVector quic_connection_options; 86 net::QuicTagVector quic_connection_options;
89 quic_connection_options.push_back(net::kTIME); 87 quic_connection_options.push_back(net::kTIME);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 context->GetNetworkSessionParams(); 177 context->GetNetworkSessionParams();
180 178
181 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); 179 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
182 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); 180 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change);
183 EXPECT_TRUE(params->quic_migrate_sessions_early); 181 EXPECT_TRUE(params->quic_migrate_sessions_early);
184 } 182 }
185 183
186 // See stale_host_resolver_unittest.cc for test of StaleDNS options. 184 // See stale_host_resolver_unittest.cc for test of StaleDNS options.
187 185
188 } // namespace cronet 186 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/url_request_context_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698