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/values.h" | 7 #include "base/values.h" |
8 #include "net/cert/cert_verifier.h" | 8 #include "net/cert/cert_verifier.h" |
9 #include "net/http/http_network_session.h" | 9 #include "net/http/http_network_session.h" |
10 #include "net/proxy/proxy_config.h" | 10 #include "net/proxy/proxy_config.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 // Check idle_connection_timeout_seconds. | 93 // Check idle_connection_timeout_seconds. |
94 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds); | 94 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds); |
95 | 95 |
96 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); | 96 EXPECT_TRUE(params->quic_close_sessions_on_ip_change); |
97 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); | 97 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change); |
98 | 98 |
99 // Check AsyncDNS resolver is enabled. | 99 // Check AsyncDNS resolver is enabled. |
100 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); | 100 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); |
101 } | 101 } |
102 | 102 |
103 TEST(URLRequestContextConfigTest, SetDNSExperimentalOptions) { | |
pauljensen
2016/04/07 16:29:15
how about we just merge this into SetQuicExperimen
mgersh
2016/06/08 18:31:14
Done.
| |
104 URLRequestContextConfig config( | |
105 // Enable QUIC. | |
106 true, | |
107 // QUIC User Agent ID. | |
108 "Default QUIC User Agent ID", | |
109 // Enable SPDY. | |
110 true, | |
111 // Enable SDCH. | |
112 false, | |
113 // Type of http cache. | |
114 URLRequestContextConfig::HttpCacheType::DISK, | |
115 // Max size of http cache in bytes. | |
116 1024000, | |
117 // Disable caching for HTTP responses. Other information may be stored in | |
118 // the cache. | |
119 false, | |
120 // Storage path for http cache and cookie storage. | |
121 "/data/data/org.chromium.net/app_cronet_test/test_storage", | |
122 // User-Agent request header field. | |
123 "fake agent", | |
124 // JSON encoded experimental options. | |
125 "{\"AsyncDNS\":{\"enable\":true}," | |
126 "\"HostResolverRules\":{\"host_resolver_rules\":" | |
127 "\"MAP * 127.0.0.1\"}}", | |
128 // Data reduction proxy key. | |
129 "", | |
130 // Data reduction proxy. | |
131 "", | |
132 // Fallback data reduction proxy. | |
133 "", | |
134 // Data reduction proxy secure proxy check URL. | |
135 "", | |
136 // MockCertVerifier to use for testing purposes. | |
137 scoped_ptr<net::CertVerifier>()); | |
138 | |
139 net::URLRequestContextBuilder builder; | |
140 net::NetLog net_log; | |
141 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); | |
142 // Set a ProxyConfigService to avoid DCHECK failure when building. | |
143 builder.set_proxy_config_service(make_scoped_ptr( | |
144 new net::ProxyConfigServiceFixed(net::ProxyConfig::CreateDirect()))); | |
145 scoped_ptr<net::URLRequestContext> context(builder.Build()); | |
146 | |
147 // Check that AsyncDNS is still enabled when host resolver rules are used | |
148 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); | |
149 } | |
150 | |
103 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { | 151 TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationOptions) { |
104 URLRequestContextConfig config( | 152 URLRequestContextConfig config( |
105 // Enable QUIC. | 153 // Enable QUIC. |
106 true, | 154 true, |
107 // QUIC User Agent ID. | 155 // QUIC User Agent ID. |
108 "Default QUIC User Agent ID", | 156 "Default QUIC User Agent ID", |
109 // Enable SPDY. | 157 // Enable SPDY. |
110 true, | 158 true, |
111 // Enable SDCH. | 159 // Enable SDCH. |
112 false, | 160 false, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 scoped_ptr<net::URLRequestContext> context(builder.Build()); | 192 scoped_ptr<net::URLRequestContext> context(builder.Build()); |
145 const net::HttpNetworkSession::Params* params = | 193 const net::HttpNetworkSession::Params* params = |
146 context->GetNetworkSessionParams(); | 194 context->GetNetworkSessionParams(); |
147 | 195 |
148 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); | 196 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); |
149 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); | 197 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); |
150 EXPECT_TRUE(params->quic_migrate_sessions_early); | 198 EXPECT_TRUE(params->quic_migrate_sessions_early); |
151 } | 199 } |
152 | 200 |
153 } // namespace cronet | 201 } // namespace cronet |
OLD | NEW |