xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "components/cronet/url_request_context_config.h" |
| 6 | |
Gyuyoung Kim | 6afb508 | 2018-01-19 13:35:57 | [diff] [blame] | 7 | #include <memory> |
| 8 | |
Eric Orth | e1cdd90 | 2019-02-26 02:52:46 | [diff] [blame] | 9 | #include "base/bind.h" |
Julia Tuttle | 3cc27a4a | 2018-04-25 15:57:06 | [diff] [blame] | 10 | #include "base/json/json_writer.h" |
Eric Orth | e1cdd90 | 2019-02-26 02:52:46 | [diff] [blame] | 11 | #include "base/logging.h" |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 12 | #include "base/strings/string_piece.h" |
Gabriel Charette | c710874 | 2019-08-23 03:31:40 | [diff] [blame] | 13 | #include "base/test/task_environment.h" |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 14 | #include "base/test/values_test_util.h" |
tfh | ef3618f | 2016-01-11 23:07:08 | [diff] [blame] | 15 | #include "base/values.h" |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 16 | #include "build/build_config.h" |
Eric Orth | e1cdd90 | 2019-02-26 02:52:46 | [diff] [blame] | 17 | #include "net/base/host_port_pair.h" |
Matt Menke | d732ea4 | 2019-03-08 12:05:00 | [diff] [blame] | 18 | #include "net/base/http_user_agent_settings.h" |
Eric Orth | e1cdd90 | 2019-02-26 02:52:46 | [diff] [blame] | 19 | #include "net/base/net_errors.h" |
pauljensen | 9041eb3c | 2015-12-09 12:29:01 | [diff] [blame] | 20 | #include "net/cert/cert_verifier.h" |
Eric Orth | e1cdd90 | 2019-02-26 02:52:46 | [diff] [blame] | 21 | #include "net/dns/host_resolver.h" |
Eric Orth | 607b6d8 | 2019-05-08 16:43:32 | [diff] [blame] | 22 | #include "net/dns/host_resolver_manager.h" |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 23 | #include "net/http/http_network_session.h" |
mikecirone | f22f981 | 2016-10-04 03:40:19 | [diff] [blame] | 24 | #include "net/log/net_log.h" |
| 25 | #include "net/log/net_log_with_source.h" |
Lily Houghton | 582d462 | 2018-01-22 22:43:40 | [diff] [blame] | 26 | #include "net/proxy_resolution/proxy_config.h" |
| 27 | #include "net/proxy_resolution/proxy_config_service_fixed.h" |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 28 | #include "net/url_request/url_request_context.h" |
| 29 | #include "net/url_request/url_request_context_builder.h" |
| 30 | #include "testing/gtest/include/gtest/gtest.h" |
| 31 | |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 32 | #if BUILDFLAG(ENABLE_REPORTING) |
| 33 | #include "net/network_error_logging/network_error_logging_service.h" |
| 34 | #include "net/reporting/reporting_service.h" |
| 35 | #endif // BUILDFLAG(ENABLE_REPORTING) |
| 36 | |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 37 | namespace cronet { |
| 38 | |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 39 | namespace { |
| 40 | |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 41 | std::string WrapJsonHeader(base::StringPiece value) { |
| 42 | std::string result; |
| 43 | result.reserve(value.size() + 2); |
| 44 | result.push_back('['); |
| 45 | value.AppendToString(&result); |
| 46 | result.push_back(']'); |
| 47 | return result; |
| 48 | } |
| 49 | |
| 50 | // Returns whether two JSON-encoded headers contain the same content, ignoring |
| 51 | // irrelevant encoding issues like whitespace and map element ordering. |
| 52 | bool JsonHeaderEquals(base::StringPiece expected, base::StringPiece actual) { |
Lei Zhang | 9b9d579 | 2019-02-20 07:24:42 | [diff] [blame] | 53 | return base::test::ParseJson(WrapJsonHeader(expected)) == |
| 54 | base::test::ParseJson(WrapJsonHeader(actual)); |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | } // namespace |
| 58 | |
mmenke | 51629db1 | 2017-06-28 13:34:12 | [diff] [blame] | 59 | TEST(URLRequestContextConfigTest, TestExperimentalOptionParsing) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 60 | base::test::TaskEnvironment task_environment_( |
| 61 | base::test::TaskEnvironment::MainThreadType::IO); |
mmenke | 51629db1 | 2017-06-28 13:34:12 | [diff] [blame] | 62 | |
Julia Tuttle | 3cc27a4a | 2018-04-25 15:57:06 | [diff] [blame] | 63 | // Create JSON for experimental options. |
| 64 | base::DictionaryValue options; |
| 65 | options.SetPath({"QUIC", "max_server_configs_stored_in_properties"}, |
| 66 | base::Value(2)); |
| 67 | options.SetPath({"QUIC", "user_agent_id"}, base::Value("Custom QUIC UAID")); |
| 68 | options.SetPath({"QUIC", "idle_connection_timeout_seconds"}, |
| 69 | base::Value(300)); |
| 70 | options.SetPath({"QUIC", "close_sessions_on_ip_change"}, base::Value(true)); |
| 71 | options.SetPath({"QUIC", "race_cert_verification"}, base::Value(true)); |
| 72 | options.SetPath({"QUIC", "connection_options"}, base::Value("TIME,TBBR,REJ")); |
Ryan Hamilton | a31239f1 | 2019-09-25 21:01:00 | [diff] [blame^] | 73 | options.SetPath( |
| 74 | {"QUIC", "set_quic_flags"}, |
| 75 | base::Value("FLAGS_quic_reloadable_flag_quic_supports_tls_handshake=true," |
| 76 | "FLAGS_quic_reloadable_flag_quic_enable_version_99=true")); |
Julia Tuttle | 3cc27a4a | 2018-04-25 15:57:06 | [diff] [blame] | 77 | options.SetPath({"AsyncDNS", "enable"}, base::Value(true)); |
| 78 | options.SetPath({"NetworkErrorLogging", "enable"}, base::Value(true)); |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 79 | options.SetPath({"NetworkErrorLogging", "preloaded_report_to_headers"}, |
Lei Zhang | 9b9d579 | 2019-02-20 07:24:42 | [diff] [blame] | 80 | base::test::ParseJson(R"json( |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 81 | [ |
| 82 | { |
| 83 | "origin": "https://test-origin/", |
| 84 | "value": { |
| 85 | "group": "test-group", |
| 86 | "max_age": 86400, |
| 87 | "endpoints": [ |
| 88 | {"url": "https://test-endpoint/"}, |
| 89 | ], |
| 90 | }, |
| 91 | }, |
| 92 | { |
| 93 | "origin": "https://test-origin-2/", |
| 94 | "value": [ |
| 95 | { |
| 96 | "group": "test-group-2", |
| 97 | "max_age": 86400, |
| 98 | "endpoints": [ |
| 99 | {"url": "https://test-endpoint-2/"}, |
| 100 | ], |
| 101 | }, |
| 102 | { |
| 103 | "group": "test-group-3", |
| 104 | "max_age": 86400, |
| 105 | "endpoints": [ |
| 106 | {"url": "https://test-endpoint-3/"}, |
| 107 | ], |
| 108 | }, |
| 109 | ], |
| 110 | }, |
| 111 | { |
| 112 | "origin": "https://value-is-missing/", |
| 113 | }, |
| 114 | { |
| 115 | "value": "origin is missing", |
| 116 | }, |
| 117 | { |
| 118 | "origin": 123, |
| 119 | "value": "origin is not a string", |
| 120 | }, |
| 121 | { |
| 122 | "origin": "this is not a URL", |
| 123 | "value": "origin not a URL", |
| 124 | }, |
| 125 | ] |
| 126 | )json")); |
| 127 | options.SetPath({"NetworkErrorLogging", "preloaded_nel_headers"}, |
Lei Zhang | 9b9d579 | 2019-02-20 07:24:42 | [diff] [blame] | 128 | base::test::ParseJson(R"json( |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 129 | [ |
| 130 | { |
| 131 | "origin": "https://test-origin/", |
| 132 | "value": { |
| 133 | "report_to": "test-group", |
| 134 | "max_age": 86400, |
| 135 | }, |
| 136 | }, |
| 137 | ] |
| 138 | )json")); |
Julia Tuttle | 3cc27a4a | 2018-04-25 15:57:06 | [diff] [blame] | 139 | options.SetPath({"UnknownOption", "foo"}, base::Value(true)); |
| 140 | options.SetPath({"HostResolverRules", "host_resolver_rules"}, |
| 141 | base::Value("MAP * 127.0.0.1")); |
| 142 | // See http://crbug.com/696569. |
| 143 | options.SetKey("disable_ipv6_on_wifi", base::Value(true)); |
| 144 | std::string options_json; |
| 145 | EXPECT_TRUE(base::JSONWriter::Write(options, &options_json)); |
| 146 | |
Ryan Hamilton | a31239f1 | 2019-09-25 21:01:00 | [diff] [blame^] | 147 | // Initialize QUIC flags set by the config. |
| 148 | FLAGS_quic_reloadable_flag_quic_supports_tls_handshake = false; |
| 149 | FLAGS_quic_reloadable_flag_quic_enable_version_99 = false; |
| 150 | |
pauljensen | 9041eb3c | 2015-12-09 12:29:01 | [diff] [blame] | 151 | URLRequestContextConfig config( |
| 152 | // Enable QUIC. |
| 153 | true, |
mef | c5da571 | 2016-02-09 20:14:23 | [diff] [blame] | 154 | // QUIC User Agent ID. |
| 155 | "Default QUIC User Agent ID", |
pauljensen | 9041eb3c | 2015-12-09 12:29:01 | [diff] [blame] | 156 | // Enable SPDY. |
| 157 | true, |
xunjieli | 186d2bf | 2017-04-18 13:45:47 | [diff] [blame] | 158 | // Enable Brotli. |
| 159 | false, |
pauljensen | 9041eb3c | 2015-12-09 12:29:01 | [diff] [blame] | 160 | // Type of http cache. |
| 161 | URLRequestContextConfig::HttpCacheType::DISK, |
| 162 | // Max size of http cache in bytes. |
| 163 | 1024000, |
| 164 | // Disable caching for HTTP responses. Other information may be stored in |
| 165 | // the cache. |
| 166 | false, |
| 167 | // Storage path for http cache and cookie storage. |
| 168 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 169 | // Accept-Language request header field. |
| 170 | "foreign-language", |
pauljensen | 9041eb3c | 2015-12-09 12:29:01 | [diff] [blame] | 171 | // User-Agent request header field. |
| 172 | "fake agent", |
| 173 | // JSON encoded experimental options. |
Julia Tuttle | 3cc27a4a | 2018-04-25 15:57:06 | [diff] [blame] | 174 | options_json, |
pauljensen | 9041eb3c | 2015-12-09 12:29:01 | [diff] [blame] | 175 | // MockCertVerifier to use for testing purposes. |
tbansal | 7018e2a | 2016-06-25 00:40:39 | [diff] [blame] | 176 | std::unique_ptr<net::CertVerifier>(), |
| 177 | // Enable network quality estimator. |
kapishnikov | 385aa42 | 2016-07-01 20:53:02 | [diff] [blame] | 178 | false, |
| 179 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 180 | true, |
| 181 | // Optional network thread priority. |
| 182 | base::Optional<double>(42.0)); |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 183 | |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 184 | net::URLRequestContextBuilder builder; |
pauljensen | e92c409 | 2015-12-09 19:13:48 | [diff] [blame] | 185 | net::NetLog net_log; |
David Benjamin | dc2f4b0 | 2017-07-27 23:59:02 | [diff] [blame] | 186 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
xunjieli | d67295e | 2017-03-16 21:05:41 | [diff] [blame] | 187 | EXPECT_FALSE(config.effective_experimental_options->HasKey("UnknownOption")); |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 188 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
ricea | 85ec5795 | 2016-08-31 09:34:10 | [diff] [blame] | 189 | builder.set_proxy_config_service( |
Lily Houghton | ef02885 | 2017-12-06 20:52:30 | [diff] [blame] | 190 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 191 | net::ProxyConfigWithAnnotation::CreateDirect())); |
dcheng | fe3745e624 | 2016-04-21 23:49:58 | [diff] [blame] | 192 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 193 | const net::HttpNetworkSession::Params* params = |
| 194 | context->GetNetworkSessionParams(); |
| 195 | // Check Quic Connection options. |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 196 | quic::QuicTagVector quic_connection_options; |
| 197 | quic_connection_options.push_back(quic::kTIME); |
| 198 | quic_connection_options.push_back(quic::kTBBR); |
| 199 | quic_connection_options.push_back(quic::kREJ); |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 200 | EXPECT_EQ(quic_connection_options, params->quic_params.connection_options); |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 201 | |
Ryan Hamilton | a31239f1 | 2019-09-25 21:01:00 | [diff] [blame^] | 202 | EXPECT_TRUE(FLAGS_quic_reloadable_flag_quic_supports_tls_handshake); |
| 203 | EXPECT_TRUE(FLAGS_quic_reloadable_flag_quic_enable_version_99); |
| 204 | |
mef | c5da571 | 2016-02-09 20:14:23 | [diff] [blame] | 205 | // Check Custom QUIC User Agent Id. |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 206 | EXPECT_EQ("Custom QUIC UAID", params->quic_params.user_agent_id); |
mef | c5da571 | 2016-02-09 20:14:23 | [diff] [blame] | 207 | |
rtenneti | 6971c17 | 2016-01-15 20:12:10 | [diff] [blame] | 208 | // Check max_server_configs_stored_in_properties. |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 209 | EXPECT_EQ(2u, params->quic_params.max_server_configs_stored_in_properties); |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 210 | |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 211 | // Check idle_connection_timeout. |
| 212 | EXPECT_EQ(300, params->quic_params.idle_connection_timeout.InSeconds()); |
rtenneti | 64e809d0 | 2015-12-11 00:26:20 | [diff] [blame] | 213 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 214 | EXPECT_TRUE(params->quic_params.close_sessions_on_ip_change); |
| 215 | EXPECT_FALSE(params->quic_params.goaway_sessions_on_ip_change); |
| 216 | EXPECT_FALSE(params->quic_params.allow_server_migration); |
| 217 | EXPECT_FALSE(params->quic_params.migrate_sessions_on_network_change_v2); |
| 218 | EXPECT_FALSE(params->quic_params.migrate_sessions_early_v2); |
| 219 | EXPECT_FALSE(params->quic_params.migrate_idle_sessions); |
| 220 | EXPECT_FALSE(params->quic_params.retry_on_alternate_network_before_handshake); |
| 221 | EXPECT_FALSE(params->quic_params.race_stale_dns_on_connection); |
Renjie Tang | cbbc84c | 2019-09-06 22:23:23 | [diff] [blame] | 222 | EXPECT_FALSE(params->quic_params.go_away_on_path_degrading); |
jri | d2656695 | 2016-02-04 21:06:42 | [diff] [blame] | 223 | |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 224 | // Check race_cert_verification. |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 225 | EXPECT_TRUE(params->quic_params.race_cert_verification); |
rtenneti | d073dd2 | 2016-08-04 01:58:33 | [diff] [blame] | 226 | |
Misha Efimov | 6395791 | 2017-12-06 07:13:26 | [diff] [blame] | 227 | #if defined(ENABLE_BUILT_IN_DNS) |
| 228 | // Check AsyncDNS resolver is enabled (not supported on iOS). |
tfh | ef3618f | 2016-01-11 23:07:08 | [diff] [blame] | 229 | EXPECT_TRUE(context->host_resolver()->GetDnsConfigAsValue()); |
Misha Efimov | 6395791 | 2017-12-06 07:13:26 | [diff] [blame] | 230 | #endif // defined(ENABLE_BUILT_IN_DNS) |
mgersh | af2c12c | 2016-08-22 16:33:54 | [diff] [blame] | 231 | |
Julia Tuttle | 9715d164 | 2018-01-29 17:02:26 | [diff] [blame] | 232 | #if BUILDFLAG(ENABLE_REPORTING) |
| 233 | // Check Reporting and Network Error Logging are enabled (can be disabled at |
| 234 | // build time). |
| 235 | EXPECT_TRUE(context->reporting_service()); |
Julia Tuttle | cba7d22 | 2018-02-23 19:37:27 | [diff] [blame] | 236 | EXPECT_TRUE(context->network_error_logging_service()); |
Julia Tuttle | 9715d164 | 2018-01-29 17:02:26 | [diff] [blame] | 237 | #endif // BUILDFLAG(ENABLE_REPORTING) |
| 238 | |
Douglas Creager | a220947e | 2018-08-23 20:08:53 | [diff] [blame] | 239 | ASSERT_EQ(2u, config.preloaded_report_to_headers.size()); |
| 240 | EXPECT_EQ(url::Origin::CreateFromNormalizedTuple("https", "test-origin", 443), |
| 241 | config.preloaded_report_to_headers[0].origin); |
| 242 | EXPECT_TRUE(JsonHeaderEquals( // |
| 243 | R"json( |
| 244 | { |
| 245 | "group": "test-group", |
| 246 | "max_age": 86400, |
| 247 | "endpoints": [ |
| 248 | {"url": "https://test-endpoint/"}, |
| 249 | ], |
| 250 | } |
| 251 | )json", |
| 252 | config.preloaded_report_to_headers[0].value)); |
| 253 | EXPECT_EQ( |
| 254 | url::Origin::CreateFromNormalizedTuple("https", "test-origin-2", 443), |
| 255 | config.preloaded_report_to_headers[1].origin); |
| 256 | EXPECT_TRUE(JsonHeaderEquals( // |
| 257 | R"json( |
| 258 | { |
| 259 | "group": "test-group-2", |
| 260 | "max_age": 86400, |
| 261 | "endpoints": [ |
| 262 | {"url": "https://test-endpoint-2/"}, |
| 263 | ], |
| 264 | }, |
| 265 | { |
| 266 | "group": "test-group-3", |
| 267 | "max_age": 86400, |
| 268 | "endpoints": [ |
| 269 | {"url": "https://test-endpoint-3/"}, |
| 270 | ], |
| 271 | } |
| 272 | )json", |
| 273 | config.preloaded_report_to_headers[1].value)); |
| 274 | |
| 275 | ASSERT_EQ(1u, config.preloaded_nel_headers.size()); |
| 276 | EXPECT_EQ(url::Origin::CreateFromNormalizedTuple("https", "test-origin", 443), |
| 277 | config.preloaded_nel_headers[0].origin); |
| 278 | EXPECT_TRUE(JsonHeaderEquals( // |
| 279 | R"json( |
| 280 | { |
| 281 | "report_to": "test-group", |
| 282 | "max_age": 86400, |
| 283 | } |
| 284 | )json", |
| 285 | config.preloaded_nel_headers[0].value)); |
| 286 | |
mgersh | af9a923 | 2017-04-13 20:19:03 | [diff] [blame] | 287 | // Check IPv6 is disabled when on wifi. |
Eric Orth | 607b6d8 | 2019-05-08 16:43:32 | [diff] [blame] | 288 | EXPECT_FALSE(context->host_resolver() |
| 289 | ->GetManagerForTesting() |
| 290 | ->check_ipv6_on_wifi_for_testing()); |
mgersh | b3fe808 | 2017-02-28 20:09:20 | [diff] [blame] | 291 | |
Eric Orth | e1cdd90 | 2019-02-26 02:52:46 | [diff] [blame] | 292 | // All host resolution expected to be mapped to an immediately-resolvable IP. |
| 293 | std::unique_ptr<net::HostResolver::ResolveHostRequest> resolve_request = |
| 294 | context->host_resolver()->CreateRequest(net::HostPortPair("abcde", 80), |
| 295 | net::NetLogWithSource(), |
| 296 | base::nullopt); |
| 297 | EXPECT_EQ(net::OK, resolve_request->Start( |
| 298 | base::BindOnce([](int error) { NOTREACHED(); }))); |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 299 | |
| 300 | EXPECT_TRUE(config.network_thread_priority); |
| 301 | EXPECT_EQ(42.0, config.network_thread_priority.value()); |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 302 | } |
| 303 | |
Zhongyi Shi | 5724796 | 2018-11-05 20:03:52 | [diff] [blame] | 304 | TEST(URLRequestContextConfigTest, SetSupportedQuicVersion) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 305 | base::test::TaskEnvironment task_environment_( |
| 306 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | 5724796 | 2018-11-05 20:03:52 | [diff] [blame] | 307 | |
| 308 | URLRequestContextConfig config( |
| 309 | // Enable QUIC. |
| 310 | true, |
| 311 | // QUIC User Agent ID. |
| 312 | "Default QUIC User Agent ID", |
| 313 | // Enable SPDY. |
| 314 | true, |
| 315 | // Enable Brotli. |
| 316 | false, |
| 317 | // Type of http cache. |
| 318 | URLRequestContextConfig::HttpCacheType::DISK, |
| 319 | // Max size of http cache in bytes. |
| 320 | 1024000, |
| 321 | // Disable caching for HTTP responses. Other information may be stored in |
| 322 | // the cache. |
| 323 | false, |
| 324 | // Storage path for http cache and cookie storage. |
| 325 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 326 | // Accept-Language request header field. |
| 327 | "foreign-language", |
| 328 | // User-Agent request header field. |
| 329 | "fake agent", |
| 330 | // JSON encoded experimental options. |
Ryan Hamilton | 8380c65 | 2019-06-04 02:25:06 | [diff] [blame] | 331 | "{\"QUIC\":{\"quic_version\":\"QUIC_VERSION_46\"}}", |
Zhongyi Shi | 5724796 | 2018-11-05 20:03:52 | [diff] [blame] | 332 | // MockCertVerifier to use for testing purposes. |
| 333 | std::unique_ptr<net::CertVerifier>(), |
| 334 | // Enable network quality estimator. |
| 335 | false, |
| 336 | // Enable Public Key Pinning bypass for local trust anchors. |
| 337 | true, |
| 338 | // Optional network thread priority. |
| 339 | base::Optional<double>()); |
| 340 | |
| 341 | net::URLRequestContextBuilder builder; |
| 342 | net::NetLog net_log; |
| 343 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 344 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 345 | builder.set_proxy_config_service( |
| 346 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 347 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 348 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 349 | const net::HttpNetworkSession::Params* params = |
| 350 | context->GetNetworkSessionParams(); |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 351 | EXPECT_EQ(params->quic_params.supported_versions.size(), 1u); |
| 352 | EXPECT_EQ(params->quic_params.supported_versions[0], |
Nick Harper | 23290b8 | 2019-05-02 00:02:56 | [diff] [blame] | 353 | quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, |
Ryan Hamilton | 8380c65 | 2019-06-04 02:25:06 | [diff] [blame] | 354 | quic::QUIC_VERSION_46)); |
Zhongyi Shi | 5724796 | 2018-11-05 20:03:52 | [diff] [blame] | 355 | } |
| 356 | |
| 357 | TEST(URLRequestContextConfigTest, SetUnsupportedQuicVersion) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 358 | base::test::TaskEnvironment task_environment_( |
| 359 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | 5724796 | 2018-11-05 20:03:52 | [diff] [blame] | 360 | |
| 361 | URLRequestContextConfig config( |
| 362 | // Enable QUIC. |
| 363 | true, |
| 364 | // QUIC User Agent ID. |
| 365 | "Default QUIC User Agent ID", |
| 366 | // Enable SPDY. |
| 367 | true, |
| 368 | // Enable Brotli. |
| 369 | false, |
| 370 | // Type of http cache. |
| 371 | URLRequestContextConfig::HttpCacheType::DISK, |
| 372 | // Max size of http cache in bytes. |
| 373 | 1024000, |
| 374 | // Disable caching for HTTP responses. Other information may be stored in |
| 375 | // the cache. |
| 376 | false, |
| 377 | // Storage path for http cache and cookie storage. |
| 378 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 379 | // Accept-Language request header field. |
| 380 | "foreign-language", |
| 381 | // User-Agent request header field. |
| 382 | "fake agent", |
| 383 | // JSON encoded experimental options. |
| 384 | "{\"QUIC\":{\"quic_version\":\"QUIC_VERSION_33\"}}", |
| 385 | // MockCertVerifier to use for testing purposes. |
| 386 | std::unique_ptr<net::CertVerifier>(), |
| 387 | // Enable network quality estimator. |
| 388 | false, |
| 389 | // Enable Public Key Pinning bypass for local trust anchors. |
| 390 | true, |
| 391 | // Optional network thread priority. |
| 392 | base::Optional<double>()); |
| 393 | |
| 394 | net::URLRequestContextBuilder builder; |
| 395 | net::NetLog net_log; |
| 396 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 397 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 398 | builder.set_proxy_config_service( |
| 399 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 400 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 401 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 402 | const net::HttpNetworkSession::Params* params = |
| 403 | context->GetNetworkSessionParams(); |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 404 | EXPECT_EQ(params->quic_params.supported_versions.size(), 1u); |
| 405 | EXPECT_EQ(params->quic_params.supported_versions[0], |
Nick Harper | 23290b8 | 2019-05-02 00:02:56 | [diff] [blame] | 406 | quic::ParsedQuicVersion(quic::PROTOCOL_QUIC_CRYPTO, |
Ryan Hamilton | 3cbc563 | 2019-05-20 17:16:29 | [diff] [blame] | 407 | quic::QUIC_VERSION_46)); |
Zhongyi Shi | 5724796 | 2018-11-05 20:03:52 | [diff] [blame] | 408 | } |
| 409 | |
Zhongyi Shi | 8ff38c1 | 2018-02-22 00:02:30 | [diff] [blame] | 410 | TEST(URLRequestContextConfigTest, SetQuicServerMigrationOptions) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 411 | base::test::TaskEnvironment task_environment_( |
| 412 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | 8ff38c1 | 2018-02-22 00:02:30 | [diff] [blame] | 413 | |
| 414 | URLRequestContextConfig config( |
| 415 | // Enable QUIC. |
| 416 | true, |
| 417 | // QUIC User Agent ID. |
| 418 | "Default QUIC User Agent ID", |
| 419 | // Enable SPDY. |
| 420 | true, |
| 421 | // Enable Brotli. |
| 422 | false, |
| 423 | // Type of http cache. |
| 424 | URLRequestContextConfig::HttpCacheType::DISK, |
| 425 | // Max size of http cache in bytes. |
| 426 | 1024000, |
| 427 | // Disable caching for HTTP responses. Other information may be stored in |
| 428 | // the cache. |
| 429 | false, |
| 430 | // Storage path for http cache and cookie storage. |
| 431 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 432 | // Accept-Language request header field. |
| 433 | "foreign-language", |
| 434 | // User-Agent request header field. |
| 435 | "fake agent", |
| 436 | // JSON encoded experimental options. |
| 437 | "{\"QUIC\":{\"allow_server_migration\":true}}", |
| 438 | // MockCertVerifier to use for testing purposes. |
| 439 | std::unique_ptr<net::CertVerifier>(), |
| 440 | // Enable network quality estimator. |
| 441 | false, |
| 442 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 443 | true, |
| 444 | // Optional network thread priority. |
| 445 | base::Optional<double>()); |
Zhongyi Shi | 8ff38c1 | 2018-02-22 00:02:30 | [diff] [blame] | 446 | |
| 447 | net::URLRequestContextBuilder builder; |
| 448 | net::NetLog net_log; |
| 449 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 450 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 451 | builder.set_proxy_config_service( |
| 452 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 453 | net::ProxyConfigWithAnnotation::CreateDirect())); |
Zhongyi Shi | 8ff38c1 | 2018-02-22 00:02:30 | [diff] [blame] | 454 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 455 | const net::HttpNetworkSession::Params* params = |
| 456 | context->GetNetworkSessionParams(); |
| 457 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 458 | EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); |
| 459 | EXPECT_TRUE(params->quic_params.allow_server_migration); |
Zhongyi Shi | 8ff38c1 | 2018-02-22 00:02:30 | [diff] [blame] | 460 | } |
| 461 | |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 462 | // Test that goaway_sessions_on_ip_change is set on by default for iOS. |
| 463 | #if defined(OS_IOS) |
| 464 | #define MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault \ |
| 465 | SetQuicGoAwaySessionsOnIPChangeByDefault |
| 466 | #else |
| 467 | #define MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault \ |
| 468 | DISABLED_SetQuicGoAwaySessionsOnIPChangeByDefault |
| 469 | #endif |
| 470 | TEST(URLRequestContextConfigTest, |
| 471 | MAYBE_SetQuicGoAwaySessionsOnIPChangeByDefault) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 472 | base::test::TaskEnvironment task_environment_( |
| 473 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 474 | |
| 475 | URLRequestContextConfig config( |
| 476 | // Enable QUIC. |
| 477 | true, |
| 478 | // QUIC User Agent ID. |
| 479 | "Default QUIC User Agent ID", |
| 480 | // Enable SPDY. |
| 481 | true, |
| 482 | // Enable Brotli. |
| 483 | false, |
| 484 | // Type of http cache. |
| 485 | URLRequestContextConfig::HttpCacheType::DISK, |
| 486 | // Max size of http cache in bytes. |
| 487 | 1024000, |
| 488 | // Disable caching for HTTP responses. Other information may be stored in |
| 489 | // the cache. |
| 490 | false, |
| 491 | // Storage path for http cache and cookie storage. |
| 492 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 493 | // Accept-Language request header field. |
| 494 | "foreign-language", |
| 495 | // User-Agent request header field. |
| 496 | "fake agent", |
| 497 | // JSON encoded experimental options. |
| 498 | "{\"QUIC\":{}}", |
| 499 | // MockCertVerifier to use for testing purposes. |
| 500 | std::unique_ptr<net::CertVerifier>(), |
| 501 | // Enable network quality estimator. |
| 502 | false, |
| 503 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 504 | true, |
| 505 | // Optional network thread priority. |
| 506 | base::Optional<double>()); |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 507 | |
| 508 | net::URLRequestContextBuilder builder; |
| 509 | net::NetLog net_log; |
| 510 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 511 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 512 | builder.set_proxy_config_service( |
| 513 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 514 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 515 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 516 | const net::HttpNetworkSession::Params* params = |
| 517 | context->GetNetworkSessionParams(); |
| 518 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 519 | EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); |
| 520 | EXPECT_TRUE(params->quic_params.goaway_sessions_on_ip_change); |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | // Tests that goaway_sessions_on_ip_changes can be set on via |
| 524 | // experimental options on non-iOS. |
| 525 | #if !defined(OS_IOS) |
| 526 | #define MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions \ |
| 527 | SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions |
| 528 | #else |
| 529 | #define MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions \ |
| 530 | DISABLED_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions |
| 531 | #endif |
| 532 | TEST(URLRequestContextConfigTest, |
| 533 | MAYBE_SetQuicGoAwaySessionsOnIPChangeViaExperimentOptions) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 534 | base::test::TaskEnvironment task_environment_( |
| 535 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | 63574b7 | 2018-06-01 20:22:25 | [diff] [blame] | 536 | |
| 537 | URLRequestContextConfig config( |
| 538 | // Enable QUIC. |
| 539 | true, |
| 540 | // QUIC User Agent ID. |
| 541 | "Default QUIC User Agent ID", |
| 542 | // Enable SPDY. |
| 543 | true, |
| 544 | // Enable Brotli. |
| 545 | false, |
| 546 | // Type of http cache. |
| 547 | URLRequestContextConfig::HttpCacheType::DISK, |
| 548 | // Max size of http cache in bytes. |
| 549 | 1024000, |
| 550 | // Disable caching for HTTP responses. Other information may be stored in |
| 551 | // the cache. |
| 552 | false, |
| 553 | // Storage path for http cache and cookie storage. |
| 554 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 555 | // Accept-Language request header field. |
| 556 | "foreign-language", |
| 557 | // User-Agent request header field. |
| 558 | "fake agent", |
| 559 | // JSON encoded experimental options. |
| 560 | "{\"QUIC\":{\"goaway_sessions_on_ip_change\":true}}", |
| 561 | // MockCertVerifier to use for testing purposes. |
| 562 | std::unique_ptr<net::CertVerifier>(), |
| 563 | // Enable network quality estimator. |
| 564 | false, |
| 565 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 566 | true, |
| 567 | // Optional network thread priority. |
| 568 | base::Optional<double>()); |
Zhongyi Shi | 63574b7 | 2018-06-01 20:22:25 | [diff] [blame] | 569 | |
| 570 | net::URLRequestContextBuilder builder; |
| 571 | net::NetLog net_log; |
| 572 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 573 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 574 | builder.set_proxy_config_service( |
| 575 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 576 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 577 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 578 | const net::HttpNetworkSession::Params* params = |
| 579 | context->GetNetworkSessionParams(); |
| 580 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 581 | EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); |
| 582 | EXPECT_TRUE(params->quic_params.goaway_sessions_on_ip_change); |
Zhongyi Shi | 63574b7 | 2018-06-01 20:22:25 | [diff] [blame] | 583 | } |
| 584 | |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 585 | // Test that goaway_sessions_on_ip_change can be set to false via |
| 586 | // exprimental options on iOS. |
| 587 | #if defined(OS_IOS) |
| 588 | #define MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions \ |
| 589 | DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions |
| 590 | #else |
| 591 | #define MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions \ |
| 592 | DISABLED_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions |
| 593 | #endif |
| 594 | TEST(URLRequestContextConfigTest, |
| 595 | MAYBE_DisableQuicGoAwaySessionsOnIPChangeViaExperimentOptions) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 596 | base::test::TaskEnvironment task_environment_( |
| 597 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 598 | |
| 599 | URLRequestContextConfig config( |
| 600 | // Enable QUIC. |
| 601 | true, |
| 602 | // QUIC User Agent ID. |
| 603 | "Default QUIC User Agent ID", |
| 604 | // Enable SPDY. |
| 605 | true, |
| 606 | // Enable Brotli. |
| 607 | false, |
| 608 | // Type of http cache. |
| 609 | URLRequestContextConfig::HttpCacheType::DISK, |
| 610 | // Max size of http cache in bytes. |
| 611 | 1024000, |
| 612 | // Disable caching for HTTP responses. Other information may be stored in |
| 613 | // the cache. |
| 614 | false, |
| 615 | // Storage path for http cache and cookie storage. |
| 616 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 617 | // Accept-Language request header field. |
| 618 | "foreign-language", |
| 619 | // User-Agent request header field. |
| 620 | "fake agent", |
| 621 | // JSON encoded experimental options. |
| 622 | "{\"QUIC\":{\"goaway_sessions_on_ip_change\":false}}", |
| 623 | // MockCertVerifier to use for testing purposes. |
| 624 | std::unique_ptr<net::CertVerifier>(), |
| 625 | // Enable network quality estimator. |
| 626 | false, |
| 627 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 628 | true, |
| 629 | // Optional network thread priority. |
| 630 | base::Optional<double>()); |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 631 | |
| 632 | net::URLRequestContextBuilder builder; |
| 633 | net::NetLog net_log; |
| 634 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 635 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 636 | builder.set_proxy_config_service( |
| 637 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 638 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 639 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 640 | const net::HttpNetworkSession::Params* params = |
| 641 | context->GetNetworkSessionParams(); |
| 642 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 643 | EXPECT_FALSE(params->quic_params.close_sessions_on_ip_change); |
| 644 | EXPECT_FALSE(params->quic_params.goaway_sessions_on_ip_change); |
Zhongyi Shi | aa518c2 | 2018-06-15 04:37:36 | [diff] [blame] | 645 | } |
| 646 | |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 647 | TEST(URLRequestContextConfigTest, SetQuicConnectionMigrationV2Options) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 648 | base::test::TaskEnvironment task_environment_( |
| 649 | base::test::TaskEnvironment::MainThreadType::IO); |
Zhongyi Shi | 6479562 | 2017-11-20 02:21:49 | [diff] [blame] | 650 | |
| 651 | URLRequestContextConfig config( |
| 652 | // Enable QUIC. |
| 653 | true, |
| 654 | // QUIC User Agent ID. |
| 655 | "Default QUIC User Agent ID", |
| 656 | // Enable SPDY. |
| 657 | true, |
| 658 | // Enable Brotli. |
| 659 | false, |
| 660 | // Type of http cache. |
| 661 | URLRequestContextConfig::HttpCacheType::DISK, |
| 662 | // Max size of http cache in bytes. |
| 663 | 1024000, |
| 664 | // Disable caching for HTTP responses. Other information may be stored in |
| 665 | // the cache. |
| 666 | false, |
| 667 | // Storage path for http cache and cookie storage. |
| 668 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 669 | // Accept-Language request header field. |
| 670 | "foreign-language", |
Zhongyi Shi | 6479562 | 2017-11-20 02:21:49 | [diff] [blame] | 671 | // User-Agent request header field. |
| 672 | "fake agent", |
| 673 | // JSON encoded experimental options. |
Zhongyi Shi | d02a48c | 2019-08-27 21:03:58 | [diff] [blame] | 674 | // Explicitly turn off "goaway_sessions_on_ip_change" which is default |
| 675 | // enabled on iOS but cannot be simultaneously set with migration option. |
Zhongyi Shi | f4683a3 | 2017-12-01 00:03:28 | [diff] [blame] | 676 | "{\"QUIC\":{\"migrate_sessions_on_network_change_v2\":true," |
Zhongyi Shi | d02a48c | 2019-08-27 21:03:58 | [diff] [blame] | 677 | "\"goaway_sessions_on_ip_change\":false," |
Zhongyi Shi | 73f23ca87 | 2017-12-13 18:37:13 | [diff] [blame] | 678 | "\"migrate_sessions_early_v2\":true," |
Zhongyi Shi | ff359581bc | 2018-09-26 18:11:48 | [diff] [blame] | 679 | "\"retry_on_alternate_network_before_handshake\":true," |
Zhongyi Shi | 32fe14d4 | 2019-02-28 00:25:36 | [diff] [blame] | 680 | "\"migrate_idle_sessions\":true," |
Zhongyi Shi | e01f2db | 2019-02-22 19:53:23 | [diff] [blame] | 681 | "\"retransmittable_on_wire_timeout_milliseconds\":1000," |
Zhongyi Shi | bc85e3e | 2019-02-12 19:34:42 | [diff] [blame] | 682 | "\"idle_session_migration_period_seconds\":15," |
Zhongyi Shi | 8b1e43f | 2017-12-13 20:46:30 | [diff] [blame] | 683 | "\"max_time_on_non_default_network_seconds\":10," |
Zhongyi Shi | ee76076 | 2018-08-01 00:54:29 | [diff] [blame] | 684 | "\"max_migrations_to_non_default_network_on_write_error\":3," |
Zhongyi Shi | 8b1e43f | 2017-12-13 20:46:30 | [diff] [blame] | 685 | "\"max_migrations_to_non_default_network_on_path_degrading\":4}}", |
Zhongyi Shi | 6479562 | 2017-11-20 02:21:49 | [diff] [blame] | 686 | // MockCertVerifier to use for testing purposes. |
| 687 | std::unique_ptr<net::CertVerifier>(), |
| 688 | // Enable network quality estimator. |
| 689 | false, |
| 690 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 691 | true, |
| 692 | // Optional network thread priority. |
| 693 | base::Optional<double>()); |
Zhongyi Shi | 6479562 | 2017-11-20 02:21:49 | [diff] [blame] | 694 | |
| 695 | net::URLRequestContextBuilder builder; |
| 696 | net::NetLog net_log; |
| 697 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 698 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 699 | builder.set_proxy_config_service( |
Lily Houghton | ef02885 | 2017-12-06 20:52:30 | [diff] [blame] | 700 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 701 | net::ProxyConfigWithAnnotation::CreateDirect())); |
Zhongyi Shi | 6479562 | 2017-11-20 02:21:49 | [diff] [blame] | 702 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 703 | const net::HttpNetworkSession::Params* params = |
| 704 | context->GetNetworkSessionParams(); |
| 705 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 706 | EXPECT_TRUE(params->quic_params.migrate_sessions_on_network_change_v2); |
| 707 | EXPECT_TRUE(params->quic_params.migrate_sessions_early_v2); |
| 708 | EXPECT_TRUE(params->quic_params.retry_on_alternate_network_before_handshake); |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 709 | EXPECT_EQ( |
| 710 | 1000, |
| 711 | params->quic_params.retransmittable_on_wire_timeout.InMilliseconds()); |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 712 | EXPECT_TRUE(params->quic_params.migrate_idle_sessions); |
Zhongyi Shi | bc85e3e | 2019-02-12 19:34:42 | [diff] [blame] | 713 | EXPECT_EQ(base::TimeDelta::FromSeconds(15), |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 714 | params->quic_params.idle_session_migration_period); |
Zhongyi Shi | 73f23ca87 | 2017-12-13 18:37:13 | [diff] [blame] | 715 | EXPECT_EQ(base::TimeDelta::FromSeconds(10), |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 716 | params->quic_params.max_time_on_non_default_network); |
Zhongyi Shi | 8b1e43f | 2017-12-13 20:46:30 | [diff] [blame] | 717 | EXPECT_EQ( |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 718 | 3, |
| 719 | params->quic_params.max_migrations_to_non_default_network_on_write_error); |
| 720 | EXPECT_EQ(4, params->quic_params |
| 721 | .max_migrations_to_non_default_network_on_path_degrading); |
Zhongyi Shi | 6479562 | 2017-11-20 02:21:49 | [diff] [blame] | 722 | } |
| 723 | |
Renjie | 94b9071 | 2018-10-18 21:03:19 | [diff] [blame] | 724 | TEST(URLRequestContextConfigTest, SetQuicStaleDNSracing) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 725 | base::test::TaskEnvironment task_environment_( |
| 726 | base::test::TaskEnvironment::MainThreadType::IO); |
Renjie | 94b9071 | 2018-10-18 21:03:19 | [diff] [blame] | 727 | |
| 728 | URLRequestContextConfig config( |
| 729 | // Enable QUIC. |
| 730 | true, |
| 731 | // QUIC User Agent ID. |
| 732 | "Default QUIC User Agent ID", |
| 733 | // Enable SPDY. |
| 734 | true, |
| 735 | // Enable Brotli. |
| 736 | false, |
| 737 | // Type of http cache. |
| 738 | URLRequestContextConfig::HttpCacheType::DISK, |
| 739 | // Max size of http cache in bytes. |
| 740 | 1024000, |
| 741 | // Disable caching for HTTP responses. Other information may be stored in |
| 742 | // the cache. |
| 743 | false, |
| 744 | // Storage path for http cache and cookie storage. |
| 745 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 746 | // Accept-Language request header field. |
| 747 | "foreign-language", |
| 748 | // User-Agent request header field. |
| 749 | "fake agent", |
| 750 | // JSON encoded experimental options. |
| 751 | "{\"QUIC\":{\"race_stale_dns_on_connection\":true}}", |
| 752 | // MockCertVerifier to use for testing purposes. |
| 753 | std::unique_ptr<net::CertVerifier>(), |
| 754 | // Enable network quality estimator. |
| 755 | false, |
| 756 | // Enable Public Key Pinning bypass for local trust anchors. |
| 757 | true, |
| 758 | // Optional network thread priority. |
| 759 | base::Optional<double>()); |
| 760 | |
| 761 | net::URLRequestContextBuilder builder; |
| 762 | net::NetLog net_log; |
| 763 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 764 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 765 | builder.set_proxy_config_service( |
| 766 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 767 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 768 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 769 | const net::HttpNetworkSession::Params* params = |
| 770 | context->GetNetworkSessionParams(); |
| 771 | |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 772 | EXPECT_TRUE(params->quic_params.race_stale_dns_on_connection); |
Renjie | 94b9071 | 2018-10-18 21:03:19 | [diff] [blame] | 773 | } |
| 774 | |
Renjie Tang | cbbc84c | 2019-09-06 22:23:23 | [diff] [blame] | 775 | TEST(URLRequestContextConfigTest, SetQuicGoawayOnPathDegrading) { |
| 776 | base::test::TaskEnvironment task_environment_( |
| 777 | base::test::TaskEnvironment::MainThreadType::IO); |
| 778 | |
| 779 | URLRequestContextConfig config( |
| 780 | // Enable QUIC. |
| 781 | true, |
| 782 | // QUIC User Agent ID. |
| 783 | "Default QUIC User Agent ID", |
| 784 | // Enable SPDY. |
| 785 | true, |
| 786 | // Enable Brotli. |
| 787 | false, |
| 788 | // Type of http cache. |
| 789 | URLRequestContextConfig::HttpCacheType::DISK, |
| 790 | // Max size of http cache in bytes. |
| 791 | 1024000, |
| 792 | // Disable caching for HTTP responses. Other information may be stored in |
| 793 | // the cache. |
| 794 | false, |
| 795 | // Storage path for http cache and cookie storage. |
| 796 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 797 | // Accept-Language request header field. |
| 798 | "foreign-language", |
| 799 | // User-Agent request header field. |
| 800 | "fake agent", |
| 801 | // JSON encoded experimental options. |
| 802 | "{\"QUIC\":{\"go_away_on_path_degrading\":true}}", |
| 803 | // MockCertVerifier to use for testing purposes. |
| 804 | std::unique_ptr<net::CertVerifier>(), |
| 805 | // Enable network quality estimator. |
| 806 | false, |
| 807 | // Enable Public Key Pinning bypass for local trust anchors. |
| 808 | true, |
| 809 | // Optional network thread priority. |
| 810 | base::Optional<double>()); |
| 811 | |
| 812 | net::URLRequestContextBuilder builder; |
| 813 | net::NetLog net_log; |
| 814 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 815 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 816 | builder.set_proxy_config_service( |
| 817 | std::make_unique<net::ProxyConfigServiceFixed>( |
| 818 | net::ProxyConfigWithAnnotation::CreateDirect())); |
| 819 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 820 | const net::HttpNetworkSession::Params* params = |
| 821 | context->GetNetworkSessionParams(); |
| 822 | |
| 823 | EXPECT_TRUE(params->quic_params.go_away_on_path_degrading); |
| 824 | } |
| 825 | |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 826 | TEST(URLRequestContextConfigTest, SetQuicHostWhitelist) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 827 | base::test::TaskEnvironment task_environment_( |
| 828 | base::test::TaskEnvironment::MainThreadType::IO); |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 829 | |
| 830 | URLRequestContextConfig config( |
| 831 | // Enable QUIC. |
| 832 | true, |
| 833 | // QUIC User Agent ID. |
| 834 | "Default QUIC User Agent ID", |
| 835 | // Enable SPDY. |
| 836 | true, |
| 837 | // Enable Brotli. |
| 838 | false, |
| 839 | // Type of http cache. |
| 840 | URLRequestContextConfig::HttpCacheType::DISK, |
| 841 | // Max size of http cache in bytes. |
| 842 | 1024000, |
| 843 | // Disable caching for HTTP responses. Other information may be stored in |
| 844 | // the cache. |
| 845 | false, |
| 846 | // Storage path for http cache and cookie storage. |
| 847 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 848 | // Accept-Language request header field. |
| 849 | "foreign-language", |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 850 | // User-Agent request header field. |
| 851 | "fake agent", |
| 852 | // JSON encoded experimental options. |
| 853 | "{\"QUIC\":{\"host_whitelist\":\"www.example.com,www.example.org\"}}", |
| 854 | // MockCertVerifier to use for testing purposes. |
| 855 | std::unique_ptr<net::CertVerifier>(), |
| 856 | // Enable network quality estimator. |
| 857 | false, |
| 858 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 859 | true, |
| 860 | // Optional network thread priority. |
| 861 | base::Optional<double>()); |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 862 | |
| 863 | net::URLRequestContextBuilder builder; |
| 864 | net::NetLog net_log; |
| 865 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 866 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 867 | builder.set_proxy_config_service( |
Lily Houghton | ef02885 | 2017-12-06 20:52:30 | [diff] [blame] | 868 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 869 | net::ProxyConfigWithAnnotation::CreateDirect())); |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 870 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 871 | const net::HttpNetworkSession::Params* params = |
| 872 | context->GetNetworkSessionParams(); |
| 873 | |
Ryan Sleevi | a9d6aa6 | 2019-07-26 13:32:18 | [diff] [blame] | 874 | EXPECT_TRUE(base::Contains(params->quic_host_allowlist, "www.example.com")); |
| 875 | EXPECT_TRUE(base::Contains(params->quic_host_allowlist, "www.example.org")); |
Yixin Wang | 10f477ed | 2017-11-21 04:20:20 | [diff] [blame] | 876 | } |
| 877 | |
Yixin Wang | 98387515 | 2017-11-21 20:30:13 | [diff] [blame] | 878 | TEST(URLRequestContextConfigTest, SetQuicMaxTimeBeforeCryptoHandshake) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 879 | base::test::TaskEnvironment task_environment_( |
| 880 | base::test::TaskEnvironment::MainThreadType::IO); |
Yixin Wang | 98387515 | 2017-11-21 20:30:13 | [diff] [blame] | 881 | |
| 882 | URLRequestContextConfig config( |
| 883 | // Enable QUIC. |
| 884 | true, |
| 885 | // QUIC User Agent ID. |
| 886 | "Default QUIC User Agent ID", |
| 887 | // Enable SPDY. |
| 888 | true, |
| 889 | // Enable Brotli. |
| 890 | false, |
| 891 | // Type of http cache. |
| 892 | URLRequestContextConfig::HttpCacheType::DISK, |
| 893 | // Max size of http cache in bytes. |
| 894 | 1024000, |
| 895 | // Disable caching for HTTP responses. Other information may be stored in |
| 896 | // the cache. |
| 897 | false, |
| 898 | // Storage path for http cache and cookie storage. |
| 899 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 900 | // Accept-Language request header field. |
| 901 | "foreign-language", |
Yixin Wang | 98387515 | 2017-11-21 20:30:13 | [diff] [blame] | 902 | // User-Agent request header field. |
| 903 | "fake agent", |
| 904 | // JSON encoded experimental options. |
| 905 | "{\"QUIC\":{\"max_time_before_crypto_handshake_seconds\":7," |
| 906 | "\"max_idle_time_before_crypto_handshake_seconds\":11}}", |
| 907 | // MockCertVerifier to use for testing purposes. |
| 908 | std::unique_ptr<net::CertVerifier>(), |
| 909 | // Enable network quality estimator. |
| 910 | false, |
| 911 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 912 | true, |
| 913 | // Optional network thread priority. |
| 914 | base::Optional<double>()); |
Yixin Wang | 98387515 | 2017-11-21 20:30:13 | [diff] [blame] | 915 | |
| 916 | net::URLRequestContextBuilder builder; |
| 917 | net::NetLog net_log; |
| 918 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 919 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 920 | builder.set_proxy_config_service( |
Lily Houghton | ef02885 | 2017-12-06 20:52:30 | [diff] [blame] | 921 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 922 | net::ProxyConfigWithAnnotation::CreateDirect())); |
Yixin Wang | 98387515 | 2017-11-21 20:30:13 | [diff] [blame] | 923 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 924 | const net::HttpNetworkSession::Params* params = |
| 925 | context->GetNetworkSessionParams(); |
| 926 | |
Ryan Sleevi | 2e8255b | 2019-07-17 21:02:21 | [diff] [blame] | 927 | EXPECT_EQ(7, |
| 928 | params->quic_params.max_time_before_crypto_handshake.InSeconds()); |
| 929 | EXPECT_EQ( |
| 930 | 11, |
| 931 | params->quic_params.max_idle_time_before_crypto_handshake.InSeconds()); |
Yixin Wang | 98387515 | 2017-11-21 20:30:13 | [diff] [blame] | 932 | } |
| 933 | |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 934 | TEST(URLURLRequestContextConfigTest, SetQuicConnectionOptions) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 935 | base::test::TaskEnvironment task_environment_( |
| 936 | base::test::TaskEnvironment::MainThreadType::IO); |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 937 | |
| 938 | URLRequestContextConfig config( |
| 939 | // Enable QUIC. |
| 940 | true, |
| 941 | // QUIC User Agent ID. |
| 942 | "Default QUIC User Agent ID", |
| 943 | // Enable SPDY. |
| 944 | true, |
| 945 | // Enable Brotli. |
| 946 | false, |
| 947 | // Type of http cache. |
| 948 | URLRequestContextConfig::HttpCacheType::DISK, |
| 949 | // Max size of http cache in bytes. |
| 950 | 1024000, |
| 951 | // Disable caching for HTTP responses. Other information may be stored in |
| 952 | // the cache. |
| 953 | false, |
| 954 | // Storage path for http cache and cookie storage. |
| 955 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 956 | // Accept-Language request header field. |
| 957 | "foreign-language", |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 958 | // User-Agent request header field. |
| 959 | "fake agent", |
| 960 | // JSON encoded experimental options. |
| 961 | "{\"QUIC\":{\"connection_options\":\"TIME,TBBR,REJ\"," |
| 962 | "\"client_connection_options\":\"TBBR,1RTT\"}}", |
| 963 | // MockCertVerifier to use for testing purposes. |
| 964 | std::unique_ptr<net::CertVerifier>(), |
| 965 | // Enable network quality estimator. |
| 966 | false, |
| 967 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 968 | true, |
| 969 | // Optional network thread priority. |
| 970 | base::Optional<double>()); |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 971 | |
| 972 | net::URLRequestContextBuilder builder; |
| 973 | net::NetLog net_log; |
| 974 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 975 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 976 | builder.set_proxy_config_service( |
Gyuyoung Kim | 6afb508 | 2018-01-19 13:35:57 | [diff] [blame] | 977 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 978 | net::ProxyConfigWithAnnotation::CreateDirect())); |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 979 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 980 | const net::HttpNetworkSession::Params* params = |
| 981 | context->GetNetworkSessionParams(); |
| 982 | |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 983 | quic::QuicTagVector connection_options; |
| 984 | connection_options.push_back(quic::kTIME); |
| 985 | connection_options.push_back(quic::kTBBR); |
| 986 | connection_options.push_back(quic::kREJ); |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 987 | EXPECT_EQ(connection_options, params->quic_params.connection_options); |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 988 | |
Ryan Hamilton | 8d9ee76e | 2018-05-29 23:52:52 | [diff] [blame] | 989 | quic::QuicTagVector client_connection_options; |
| 990 | client_connection_options.push_back(quic::kTBBR); |
| 991 | client_connection_options.push_back(quic::k1RTT); |
Nick Harper | 72ade19 | 2019-07-17 03:30:42 | [diff] [blame] | 992 | EXPECT_EQ(client_connection_options, |
| 993 | params->quic_params.client_connection_options); |
Yixin Wang | 1875fdb | 2017-12-06 02:26:49 | [diff] [blame] | 994 | } |
| 995 | |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 996 | TEST(URLURLRequestContextConfigTest, SetAcceptLanguageAndUserAgent) { |
Gabriel Charette | dfa3604 | 2019-08-19 17:30:11 | [diff] [blame] | 997 | base::test::TaskEnvironment task_environment_( |
| 998 | base::test::TaskEnvironment::MainThreadType::IO); |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 999 | |
| 1000 | URLRequestContextConfig config( |
| 1001 | // Enable QUIC. |
| 1002 | true, |
| 1003 | // QUIC User Agent ID. |
| 1004 | "Default QUIC User Agent ID", |
| 1005 | // Enable SPDY. |
| 1006 | true, |
| 1007 | // Enable Brotli. |
| 1008 | false, |
| 1009 | // Type of http cache. |
| 1010 | URLRequestContextConfig::HttpCacheType::DISK, |
| 1011 | // Max size of http cache in bytes. |
| 1012 | 1024000, |
| 1013 | // Disable caching for HTTP responses. Other information may be stored in |
| 1014 | // the cache. |
| 1015 | false, |
| 1016 | // Storage path for http cache and cookie storage. |
| 1017 | "/data/data/org.chromium.net/app_cronet_test/test_storage", |
| 1018 | // Accept-Language request header field. |
| 1019 | "foreign-language", |
| 1020 | // User-Agent request header field. |
| 1021 | "fake agent", |
| 1022 | // JSON encoded experimental options. |
| 1023 | "{}", |
| 1024 | // MockCertVerifier to use for testing purposes. |
| 1025 | std::unique_ptr<net::CertVerifier>(), |
| 1026 | // Enable network quality estimator. |
| 1027 | false, |
| 1028 | // Enable Public Key Pinning bypass for local trust anchors. |
Paul Jensen | 6a1ea3a | 2018-08-24 14:46:41 | [diff] [blame] | 1029 | true, |
| 1030 | // Optional network thread priority. |
| 1031 | base::Optional<double>()); |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 1032 | |
| 1033 | net::URLRequestContextBuilder builder; |
| 1034 | net::NetLog net_log; |
| 1035 | config.ConfigureURLRequestContextBuilder(&builder, &net_log); |
| 1036 | // Set a ProxyConfigService to avoid DCHECK failure when building. |
| 1037 | builder.set_proxy_config_service( |
| 1038 | std::make_unique<net::ProxyConfigServiceFixed>( |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 1039 | net::ProxyConfigWithAnnotation::CreateDirect())); |
Misha Efimov | d4ab3830 | 2018-01-30 23:56:42 | [diff] [blame] | 1040 | std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
| 1041 | EXPECT_EQ("foreign-language", |
| 1042 | context->http_user_agent_settings()->GetAcceptLanguage()); |
| 1043 | EXPECT_EQ("fake agent", context->http_user_agent_settings()->GetUserAgent()); |
| 1044 | } |
| 1045 | |
juliatuttle | 50d9c4b | 2016-08-23 22:49:19 | [diff] [blame] | 1046 | // See stale_host_resolver_unittest.cc for test of StaleDNS options. |
| 1047 | |
xunjieli | f24ee5f | 2015-11-23 18:05:26 | [diff] [blame] | 1048 | } // namespace cronet |