OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" |
8 #include "base/values.h" | 9 #include "base/values.h" |
9 #include "net/cert/cert_verifier.h" | 10 #include "net/cert/cert_verifier.h" |
10 #include "net/http/http_network_session.h" | 11 #include "net/http/http_network_session.h" |
11 #include "net/log/net_log.h" | 12 #include "net/log/net_log.h" |
12 #include "net/log/net_log_with_source.h" | 13 #include "net/log/net_log_with_source.h" |
13 #include "net/proxy/proxy_config.h" | 14 #include "net/proxy/proxy_config.h" |
14 #include "net/proxy/proxy_config_service_fixed.h" | 15 #include "net/proxy/proxy_config_service_fixed.h" |
15 #include "net/url_request/url_request_context.h" | 16 #include "net/url_request/url_request_context.h" |
16 #include "net/url_request/url_request_context_builder.h" | 17 #include "net/url_request/url_request_context_builder.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 "", | 62 "", |
62 // MockCertVerifier to use for testing purposes. | 63 // MockCertVerifier to use for testing purposes. |
63 std::unique_ptr<net::CertVerifier>(), | 64 std::unique_ptr<net::CertVerifier>(), |
64 // Enable network quality estimator. | 65 // Enable network quality estimator. |
65 false, | 66 false, |
66 // Enable Public Key Pinning bypass for local trust anchors. | 67 // Enable Public Key Pinning bypass for local trust anchors. |
67 true, | 68 true, |
68 // Certificate verifier cache data. | 69 // Certificate verifier cache data. |
69 ""); | 70 ""); |
70 | 71 |
| 72 base::MessageLoop message_loop; |
71 net::URLRequestContextBuilder builder; | 73 net::URLRequestContextBuilder builder; |
72 net::NetLog net_log; | 74 net::NetLog net_log; |
73 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); | 75 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); |
74 // Set a ProxyConfigService to avoid DCHECK failure when building. | 76 // Set a ProxyConfigService to avoid DCHECK failure when building. |
75 builder.set_proxy_config_service( | 77 builder.set_proxy_config_service( |
76 base::MakeUnique<net::ProxyConfigServiceFixed>( | 78 base::MakeUnique<net::ProxyConfigServiceFixed>( |
77 net::ProxyConfig::CreateDirect())); | 79 net::ProxyConfig::CreateDirect())); |
78 std::unique_ptr<net::URLRequestContext> context(builder.Build()); | 80 std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
79 const net::HttpNetworkSession::Params* params = | 81 const net::HttpNetworkSession::Params* params = |
80 context->GetNetworkSessionParams(); | 82 context->GetNetworkSessionParams(); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 "", | 151 "", |
150 // MockCertVerifier to use for testing purposes. | 152 // MockCertVerifier to use for testing purposes. |
151 std::unique_ptr<net::CertVerifier>(), | 153 std::unique_ptr<net::CertVerifier>(), |
152 // Enable network quality estimator. | 154 // Enable network quality estimator. |
153 false, | 155 false, |
154 // Enable Public Key Pinning bypass for local trust anchors. | 156 // Enable Public Key Pinning bypass for local trust anchors. |
155 true, | 157 true, |
156 // Certificate verifier cache data. | 158 // Certificate verifier cache data. |
157 ""); | 159 ""); |
158 | 160 |
| 161 base::MessageLoop message_loop; |
159 net::URLRequestContextBuilder builder; | 162 net::URLRequestContextBuilder builder; |
160 net::NetLog net_log; | 163 net::NetLog net_log; |
161 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); | 164 config.ConfigureURLRequestContextBuilder(&builder, &net_log, nullptr); |
162 // Set a ProxyConfigService to avoid DCHECK failure when building. | 165 // Set a ProxyConfigService to avoid DCHECK failure when building. |
163 builder.set_proxy_config_service( | 166 builder.set_proxy_config_service( |
164 base::MakeUnique<net::ProxyConfigServiceFixed>( | 167 base::MakeUnique<net::ProxyConfigServiceFixed>( |
165 net::ProxyConfig::CreateDirect())); | 168 net::ProxyConfig::CreateDirect())); |
166 std::unique_ptr<net::URLRequestContext> context(builder.Build()); | 169 std::unique_ptr<net::URLRequestContext> context(builder.Build()); |
167 const net::HttpNetworkSession::Params* params = | 170 const net::HttpNetworkSession::Params* params = |
168 context->GetNetworkSessionParams(); | 171 context->GetNetworkSessionParams(); |
169 | 172 |
170 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); | 173 EXPECT_FALSE(params->quic_close_sessions_on_ip_change); |
171 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); | 174 EXPECT_TRUE(params->quic_migrate_sessions_on_network_change); |
172 EXPECT_TRUE(params->quic_migrate_sessions_early); | 175 EXPECT_TRUE(params->quic_migrate_sessions_early); |
173 } | 176 } |
174 | 177 |
175 // See stale_host_resolver_unittest.cc for test of StaleDNS options. | 178 // See stale_host_resolver_unittest.cc for test of StaleDNS options. |
176 | 179 |
177 } // namespace cronet | 180 } // namespace cronet |
OLD | NEW |