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

Side by Side Diff: net/url_request/url_request_test_util.cc

Issue 1893393003: Fix TestURLRequestContext's code to create a ChannelIDService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/url_request/url_request_test_util.h" 5 #include "net/url_request/url_request_test_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (!ssl_config_service()) 86 if (!ssl_config_service())
87 context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults()); 87 context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults());
88 if (!http_auth_handler_factory()) { 88 if (!http_auth_handler_factory()) {
89 context_storage_.set_http_auth_handler_factory( 89 context_storage_.set_http_auth_handler_factory(
90 HttpAuthHandlerFactory::CreateDefault(host_resolver())); 90 HttpAuthHandlerFactory::CreateDefault(host_resolver()));
91 } 91 }
92 if (!http_server_properties()) { 92 if (!http_server_properties()) {
93 context_storage_.set_http_server_properties( 93 context_storage_.set_http_server_properties(
94 std::unique_ptr<HttpServerProperties>(new HttpServerPropertiesImpl())); 94 std::unique_ptr<HttpServerProperties>(new HttpServerPropertiesImpl()));
95 } 95 }
96 // In-memory cookie store.
97 if (!cookie_store()) {
98 context_storage_.set_cookie_store(
99 base::WrapUnique(new CookieMonster(nullptr, nullptr)));
100 }
101 // In-memory Channel ID service. Must be created before the
102 // HttpNetworkSession.
103 if (!channel_id_service()) {
104 context_storage_.set_channel_id_service(base::WrapUnique(
105 new ChannelIDService(new DefaultChannelIDStore(nullptr),
106 base::WorkerPool::GetTaskRunner(true))));
107 }
96 if (http_transaction_factory()) { 108 if (http_transaction_factory()) {
97 // Make sure we haven't been passed an object we're not going to use. 109 // Make sure we haven't been passed an object we're not going to use.
98 EXPECT_FALSE(client_socket_factory_); 110 EXPECT_FALSE(client_socket_factory_);
99 } else { 111 } else {
100 HttpNetworkSession::Params params; 112 HttpNetworkSession::Params params;
101 113
102 if (http_network_session_params_) 114 if (http_network_session_params_)
103 params = *http_network_session_params_; 115 params = *http_network_session_params_;
104 params.client_socket_factory = client_socket_factory(); 116 params.client_socket_factory = client_socket_factory();
105 params.proxy_delegate = proxy_delegate(); 117 params.proxy_delegate = proxy_delegate();
106 params.host_resolver = host_resolver(); 118 params.host_resolver = host_resolver();
107 params.cert_verifier = cert_verifier(); 119 params.cert_verifier = cert_verifier();
108 params.cert_transparency_verifier = cert_transparency_verifier(); 120 params.cert_transparency_verifier = cert_transparency_verifier();
109 if (ct_policy_enforcer()) 121 if (ct_policy_enforcer())
110 params.ct_policy_enforcer = ct_policy_enforcer(); 122 params.ct_policy_enforcer = ct_policy_enforcer();
111 params.transport_security_state = transport_security_state(); 123 params.transport_security_state = transport_security_state();
112 params.proxy_service = proxy_service(); 124 params.proxy_service = proxy_service();
113 params.ssl_config_service = ssl_config_service(); 125 params.ssl_config_service = ssl_config_service();
114 params.http_auth_handler_factory = http_auth_handler_factory(); 126 params.http_auth_handler_factory = http_auth_handler_factory();
115 params.http_server_properties = http_server_properties(); 127 params.http_server_properties = http_server_properties();
116 params.net_log = net_log(); 128 params.net_log = net_log();
117 params.channel_id_service = channel_id_service(); 129 params.channel_id_service = channel_id_service();
118 context_storage_.set_http_network_session( 130 context_storage_.set_http_network_session(
119 base::WrapUnique(new HttpNetworkSession(params))); 131 base::WrapUnique(new HttpNetworkSession(params)));
120 context_storage_.set_http_transaction_factory(base::WrapUnique( 132 context_storage_.set_http_transaction_factory(base::WrapUnique(
121 new HttpCache(context_storage_.http_network_session(), 133 new HttpCache(context_storage_.http_network_session(),
122 HttpCache::DefaultBackend::InMemory(0), false))); 134 HttpCache::DefaultBackend::InMemory(0), false)));
123 } 135 }
124 // In-memory cookie store.
125 if (!cookie_store()) {
126 context_storage_.set_cookie_store(
127 base::WrapUnique(new CookieMonster(nullptr, nullptr)));
128 }
129 // In-memory Channel ID service.
130 if (!channel_id_service()) {
131 context_storage_.set_channel_id_service(base::WrapUnique(
132 new ChannelIDService(new DefaultChannelIDStore(nullptr),
133 base::WorkerPool::GetTaskRunner(true))));
134 }
135 if (!http_user_agent_settings()) { 136 if (!http_user_agent_settings()) {
136 context_storage_.set_http_user_agent_settings(base::WrapUnique( 137 context_storage_.set_http_user_agent_settings(base::WrapUnique(
137 new StaticHttpUserAgentSettings("en-us,fr", std::string()))); 138 new StaticHttpUserAgentSettings("en-us,fr", std::string())));
138 } 139 }
139 if (!job_factory()) { 140 if (!job_factory()) {
140 context_storage_.set_job_factory( 141 context_storage_.set_job_factory(
141 base::WrapUnique(new URLRequestJobFactoryImpl())); 142 base::WrapUnique(new URLRequestJobFactoryImpl()));
142 } 143 }
143 } 144 }
144 145
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 NetworkDelegate* network_delegate) const { 656 NetworkDelegate* network_delegate) const {
656 return main_intercept_job_.release(); 657 return main_intercept_job_.release();
657 } 658 }
658 659
659 void TestJobInterceptor::set_main_intercept_job( 660 void TestJobInterceptor::set_main_intercept_job(
660 std::unique_ptr<URLRequestJob> job) { 661 std::unique_ptr<URLRequestJob> job) {
661 main_intercept_job_ = std::move(job); 662 main_intercept_job_ = std::move(job);
662 } 663 }
663 664
664 } // namespace net 665 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698