blob: 3143fcd8646d1706527da626a849997a89cc2e10 [file] [log] [blame]
xunjielif24ee5f2015-11-23 18:05:261// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/cronet/url_request_context_config.h"
6
Gyuyoung Kim6afb5082018-01-19 13:35:577#include <memory>
8
Eric Orthe1cdd902019-02-26 02:52:469#include "base/bind.h"
Julia Tuttle3cc27a4a2018-04-25 15:57:0610#include "base/json/json_writer.h"
Eric Orthe1cdd902019-02-26 02:52:4611#include "base/logging.h"
Douglas Creagera220947e2018-08-23 20:08:5312#include "base/strings/string_piece.h"
mmenke51629db12017-06-28 13:34:1213#include "base/test/scoped_task_environment.h"
Douglas Creagera220947e2018-08-23 20:08:5314#include "base/test/values_test_util.h"
tfhef3618f2016-01-11 23:07:0815#include "base/values.h"
Zhongyi Shiaa518c22018-06-15 04:37:3616#include "build/build_config.h"
Eric Orthe1cdd902019-02-26 02:52:4617#include "net/base/host_port_pair.h"
Matt Menked732ea42019-03-08 12:05:0018#include "net/base/http_user_agent_settings.h"
Eric Orthe1cdd902019-02-26 02:52:4619#include "net/base/net_errors.h"
pauljensen9041eb3c2015-12-09 12:29:0120#include "net/cert/cert_verifier.h"
Eric Orthe1cdd902019-02-26 02:52:4621#include "net/dns/host_resolver.h"
xunjielif24ee5f2015-11-23 18:05:2622#include "net/http/http_network_session.h"
mikecironef22f9812016-10-04 03:40:1923#include "net/log/net_log.h"
24#include "net/log/net_log_with_source.h"
Lily Houghton582d4622018-01-22 22:43:4025#include "net/proxy_resolution/proxy_config.h"
26#include "net/proxy_resolution/proxy_config_service_fixed.h"
xunjielif24ee5f2015-11-23 18:05:2627#include "net/url_request/url_request_context.h"
28#include "net/url_request/url_request_context_builder.h"
29#include "testing/gtest/include/gtest/gtest.h"
30
Douglas Creagera220947e2018-08-23 20:08:5331#if BUILDFLAG(ENABLE_REPORTING)
32#include "net/network_error_logging/network_error_logging_service.h"
33#include "net/reporting/reporting_service.h"
34#endif // BUILDFLAG(ENABLE_REPORTING)
35
xunjielif24ee5f2015-11-23 18:05:2636namespace cronet {
37
Douglas Creagera220947e2018-08-23 20:08:5338namespace {
39
Douglas Creagera220947e2018-08-23 20:08:5340std::string WrapJsonHeader(base::StringPiece value) {
41 std::string result;
42 result.reserve(value.size() + 2);
43 result.push_back('[');
44 value.AppendToString(&result);
45 result.push_back(']');
46 return result;
47}
48
49// Returns whether two JSON-encoded headers contain the same content, ignoring
50// irrelevant encoding issues like whitespace and map element ordering.
51bool JsonHeaderEquals(base::StringPiece expected, base::StringPiece actual) {
Lei Zhang9b9d5792019-02-20 07:24:4252 return base::test::ParseJson(WrapJsonHeader(expected)) ==
53 base::test::ParseJson(WrapJsonHeader(actual));
Douglas Creagera220947e2018-08-23 20:08:5354}
55
56} // namespace
57
mmenke51629db12017-06-28 13:34:1258TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) {
59 base::test::ScopedTaskEnvironment scoped_task_environment_(
60 base::test::ScopedTaskEnvironment::MainThreadType::IO);
61
Julia Tuttle3cc27a4a2018-04-25 15:57:0662 // Create JSON for experimental options.
63 base::DictionaryValue options;
64 options.SetPath({"QUIC", "max_server_configs_stored_in_properties"},
65 base::Value(2));
66 options.SetPath({"QUIC", "user_agent_id"}, base::Value("Custom QUIC UAID"));
67 options.SetPath({"QUIC", "idle_connection_timeout_seconds"},
68 base::Value(300));
69 options.SetPath({"QUIC", "close_sessions_on_ip_change"}, base::Value(true));
70 options.SetPath({"QUIC", "race_cert_verification"}, base::Value(true));
71 options.SetPath({"QUIC", "connection_options"}, base::Value("TIME,TBBR,REJ"));
72 options.SetPath({"AsyncDNS", "enable"}, base::Value(true));
73 options.SetPath({"NetworkErrorLogging", "enable"}, base::Value(true));
Douglas Creagera220947e2018-08-23 20:08:5374 options.SetPath({"NetworkErrorLogging", "preloaded_report_to_headers"},
Lei Zhang9b9d5792019-02-20 07:24:4275 base::test::ParseJson(R"json(
Douglas Creagera220947e2018-08-23 20:08:5376 [
77 {
78 "origin": "https://test-origin/",
79 "value": {
80 "group": "test-group",
81 "max_age": 86400,
82 "endpoints": [
83 {"url": "https://test-endpoint/"},
84 ],
85 },
86 },
87 {
88 "origin": "https://test-origin-2/",
89 "value": [
90 {
91 "group": "test-group-2",
92 "max_age": 86400,
93 "endpoints": [
94 {"url": "https://test-endpoint-2/"},
95 ],
96 },
97 {
98 "group": "test-group-3",
99 "max_age": 86400,
100 "endpoints": [
101 {"url": "https://test-endpoint-3/"},
102 ],
103 },
104 ],
105 },
106 {
107 "origin": "https://value-is-missing/",
108 },
109 {
110 "value": "origin is missing",
111 },
112 {
113 "origin": 123,
114 "value": "origin is not a string",
115 },
116 {
117 "origin": "this is not a URL",
118 "value": "origin not a URL",
119 },
120 ]
121 )json"));
122 options.SetPath({"NetworkErrorLogging", "preloaded_nel_headers"},
Lei Zhang9b9d5792019-02-20 07:24:42123 base::test::ParseJson(R"json(
Douglas Creagera220947e2018-08-23 20:08:53124 [
125 {
126 "origin": "https://test-origin/",
127 "value": {
128 "report_to": "test-group",
129 "max_age": 86400,
130 },
131 },
132 ]
133 )json"));
Julia Tuttle3cc27a4a2018-04-25 15:57:06134 options.SetPath({"UnknownOption", "foo"}, base::Value(true));
135 options.SetPath({"HostResolverRules", "host_resolver_rules"},
136 base::Value("MAP * 127.0.0.1"));
137 // See http://crbug.com/696569.
138 options.SetKey("disable_ipv6_on_wifi", base::Value(true));
139 std::string options_json;
140 EXPECT_TRUE(base::JSONWriter::Write(options, &options_json));
141
pauljensen9041eb3c2015-12-09 12:29:01142 URLRequestContextConfig config(
143 // Enable QUIC.
144 true,
mefc5da5712016-02-09 20:14:23145 // QUIC User Agent ID.
146 "Default QUIC User Agent ID",
pauljensen9041eb3c2015-12-09 12:29:01147 // Enable SPDY.
148 true,
xunjieli186d2bf2017-04-18 13:45:47149 // Enable Brotli.
150 false,
pauljensen9041eb3c2015-12-09 12:29:01151 // Type of http cache.
152 URLRequestContextConfig::HttpCacheType::DISK,
153 // Max size of http cache in bytes.
154 1024000,
155 // Disable caching for HTTP responses. Other information may be stored in
156 // the cache.
157 false,
158 // Storage path for http cache and cookie storage.
159 "/data/data/org.chromium.net/app_cronet_test/test_storage",
Misha Efimovd4ab38302018-01-30 23:56:42160 // Accept-Language request header field.
161 "foreign-language",
pauljensen9041eb3c2015-12-09 12:29:01162 // User-Agent request header field.
163 "fake agent",
164 // JSON encoded experimental options.
Julia Tuttle3cc27a4a2018-04-25 15:57:06165 options_json,
pauljensen9041eb3c2015-12-09 12:29:01166 // MockCertVerifier to use for testing purposes.
tbansal7018e2a2016-06-25 00:40:39167 std::unique_ptr<net::CertVerifier>(),
168 // Enable network quality estimator.
kapishnikov385aa422016-07-01 20:53:02169 false,
170 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41171 true,
172 // Optional network thread priority.
173 base::Optional<double>(42.0));
xunjielif24ee5f2015-11-23 18:05:26174
xunjielif24ee5f2015-11-23 18:05:26175 net::URLRequestContextBuilder builder;
pauljensene92c4092015-12-09 19:13:48176 net::NetLog net_log;
David Benjamindc2f4b02017-07-27 23:59:02177 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
xunjielid67295e2017-03-16 21:05:41178 EXPECT_FALSE(config.effective_experimental_options->HasKey("UnknownOption"));
xunjielif24ee5f2015-11-23 18:05:26179 // Set a ProxyConfigService to avoid DCHECK failure when building.
ricea85ec57952016-08-31 09:34:10180 builder.set_proxy_config_service(
Lily Houghtonef028852017-12-06 20:52:30181 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49182 net::ProxyConfigWithAnnotation::CreateDirect()));
dchengfe3745e6242016-04-21 23:49:58183 std::unique_ptr<net::URLRequestContext> context(builder.Build());
xunjielif24ee5f2015-11-23 18:05:26184 const net::HttpNetworkSession::Params* params =
185 context->GetNetworkSessionParams();
186 // Check Quic Connection options.
Ryan Hamilton8d9ee76e2018-05-29 23:52:52187 quic::QuicTagVector quic_connection_options;
188 quic_connection_options.push_back(quic::kTIME);
189 quic_connection_options.push_back(quic::kTBBR);
190 quic_connection_options.push_back(quic::kREJ);
xunjielif24ee5f2015-11-23 18:05:26191 EXPECT_EQ(quic_connection_options, params->quic_connection_options);
192
mefc5da5712016-02-09 20:14:23193 // Check Custom QUIC User Agent Id.
194 EXPECT_EQ("Custom QUIC UAID", params->quic_user_agent_id);
195
rtenneti6971c172016-01-15 20:12:10196 // Check max_server_configs_stored_in_properties.
197 EXPECT_EQ(2u, params->quic_max_server_configs_stored_in_properties);
xunjielif24ee5f2015-11-23 18:05:26198
rtenneti64e809d02015-12-11 00:26:20199 // Check idle_connection_timeout_seconds.
200 EXPECT_EQ(300, params->quic_idle_connection_timeout_seconds);
201
Jana Iyengar903dec22017-11-28 00:44:23202 EXPECT_TRUE(params->quic_close_sessions_on_ip_change);
Zhongyi Shi63574b72018-06-01 20:22:25203 EXPECT_FALSE(params->quic_goaway_sessions_on_ip_change);
Zhongyi Shi8ff38c12018-02-22 00:02:30204 EXPECT_FALSE(params->quic_allow_server_migration);
Zhongyi Shi64795622017-11-20 02:21:49205 EXPECT_FALSE(params->quic_migrate_sessions_on_network_change_v2);
Zhongyi Shif4683a32017-12-01 00:03:28206 EXPECT_FALSE(params->quic_migrate_sessions_early_v2);
Zhongyi Shi32fe14d42019-02-28 00:25:36207 EXPECT_FALSE(params->quic_migrate_idle_sessions);
Zhongyi Shiff359581bc2018-09-26 18:11:48208 EXPECT_FALSE(params->quic_retry_on_alternate_network_before_handshake);
Renjie94b90712018-10-18 21:03:19209 EXPECT_FALSE(params->quic_race_stale_dns_on_connection);
jrid26566952016-02-04 21:06:42210
rtennetid073dd22016-08-04 01:58:33211 // Check race_cert_verification.
212 EXPECT_TRUE(params->quic_race_cert_verification);
213
Misha Efimov63957912017-12-06 07:13:26214#if defined(ENABLE_BUILT_IN_DNS)
215 // Check AsyncDNS resolver is enabled (not supported on iOS).
tfhef3618f2016-01-11 23:07:08216 EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue());
Misha Efimov63957912017-12-06 07:13:26217#endif // defined(ENABLE_BUILT_IN_DNS)
mgershaf2c12c2016-08-22 16:33:54218
Julia Tuttle9715d1642018-01-29 17:02:26219#if BUILDFLAG(ENABLE_REPORTING)
220 // Check Reporting and Network Error Logging are enabled (can be disabled at
221 // build time).
222 EXPECT_TRUE(context->reporting_service());
Julia Tuttlecba7d222018-02-23 19:37:27223 EXPECT_TRUE(context->network_error_logging_service());
Julia Tuttle9715d1642018-01-29 17:02:26224#endif // BUILDFLAG(ENABLE_REPORTING)
225
Douglas Creagera220947e2018-08-23 20:08:53226 ASSERT_EQ(2u, config.preloaded_report_to_headers.size());
227 EXPECT_EQ(url::Origin::CreateFromNormalizedTuple("https", "test-origin", 443),
228 config.preloaded_report_to_headers[0].origin);
229 EXPECT_TRUE(JsonHeaderEquals( //
230 R"json(
231 {
232 "group": "test-group",
233 "max_age": 86400,
234 "endpoints": [
235 {"url": "https://test-endpoint/"},
236 ],
237 }
238 )json",
239 config.preloaded_report_to_headers[0].value));
240 EXPECT_EQ(
241 url::Origin::CreateFromNormalizedTuple("https", "test-origin-2", 443),
242 config.preloaded_report_to_headers[1].origin);
243 EXPECT_TRUE(JsonHeaderEquals( //
244 R"json(
245 {
246 "group": "test-group-2",
247 "max_age": 86400,
248 "endpoints": [
249 {"url": "https://test-endpoint-2/"},
250 ],
251 },
252 {
253 "group": "test-group-3",
254 "max_age": 86400,
255 "endpoints": [
256 {"url": "https://test-endpoint-3/"},
257 ],
258 }
259 )json",
260 config.preloaded_report_to_headers[1].value));
261
262 ASSERT_EQ(1u, config.preloaded_nel_headers.size());
263 EXPECT_EQ(url::Origin::CreateFromNormalizedTuple("https", "test-origin", 443),
264 config.preloaded_nel_headers[0].origin);
265 EXPECT_TRUE(JsonHeaderEquals( //
266 R"json(
267 {
268 "report_to": "test-group",
269 "max_age": 86400,
270 }
271 )json",
272 config.preloaded_nel_headers[0].value));
273
mgershaf9a9232017-04-13 20:19:03274 // Check IPv6 is disabled when on wifi.
275 EXPECT_TRUE(context->host_resolver()->GetNoIPv6OnWifi());
mgershb3fe8082017-02-28 20:09:20276
Eric Orthe1cdd902019-02-26 02:52:46277 // All host resolution expected to be mapped to an immediately-resolvable IP.
278 std::unique_ptr<net::HostResolver::ResolveHostRequest> resolve_request =
279 context->host_resolver()->CreateRequest(net::HostPortPair("abcde", 80),
280 net::NetLogWithSource(),
281 base::nullopt);
282 EXPECT_EQ(net::OK, resolve_request->Start(
283 base::BindOnce([](int error) { NOTREACHED(); })));
Paul Jensen6a1ea3a2018-08-24 14:46:41284
285 EXPECT_TRUE(config.network_thread_priority);
286 EXPECT_EQ(42.0, config.network_thread_priority.value());
xunjielif24ee5f2015-11-23 18:05:26287}
288
Zhongyi Shi57247962018-11-05 20:03:52289TEST(URLRequestContextConfigTest, SetSupportedQuicVersion) {
290 base::test::ScopedTaskEnvironment scoped_task_environment_(
291 base::test::ScopedTaskEnvironment::MainThreadType::IO);
292
293 URLRequestContextConfig config(
294 // Enable QUIC.
295 true,
296 // QUIC User Agent ID.
297 "Default QUIC User Agent ID",
298 // Enable SPDY.
299 true,
300 // Enable Brotli.
301 false,
302 // Type of http cache.
303 URLRequestContextConfig::HttpCacheType::DISK,
304 // Max size of http cache in bytes.
305 1024000,
306 // Disable caching for HTTP responses. Other information may be stored in
307 // the cache.
308 false,
309 // Storage path for http cache and cookie storage.
310 "/data/data/org.chromium.net/app_cronet_test/test_storage",
311 // Accept-Language request header field.
312 "foreign-language",
313 // User-Agent request header field.
314 "fake agent",
315 // JSON encoded experimental options.
316 "{\"QUIC\":{\"quic_version\":\"QUIC_VERSION_44\"}}",
317 // MockCertVerifier to use for testing purposes.
318 std::unique_ptr<net::CertVerifier>(),
319 // Enable network quality estimator.
320 false,
321 // Enable Public Key Pinning bypass for local trust anchors.
322 true,
323 // Optional network thread priority.
324 base::Optional<double>());
325
326 net::URLRequestContextBuilder builder;
327 net::NetLog net_log;
328 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
329 // Set a ProxyConfigService to avoid DCHECK failure when building.
330 builder.set_proxy_config_service(
331 std::make_unique<net::ProxyConfigServiceFixed>(
332 net::ProxyConfigWithAnnotation::CreateDirect()));
333 std::unique_ptr<net::URLRequestContext> context(builder.Build());
334 const net::HttpNetworkSession::Params* params =
335 context->GetNetworkSessionParams();
336 EXPECT_EQ(params->quic_supported_versions.size(), 1u);
Nick Harper23290b82019-05-02 00:02:56337 EXPECT_EQ(params->quic_supported_versions[0],
338 quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO,
339 quic::QUIC_VERSION_44));
Zhongyi Shi57247962018-11-05 20:03:52340}
341
342TEST(URLRequestContextConfigTest, SetUnsupportedQuicVersion) {
343 base::test::ScopedTaskEnvironment scoped_task_environment_(
344 base::test::ScopedTaskEnvironment::MainThreadType::IO);
345
346 URLRequestContextConfig config(
347 // Enable QUIC.
348 true,
349 // QUIC User Agent ID.
350 "Default QUIC User Agent ID",
351 // Enable SPDY.
352 true,
353 // Enable Brotli.
354 false,
355 // Type of http cache.
356 URLRequestContextConfig::HttpCacheType::DISK,
357 // Max size of http cache in bytes.
358 1024000,
359 // Disable caching for HTTP responses. Other information may be stored in
360 // the cache.
361 false,
362 // Storage path for http cache and cookie storage.
363 "/data/data/org.chromium.net/app_cronet_test/test_storage",
364 // Accept-Language request header field.
365 "foreign-language",
366 // User-Agent request header field.
367 "fake agent",
368 // JSON encoded experimental options.
369 "{\"QUIC\":{\"quic_version\":\"QUIC_VERSION_33\"}}",
370 // MockCertVerifier to use for testing purposes.
371 std::unique_ptr<net::CertVerifier>(),
372 // Enable network quality estimator.
373 false,
374 // Enable Public Key Pinning bypass for local trust anchors.
375 true,
376 // Optional network thread priority.
377 base::Optional<double>());
378
379 net::URLRequestContextBuilder builder;
380 net::NetLog net_log;
381 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
382 // Set a ProxyConfigService to avoid DCHECK failure when building.
383 builder.set_proxy_config_service(
384 std::make_unique<net::ProxyConfigServiceFixed>(
385 net::ProxyConfigWithAnnotation::CreateDirect()));
386 std::unique_ptr<net::URLRequestContext> context(builder.Build());
387 const net::HttpNetworkSession::Params* params =
388 context->GetNetworkSessionParams();
389 EXPECT_EQ(params->quic_supported_versions.size(), 1u);
Nick Harper23290b82019-05-02 00:02:56390 EXPECT_EQ(params->quic_supported_versions[0],
391 quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO,
392 quic::QUIC_VERSION_43));
Zhongyi Shi57247962018-11-05 20:03:52393}
394
Zhongyi Shi8ff38c12018-02-22 00:02:30395TEST(URLRequestContextConfigTest, SetQuicServerMigrationOptions) {
396 base::test::ScopedTaskEnvironment scoped_task_environment_(
397 base::test::ScopedTaskEnvironment::MainThreadType::IO);
398
399 URLRequestContextConfig config(
400 // Enable QUIC.
401 true,
402 // QUIC User Agent ID.
403 "Default QUIC User Agent ID",
404 // Enable SPDY.
405 true,
406 // Enable Brotli.
407 false,
408 // Type of http cache.
409 URLRequestContextConfig::HttpCacheType::DISK,
410 // Max size of http cache in bytes.
411 1024000,
412 // Disable caching for HTTP responses. Other information may be stored in
413 // the cache.
414 false,
415 // Storage path for http cache and cookie storage.
416 "/data/data/org.chromium.net/app_cronet_test/test_storage",
417 // Accept-Language request header field.
418 "foreign-language",
419 // User-Agent request header field.
420 "fake agent",
421 // JSON encoded experimental options.
422 "{\"QUIC\":{\"allow_server_migration\":true}}",
423 // MockCertVerifier to use for testing purposes.
424 std::unique_ptr<net::CertVerifier>(),
425 // Enable network quality estimator.
426 false,
427 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41428 true,
429 // Optional network thread priority.
430 base::Optional<double>());
Zhongyi Shi8ff38c12018-02-22 00:02:30431
432 net::URLRequestContextBuilder builder;
433 net::NetLog net_log;
434 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
435 // Set a ProxyConfigService to avoid DCHECK failure when building.
436 builder.set_proxy_config_service(
437 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49438 net::ProxyConfigWithAnnotation::CreateDirect()));
Zhongyi Shi8ff38c12018-02-22 00:02:30439 std::unique_ptr<net::URLRequestContext> context(builder.Build());
440 const net::HttpNetworkSession::Params* params =
441 context->GetNetworkSessionParams();
442
443 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
444 EXPECT_TRUE(params->quic_allow_server_migration);
445}
446
Zhongyi Shiaa518c22018-06-15 04:37:36447// Test that goaway_sessions_on_ip_change is set on by default for iOS.
448#if defined(OS_IOS)
449#define MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault \
450 SetQuicGoAwaySessionsOnIPChangeByDefault
451#else
452#define MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault \
453 DISABLED_SetQuicGoAwaySessionsOnIPChangeByDefault
454#endif
455TEST(URLRequestContextConfigTest,
456 MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault) {
457 base::test::ScopedTaskEnvironment scoped_task_environment_(
458 base::test::ScopedTaskEnvironment::MainThreadType::IO);
459
460 URLRequestContextConfig config(
461 // Enable QUIC.
462 true,
463 // QUIC User Agent ID.
464 "Default QUIC User Agent ID",
465 // Enable SPDY.
466 true,
467 // Enable Brotli.
468 false,
469 // Type of http cache.
470 URLRequestContextConfig::HttpCacheType::DISK,
471 // Max size of http cache in bytes.
472 1024000,
473 // Disable caching for HTTP responses. Other information may be stored in
474 // the cache.
475 false,
476 // Storage path for http cache and cookie storage.
477 "/data/data/org.chromium.net/app_cronet_test/test_storage",
478 // Accept-Language request header field.
479 "foreign-language",
480 // User-Agent request header field.
481 "fake agent",
482 // JSON encoded experimental options.
483 "{\"QUIC\":{}}",
484 // MockCertVerifier to use for testing purposes.
485 std::unique_ptr<net::CertVerifier>(),
486 // Enable network quality estimator.
487 false,
488 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41489 true,
490 // Optional network thread priority.
491 base::Optional<double>());
Zhongyi Shiaa518c22018-06-15 04:37:36492
493 net::URLRequestContextBuilder builder;
494 net::NetLog net_log;
495 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
496 // Set a ProxyConfigService to avoid DCHECK failure when building.
497 builder.set_proxy_config_service(
498 std::make_unique<net::ProxyConfigServiceFixed>(
499 net::ProxyConfigWithAnnotation::CreateDirect()));
500 std::unique_ptr<net::URLRequestContext> context(builder.Build());
501 const net::HttpNetworkSession::Params* params =
502 context->GetNetworkSessionParams();
503
504 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
505 EXPECT_TRUE(params->quic_goaway_sessions_on_ip_change);
506}
507
508// Tests that goaway_sessions_on_ip_changes can be set on via
509// experimental options on non-iOS.
510#if !defined(OS_IOS)
511#define MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions \
512 SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions
513#else
514#define MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions \
515 DISABLED_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions
516#endif
517TEST(URLRequestContextConfigTest,
518 MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions) {
Zhongyi Shi63574b72018-06-01 20:22:25519 base::test::ScopedTaskEnvironment scoped_task_environment_(
520 base::test::ScopedTaskEnvironment::MainThreadType::IO);
521
522 URLRequestContextConfig config(
523 // Enable QUIC.
524 true,
525 // QUIC User Agent ID.
526 "Default QUIC User Agent ID",
527 // Enable SPDY.
528 true,
529 // Enable Brotli.
530 false,
531 // Type of http cache.
532 URLRequestContextConfig::HttpCacheType::DISK,
533 // Max size of http cache in bytes.
534 1024000,
535 // Disable caching for HTTP responses. Other information may be stored in
536 // the cache.
537 false,
538 // Storage path for http cache and cookie storage.
539 "/data/data/org.chromium.net/app_cronet_test/test_storage",
540 // Accept-Language request header field.
541 "foreign-language",
542 // User-Agent request header field.
543 "fake agent",
544 // JSON encoded experimental options.
545 "{\"QUIC\":{\"goaway_sessions_on_ip_change\":true}}",
546 // MockCertVerifier to use for testing purposes.
547 std::unique_ptr<net::CertVerifier>(),
548 // Enable network quality estimator.
549 false,
550 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41551 true,
552 // Optional network thread priority.
553 base::Optional<double>());
Zhongyi Shi63574b72018-06-01 20:22:25554
555 net::URLRequestContextBuilder builder;
556 net::NetLog net_log;
557 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
558 // Set a ProxyConfigService to avoid DCHECK failure when building.
559 builder.set_proxy_config_service(
560 std::make_unique<net::ProxyConfigServiceFixed>(
561 net::ProxyConfigWithAnnotation::CreateDirect()));
562 std::unique_ptr<net::URLRequestContext> context(builder.Build());
563 const net::HttpNetworkSession::Params* params =
564 context->GetNetworkSessionParams();
565
566 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
567 EXPECT_TRUE(params->quic_goaway_sessions_on_ip_change);
568}
569
Zhongyi Shiaa518c22018-06-15 04:37:36570// Test that goaway_sessions_on_ip_change can be set to false via
571// exprimental options on iOS.
572#if defined(OS_IOS)
573#define MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions \
574 DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions
575#else
576#define MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions \
577 DISABLED_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions
578#endif
579TEST(URLRequestContextConfigTest,
580 MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions) {
581 base::test::ScopedTaskEnvironment scoped_task_environment_(
582 base::test::ScopedTaskEnvironment::MainThreadType::IO);
583
584 URLRequestContextConfig config(
585 // Enable QUIC.
586 true,
587 // QUIC User Agent ID.
588 "Default QUIC User Agent ID",
589 // Enable SPDY.
590 true,
591 // Enable Brotli.
592 false,
593 // Type of http cache.
594 URLRequestContextConfig::HttpCacheType::DISK,
595 // Max size of http cache in bytes.
596 1024000,
597 // Disable caching for HTTP responses. Other information may be stored in
598 // the cache.
599 false,
600 // Storage path for http cache and cookie storage.
601 "/data/data/org.chromium.net/app_cronet_test/test_storage",
602 // Accept-Language request header field.
603 "foreign-language",
604 // User-Agent request header field.
605 "fake agent",
606 // JSON encoded experimental options.
607 "{\"QUIC\":{\"goaway_sessions_on_ip_change\":false}}",
608 // MockCertVerifier to use for testing purposes.
609 std::unique_ptr<net::CertVerifier>(),
610 // Enable network quality estimator.
611 false,
612 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41613 true,
614 // Optional network thread priority.
615 base::Optional<double>());
Zhongyi Shiaa518c22018-06-15 04:37:36616
617 net::URLRequestContextBuilder builder;
618 net::NetLog net_log;
619 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
620 // Set a ProxyConfigService to avoid DCHECK failure when building.
621 builder.set_proxy_config_service(
622 std::make_unique<net::ProxyConfigServiceFixed>(
623 net::ProxyConfigWithAnnotation::CreateDirect()));
624 std::unique_ptr<net::URLRequestContext> context(builder.Build());
625 const net::HttpNetworkSession::Params* params =
626 context->GetNetworkSessionParams();
627
628 EXPECT_FALSE(params->quic_close_sessions_on_ip_change);
629 EXPECT_FALSE(params->quic_goaway_sessions_on_ip_change);
630}
631
Yixin Wang10f477ed2017-11-21 04:20:20632TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) {
Zhongyi Shi64795622017-11-20 02:21:49633 base::test::ScopedTaskEnvironment scoped_task_environment_(
634 base::test::ScopedTaskEnvironment::MainThreadType::IO);
635
636 URLRequestContextConfig config(
637 // Enable QUIC.
638 true,
639 // QUIC User Agent ID.
640 "Default QUIC User Agent ID",
641 // Enable SPDY.
642 true,
643 // Enable Brotli.
644 false,
645 // Type of http cache.
646 URLRequestContextConfig::HttpCacheType::DISK,
647 // Max size of http cache in bytes.
648 1024000,
649 // Disable caching for HTTP responses. Other information may be stored in
650 // the cache.
651 false,
652 // Storage path for http cache and cookie storage.
653 "/data/data/org.chromium.net/app_cronet_test/test_storage",
Misha Efimovd4ab38302018-01-30 23:56:42654 // Accept-Language request header field.
655 "foreign-language",
Zhongyi Shi64795622017-11-20 02:21:49656 // User-Agent request header field.
657 "fake agent",
658 // JSON encoded experimental options.
Zhongyi Shif4683a32017-12-01 00:03:28659 "{\"QUIC\":{\"migrate_sessions_on_network_change_v2\":true,"
Zhongyi Shi73f23ca872017-12-13 18:37:13660 "\"migrate_sessions_early_v2\":true,"
Zhongyi Shiff359581bc2018-09-26 18:11:48661 "\"retry_on_alternate_network_before_handshake\":true,"
Zhongyi Shi32fe14d42019-02-28 00:25:36662 "\"migrate_idle_sessions\":true,"
Zhongyi Shie01f2db2019-02-22 19:53:23663 "\"retransmittable_on_wire_timeout_milliseconds\":1000,"
Zhongyi Shibc85e3e2019-02-12 19:34:42664 "\"idle_session_migration_period_seconds\":15,"
Zhongyi Shi8b1e43f2017-12-13 20:46:30665 "\"max_time_on_non_default_network_seconds\":10,"
Zhongyi Shiee760762018-08-01 00:54:29666 "\"max_migrations_to_non_default_network_on_write_error\":3,"
Zhongyi Shi8b1e43f2017-12-13 20:46:30667 "\"max_migrations_to_non_default_network_on_path_degrading\":4}}",
Zhongyi Shi64795622017-11-20 02:21:49668 // MockCertVerifier to use for testing purposes.
669 std::unique_ptr<net::CertVerifier>(),
670 // Enable network quality estimator.
671 false,
672 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41673 true,
674 // Optional network thread priority.
675 base::Optional<double>());
Zhongyi Shi64795622017-11-20 02:21:49676
677 net::URLRequestContextBuilder builder;
678 net::NetLog net_log;
679 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
680 // Set a ProxyConfigService to avoid DCHECK failure when building.
681 builder.set_proxy_config_service(
Lily Houghtonef028852017-12-06 20:52:30682 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49683 net::ProxyConfigWithAnnotation::CreateDirect()));
Zhongyi Shi64795622017-11-20 02:21:49684 std::unique_ptr<net::URLRequestContext> context(builder.Build());
685 const net::HttpNetworkSession::Params* params =
686 context->GetNetworkSessionParams();
687
688 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change_v2);
Zhongyi Shif4683a32017-12-01 00:03:28689 EXPECT_TRUE(params->quic_migrate_sessions_early_v2);
Zhongyi Shiff359581bc2018-09-26 18:11:48690 EXPECT_TRUE(params->quic_retry_on_alternate_network_before_handshake);
Zhongyi Shie01f2db2019-02-22 19:53:23691 EXPECT_EQ(1000, params->quic_retransmittable_on_wire_timeout_milliseconds);
Zhongyi Shi32fe14d42019-02-28 00:25:36692 EXPECT_TRUE(params->quic_migrate_idle_sessions);
Zhongyi Shibc85e3e2019-02-12 19:34:42693 EXPECT_EQ(base::TimeDelta::FromSeconds(15),
694 params->quic_idle_session_migration_period);
Zhongyi Shi73f23ca872017-12-13 18:37:13695 EXPECT_EQ(base::TimeDelta::FromSeconds(10),
696 params->quic_max_time_on_non_default_network);
Zhongyi Shiee760762018-08-01 00:54:29697 EXPECT_EQ(3,
698 params->quic_max_migrations_to_non_default_network_on_write_error);
Zhongyi Shi8b1e43f2017-12-13 20:46:30699 EXPECT_EQ(
700 4, params->quic_max_migrations_to_non_default_network_on_path_degrading);
Zhongyi Shi64795622017-11-20 02:21:49701}
702
Renjie94b90712018-10-18 21:03:19703TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) {
704 base::test::ScopedTaskEnvironment scoped_task_environment_(
705 base::test::ScopedTaskEnvironment::MainThreadType::IO);
706
707 URLRequestContextConfig config(
708 // Enable QUIC.
709 true,
710 // QUIC User Agent ID.
711 "Default QUIC User Agent ID",
712 // Enable SPDY.
713 true,
714 // Enable Brotli.
715 false,
716 // Type of http cache.
717 URLRequestContextConfig::HttpCacheType::DISK,
718 // Max size of http cache in bytes.
719 1024000,
720 // Disable caching for HTTP responses. Other information may be stored in
721 // the cache.
722 false,
723 // Storage path for http cache and cookie storage.
724 "/data/data/org.chromium.net/app_cronet_test/test_storage",
725 // Accept-Language request header field.
726 "foreign-language",
727 // User-Agent request header field.
728 "fake agent",
729 // JSON encoded experimental options.
730 "{\"QUIC\":{\"race_stale_dns_on_connection\":true}}",
731 // MockCertVerifier to use for testing purposes.
732 std::unique_ptr<net::CertVerifier>(),
733 // Enable network quality estimator.
734 false,
735 // Enable Public Key Pinning bypass for local trust anchors.
736 true,
737 // Optional network thread priority.
738 base::Optional<double>());
739
740 net::URLRequestContextBuilder builder;
741 net::NetLog net_log;
742 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
743 // Set a ProxyConfigService to avoid DCHECK failure when building.
744 builder.set_proxy_config_service(
745 std::make_unique<net::ProxyConfigServiceFixed>(
746 net::ProxyConfigWithAnnotation::CreateDirect()));
747 std::unique_ptr<net::URLRequestContext> context(builder.Build());
748 const net::HttpNetworkSession::Params* params =
749 context->GetNetworkSessionParams();
750
751 EXPECT_TRUE(params->quic_race_stale_dns_on_connection);
752}
753
Yixin Wang10f477ed2017-11-21 04:20:20754TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) {
755 base::test::ScopedTaskEnvironment scoped_task_environment_(
756 base::test::ScopedTaskEnvironment::MainThreadType::IO);
757
758 URLRequestContextConfig config(
759 // Enable QUIC.
760 true,
761 // QUIC User Agent ID.
762 "Default QUIC User Agent ID",
763 // Enable SPDY.
764 true,
765 // Enable Brotli.
766 false,
767 // Type of http cache.
768 URLRequestContextConfig::HttpCacheType::DISK,
769 // Max size of http cache in bytes.
770 1024000,
771 // Disable caching for HTTP responses. Other information may be stored in
772 // the cache.
773 false,
774 // Storage path for http cache and cookie storage.
775 "/data/data/org.chromium.net/app_cronet_test/test_storage",
Misha Efimovd4ab38302018-01-30 23:56:42776 // Accept-Language request header field.
777 "foreign-language",
Yixin Wang10f477ed2017-11-21 04:20:20778 // User-Agent request header field.
779 "fake agent",
780 // JSON encoded experimental options.
781 "{\"QUIC\":{\"host_whitelist\":\"www.example.com,www.example.org\"}}",
782 // MockCertVerifier to use for testing purposes.
783 std::unique_ptr<net::CertVerifier>(),
784 // Enable network quality estimator.
785 false,
786 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41787 true,
788 // Optional network thread priority.
789 base::Optional<double>());
Yixin Wang10f477ed2017-11-21 04:20:20790
791 net::URLRequestContextBuilder builder;
792 net::NetLog net_log;
793 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
794 // Set a ProxyConfigService to avoid DCHECK failure when building.
795 builder.set_proxy_config_service(
Lily Houghtonef028852017-12-06 20:52:30796 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49797 net::ProxyConfigWithAnnotation::CreateDirect()));
Yixin Wang10f477ed2017-11-21 04:20:20798 std::unique_ptr<net::URLRequestContext> context(builder.Build());
799 const net::HttpNetworkSession::Params* params =
800 context->GetNetworkSessionParams();
801
802 EXPECT_TRUE(
803 base::ContainsKey(params->quic_host_whitelist, "www.example.com"));
804 EXPECT_TRUE(
805 base::ContainsKey(params->quic_host_whitelist, "www.example.org"));
806}
807
Yixin Wang983875152017-11-21 20:30:13808TEST(URLRequestContextConfigTest, SetQuicMaxTimeBeforeCryptoHandshake) {
809 base::test::ScopedTaskEnvironment scoped_task_environment_(
810 base::test::ScopedTaskEnvironment::MainThreadType::IO);
811
812 URLRequestContextConfig config(
813 // Enable QUIC.
814 true,
815 // QUIC User Agent ID.
816 "Default QUIC User Agent ID",
817 // Enable SPDY.
818 true,
819 // Enable Brotli.
820 false,
821 // Type of http cache.
822 URLRequestContextConfig::HttpCacheType::DISK,
823 // Max size of http cache in bytes.
824 1024000,
825 // Disable caching for HTTP responses. Other information may be stored in
826 // the cache.
827 false,
828 // Storage path for http cache and cookie storage.
829 "/data/data/org.chromium.net/app_cronet_test/test_storage",
Misha Efimovd4ab38302018-01-30 23:56:42830 // Accept-Language request header field.
831 "foreign-language",
Yixin Wang983875152017-11-21 20:30:13832 // User-Agent request header field.
833 "fake agent",
834 // JSON encoded experimental options.
835 "{\"QUIC\":{\"max_time_before_crypto_handshake_seconds\":7,"
836 "\"max_idle_time_before_crypto_handshake_seconds\":11}}",
837 // MockCertVerifier to use for testing purposes.
838 std::unique_ptr<net::CertVerifier>(),
839 // Enable network quality estimator.
840 false,
841 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41842 true,
843 // Optional network thread priority.
844 base::Optional<double>());
Yixin Wang983875152017-11-21 20:30:13845
846 net::URLRequestContextBuilder builder;
847 net::NetLog net_log;
848 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
849 // Set a ProxyConfigService to avoid DCHECK failure when building.
850 builder.set_proxy_config_service(
Lily Houghtonef028852017-12-06 20:52:30851 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49852 net::ProxyConfigWithAnnotation::CreateDirect()));
Yixin Wang983875152017-11-21 20:30:13853 std::unique_ptr<net::URLRequestContext> context(builder.Build());
854 const net::HttpNetworkSession::Params* params =
855 context->GetNetworkSessionParams();
856
857 EXPECT_EQ(7, params->quic_max_time_before_crypto_handshake_seconds);
858 EXPECT_EQ(11, params->quic_max_idle_time_before_crypto_handshake_seconds);
859}
860
Yixin Wang1875fdb2017-12-06 02:26:49861TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) {
862 base::test::ScopedTaskEnvironment scoped_task_environment_(
863 base::test::ScopedTaskEnvironment::MainThreadType::IO);
864
865 URLRequestContextConfig config(
866 // Enable QUIC.
867 true,
868 // QUIC User Agent ID.
869 "Default QUIC User Agent ID",
870 // Enable SPDY.
871 true,
872 // Enable Brotli.
873 false,
874 // Type of http cache.
875 URLRequestContextConfig::HttpCacheType::DISK,
876 // Max size of http cache in bytes.
877 1024000,
878 // Disable caching for HTTP responses. Other information may be stored in
879 // the cache.
880 false,
881 // Storage path for http cache and cookie storage.
882 "/data/data/org.chromium.net/app_cronet_test/test_storage",
Misha Efimovd4ab38302018-01-30 23:56:42883 // Accept-Language request header field.
884 "foreign-language",
Yixin Wang1875fdb2017-12-06 02:26:49885 // User-Agent request header field.
886 "fake agent",
887 // JSON encoded experimental options.
888 "{\"QUIC\":{\"connection_options\":\"TIME,TBBR,REJ\","
889 "\"client_connection_options\":\"TBBR,1RTT\"}}",
890 // MockCertVerifier to use for testing purposes.
891 std::unique_ptr<net::CertVerifier>(),
892 // Enable network quality estimator.
893 false,
894 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41895 true,
896 // Optional network thread priority.
897 base::Optional<double>());
Yixin Wang1875fdb2017-12-06 02:26:49898
899 net::URLRequestContextBuilder builder;
900 net::NetLog net_log;
901 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
902 // Set a ProxyConfigService to avoid DCHECK failure when building.
903 builder.set_proxy_config_service(
Gyuyoung Kim6afb5082018-01-19 13:35:57904 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49905 net::ProxyConfigWithAnnotation::CreateDirect()));
Yixin Wang1875fdb2017-12-06 02:26:49906 std::unique_ptr<net::URLRequestContext> context(builder.Build());
907 const net::HttpNetworkSession::Params* params =
908 context->GetNetworkSessionParams();
909
Ryan Hamilton8d9ee76e2018-05-29 23:52:52910 quic::QuicTagVector connection_options;
911 connection_options.push_back(quic::kTIME);
912 connection_options.push_back(quic::kTBBR);
913 connection_options.push_back(quic::kREJ);
Yixin Wang1875fdb2017-12-06 02:26:49914 EXPECT_EQ(connection_options, params->quic_connection_options);
915
Ryan Hamilton8d9ee76e2018-05-29 23:52:52916 quic::QuicTagVector client_connection_options;
917 client_connection_options.push_back(quic::kTBBR);
918 client_connection_options.push_back(quic::k1RTT);
Yixin Wang1875fdb2017-12-06 02:26:49919 EXPECT_EQ(client_connection_options, params->quic_client_connection_options);
920}
921
Misha Efimovd4ab38302018-01-30 23:56:42922TEST(URLURLRequestContextConfigTest, SetAcceptLanguageAndUserAgent) {
923 base::test::ScopedTaskEnvironment scoped_task_environment_(
924 base::test::ScopedTaskEnvironment::MainThreadType::IO);
925
926 URLRequestContextConfig config(
927 // Enable QUIC.
928 true,
929 // QUIC User Agent ID.
930 "Default QUIC User Agent ID",
931 // Enable SPDY.
932 true,
933 // Enable Brotli.
934 false,
935 // Type of http cache.
936 URLRequestContextConfig::HttpCacheType::DISK,
937 // Max size of http cache in bytes.
938 1024000,
939 // Disable caching for HTTP responses. Other information may be stored in
940 // the cache.
941 false,
942 // Storage path for http cache and cookie storage.
943 "/data/data/org.chromium.net/app_cronet_test/test_storage",
944 // Accept-Language request header field.
945 "foreign-language",
946 // User-Agent request header field.
947 "fake agent",
948 // JSON encoded experimental options.
949 "{}",
950 // MockCertVerifier to use for testing purposes.
951 std::unique_ptr<net::CertVerifier>(),
952 // Enable network quality estimator.
953 false,
954 // Enable Public Key Pinning bypass for local trust anchors.
Paul Jensen6a1ea3a2018-08-24 14:46:41955 true,
956 // Optional network thread priority.
957 base::Optional<double>());
Misha Efimovd4ab38302018-01-30 23:56:42958
959 net::URLRequestContextBuilder builder;
960 net::NetLog net_log;
961 config.ConfigureURLRequestContextBuilder(&builder, &net_log);
962 // Set a ProxyConfigService to avoid DCHECK failure when building.
963 builder.set_proxy_config_service(
964 std::make_unique<net::ProxyConfigServiceFixed>(
Ramin Halavatica8d5252018-03-12 05:33:49965 net::ProxyConfigWithAnnotation::CreateDirect()));
Misha Efimovd4ab38302018-01-30 23:56:42966 std::unique_ptr<net::URLRequestContext> context(builder.Build());
967 EXPECT_EQ("foreign-language",
968 context->http_user_agent_settings()->GetAcceptLanguage());
969 EXPECT_EQ("fake agent", context->http_user_agent_settings()->GetUserAgent());
970}
971
juliatuttle50d9c4b2016-08-23 22:49:19972// See stale_host_resolver_unittest.cc for test of StaleDNS options.
973
xunjielif24ee5f2015-11-23 18:05:26974} // namespace cronet