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

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

Issue 16501002: Give more request types a TransportSecurityState. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Enforce CalledOnValidThread in all non-static methods. Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | 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 "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
11 #include "base/threading/worker_pool.h" 11 #include "base/threading/worker_pool.h"
12 #include "net/base/host_port_pair.h" 12 #include "net/base/host_port_pair.h"
13 #include "net/cert/cert_verifier.h" 13 #include "net/cert/cert_verifier.h"
14 #include "net/dns/mock_host_resolver.h" 14 #include "net/dns/mock_host_resolver.h"
15 #include "net/http/http_network_session.h" 15 #include "net/http/http_network_session.h"
16 #include "net/http/http_server_properties_impl.h" 16 #include "net/http/http_server_properties_impl.h"
17 #include "net/http/transport_security_state.h"
17 #include "net/ssl/default_server_bound_cert_store.h" 18 #include "net/ssl/default_server_bound_cert_store.h"
18 #include "net/ssl/server_bound_cert_service.h" 19 #include "net/ssl/server_bound_cert_service.h"
19 #include "net/url_request/static_http_user_agent_settings.h" 20 #include "net/url_request/static_http_user_agent_settings.h"
20 #include "net/url_request/url_request_job_factory_impl.h" 21 #include "net/url_request/url_request_job_factory_impl.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 23
23 namespace net { 24 namespace net {
24 25
25 namespace { 26 namespace {
26 27
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 DCHECK(!initialized_); 66 DCHECK(!initialized_);
66 initialized_ = true; 67 initialized_ = true;
67 68
68 if (!host_resolver()) 69 if (!host_resolver())
69 context_storage_.set_host_resolver( 70 context_storage_.set_host_resolver(
70 scoped_ptr<HostResolver>(new MockCachingHostResolver())); 71 scoped_ptr<HostResolver>(new MockCachingHostResolver()));
71 if (!proxy_service()) 72 if (!proxy_service())
72 context_storage_.set_proxy_service(ProxyService::CreateDirect()); 73 context_storage_.set_proxy_service(ProxyService::CreateDirect());
73 if (!cert_verifier()) 74 if (!cert_verifier())
74 context_storage_.set_cert_verifier(CertVerifier::CreateDefault()); 75 context_storage_.set_cert_verifier(CertVerifier::CreateDefault());
76 if (!transport_security_state())
77 context_storage_.set_transport_security_state(new TransportSecurityState);
75 if (!ssl_config_service()) 78 if (!ssl_config_service())
76 context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults); 79 context_storage_.set_ssl_config_service(new SSLConfigServiceDefaults);
77 if (!http_auth_handler_factory()) { 80 if (!http_auth_handler_factory()) {
78 context_storage_.set_http_auth_handler_factory( 81 context_storage_.set_http_auth_handler_factory(
79 HttpAuthHandlerFactory::CreateDefault(host_resolver())); 82 HttpAuthHandlerFactory::CreateDefault(host_resolver()));
80 } 83 }
81 if (!http_server_properties()) { 84 if (!http_server_properties()) {
82 context_storage_.set_http_server_properties( 85 context_storage_.set_http_server_properties(
83 new HttpServerPropertiesImpl); 86 new HttpServerPropertiesImpl);
84 } 87 }
85 if (!transport_security_state()) { 88 if (!transport_security_state()) {
86 context_storage_.set_transport_security_state( 89 context_storage_.set_transport_security_state(
87 new TransportSecurityState()); 90 new TransportSecurityState());
88 } 91 }
89 if (http_transaction_factory()) { 92 if (http_transaction_factory()) {
90 // Make sure we haven't been passed an object we're not going to use. 93 // Make sure we haven't been passed an object we're not going to use.
91 EXPECT_FALSE(client_socket_factory_); 94 EXPECT_FALSE(client_socket_factory_);
92 } else { 95 } else {
93 HttpNetworkSession::Params params; 96 HttpNetworkSession::Params params;
94 params.client_socket_factory = client_socket_factory(); 97 params.client_socket_factory = client_socket_factory();
95 params.host_resolver = host_resolver(); 98 params.host_resolver = host_resolver();
96 params.cert_verifier = cert_verifier(); 99 params.cert_verifier = cert_verifier();
100 params.transport_security_state = transport_security_state();
97 params.proxy_service = proxy_service(); 101 params.proxy_service = proxy_service();
98 params.ssl_config_service = ssl_config_service(); 102 params.ssl_config_service = ssl_config_service();
99 params.http_auth_handler_factory = http_auth_handler_factory(); 103 params.http_auth_handler_factory = http_auth_handler_factory();
100 params.network_delegate = network_delegate(); 104 params.network_delegate = network_delegate();
101 params.http_server_properties = http_server_properties(); 105 params.http_server_properties = http_server_properties();
102 params.net_log = net_log(); 106 params.net_log = net_log();
103 context_storage_.set_http_transaction_factory(new HttpCache( 107 context_storage_.set_http_transaction_factory(new HttpCache(
104 new HttpNetworkSession(params), 108 new HttpNetworkSession(params),
105 HttpCache::DefaultBackend::InMemory(0))); 109 HttpCache::DefaultBackend::InMemory(0)));
106 } 110 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 URLRequestJob* job = main_intercept_job_; 585 URLRequestJob* job = main_intercept_job_;
582 main_intercept_job_ = NULL; 586 main_intercept_job_ = NULL;
583 return job; 587 return job;
584 } 588 }
585 589
586 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { 590 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) {
587 main_intercept_job_ = job; 591 main_intercept_job_ = job;
588 } 592 }
589 593
590 } // namespace net 594 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/fetch/fetch_client.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698