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

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

Issue 2738813004: [Cronet] Write effective experimental options to NetLog (Closed)
Patch Set: Fix use-after-free bug 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, TestExperimentalOptionPassing) { 22 TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) {
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},"
53 "\"HostResolverRules\":{\"host_resolver_rules\":" 54 "\"HostResolverRules\":{\"host_resolver_rules\":"
54 "\"MAP * 127.0.0.1\"}," 55 "\"MAP * 127.0.0.1\"},"
55 // See http://crbug.com/696569. 56 // See http://crbug.com/696569.
56 "\"disable_ipv6\":true}", 57 "\"disable_ipv6\":true}",
57 // Data reduction proxy key. 58 // Data reduction proxy key.
58 "", 59 "",
59 // Data reduction proxy. 60 // Data reduction proxy.
60 "", 61 "",
61 // Fallback data reduction proxy. 62 // Fallback data reduction proxy.
62 "", 63 "",
63 // Data reduction proxy secure proxy check URL. 64 // Data reduction proxy secure proxy check URL.
64 "", 65 "",
65 // MockCertVerifier to use for testing purposes. 66 // MockCertVerifier to use for testing purposes.
66 std::unique_ptr<net::CertVerifier>(), 67 std::unique_ptr<net::CertVerifier>(),
67 // Enable network quality estimator. 68 // Enable network quality estimator.
68 false, 69 false,
69 // Enable Public Key Pinning bypass for local trust anchors. 70 // Enable Public Key Pinning bypass for local trust anchors.
70 true, 71 true,
71 // Certificate verifier cache data. 72 // Certificate verifier cache data.
72 ""); 73 "");
73 74
74 base::MessageLoop message_loop; 75 base::MessageLoop message_loop;
75 net::URLRequestContextBuilder builder; 76 net::URLRequestContextBuilder builder;
76 net::NetLog net_log; 77 net::NetLog net_log;
77 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); 78 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr);
79 EXPECT_FALSE(config.effective_experimental_options->HasKey("UnknownOption"));
78 // Set a ProxyConfigService to avoid DCHECK failure when building. 80 // Set a ProxyConfigService to avoid DCHECK failure when building.
79 builder.set_proxy_config_service( 81 builder.set_proxy_config_service(
80 base::MakeUnique<net::ProxyConfigServiceFixed>( 82 base::MakeUnique<net::ProxyConfigServiceFixed>(
81 net::ProxyConfig::CreateDirect())); 83 net::ProxyConfig::CreateDirect()));
82 std::unique_ptr<net::URLRequestContext> context(builder.Build()); 84 std::unique_ptr<net::URLRequestContext> context(builder.Build());
83 const net::HttpNetworkSession::Params* params = 85 const net::HttpNetworkSession::Params* params =
84 context->GetNetworkSessionParams(); 86 context->GetNetworkSessionParams();
85 // Check Quic Connection options. 87 // Check Quic Connection options.
86 net::QuicTagVector quic_connection_options; 88 net::QuicTagVector quic_connection_options;
87 quic_connection_options.push_back(net::kTIME); 89 quic_connection_options.push_back(net::kTIME);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 context->GetNetworkSessionParams(); 179 context->GetNetworkSessionParams();
178 180
179 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); 181 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
180 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); 182 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change);
181 EXPECT_TRUE(params->quic_migrate_sessions_early); 183 EXPECT_TRUE(params->quic_migrate_sessions_early);
182 } 184 }
183 185
184 // See stale_host_resolver_unittest.cc for test of StaleDNS options. 186 // See stale_host_resolver_unittest.cc for test of StaleDNS options.
185 187
186 } // namespace cronet 188 } // 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