OLD | NEW |
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 "webkit/support/test_shell_request_context.h" | 5 #include "webkit/support/test_shell_request_context.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "net/base/cache_type.h" | 12 #include "net/base/cache_type.h" |
13 #include "net/cert/cert_verifier.h" | 13 #include "net/cert/cert_verifier.h" |
14 #include "net/cookies/cookie_monster.h" | 14 #include "net/cookies/cookie_monster.h" |
15 #include "net/dns/host_resolver.h" | 15 #include "net/dns/host_resolver.h" |
16 #include "net/http/http_auth_handler_factory.h" | 16 #include "net/http/http_auth_handler_factory.h" |
17 #include "net/http/http_network_session.h" | 17 #include "net/http/http_network_session.h" |
18 #include "net/http/http_server_properties_impl.h" | 18 #include "net/http/http_server_properties_impl.h" |
| 19 #include "net/http/transport_security_state.h" |
19 #include "net/proxy/proxy_config_service.h" | 20 #include "net/proxy/proxy_config_service.h" |
20 #include "net/proxy/proxy_config_service_fixed.h" | 21 #include "net/proxy/proxy_config_service_fixed.h" |
21 #include "net/proxy/proxy_service.h" | 22 #include "net/proxy/proxy_service.h" |
22 #include "net/ssl/default_server_bound_cert_store.h" | 23 #include "net/ssl/default_server_bound_cert_store.h" |
23 #include "net/ssl/server_bound_cert_service.h" | 24 #include "net/ssl/server_bound_cert_service.h" |
24 #include "net/ssl/ssl_config_service_defaults.h" | 25 #include "net/ssl/ssl_config_service_defaults.h" |
25 #include "net/url_request/data_protocol_handler.h" | 26 #include "net/url_request/data_protocol_handler.h" |
26 #include "net/url_request/file_protocol_handler.h" | 27 #include "net/url_request/file_protocol_handler.h" |
27 #include "net/url_request/http_user_agent_settings.h" | 28 #include "net/url_request/http_user_agent_settings.h" |
28 #include "net/url_request/url_request_job_factory_impl.h" | 29 #include "net/url_request/url_request_job_factory_impl.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 base::WorkerPool::GetTaskRunner(true))); | 78 base::WorkerPool::GetTaskRunner(true))); |
78 | 79 |
79 storage_.set_http_user_agent_settings(new TestShellHttpUserAgentSettings); | 80 storage_.set_http_user_agent_settings(new TestShellHttpUserAgentSettings); |
80 | 81 |
81 // Use no proxy; it's not needed for testing and just breaks things. | 82 // Use no proxy; it's not needed for testing and just breaks things. |
82 scoped_ptr<net::ProxyConfigService> proxy_config_service( | 83 scoped_ptr<net::ProxyConfigService> proxy_config_service( |
83 new net::ProxyConfigServiceFixed(net::ProxyConfig())); | 84 new net::ProxyConfigServiceFixed(net::ProxyConfig())); |
84 | 85 |
85 storage_.set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); | 86 storage_.set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); |
86 storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); | 87 storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); |
| 88 storage_.set_transport_security_state(new net::TransportSecurityState); |
87 storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( | 89 storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( |
88 proxy_config_service.release(), 0, NULL)); | 90 proxy_config_service.release(), 0, NULL)); |
89 storage_.set_ssl_config_service( | 91 storage_.set_ssl_config_service( |
90 new net::SSLConfigServiceDefaults); | 92 new net::SSLConfigServiceDefaults); |
91 | 93 |
92 storage_.set_http_auth_handler_factory( | 94 storage_.set_http_auth_handler_factory( |
93 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); | 95 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); |
94 storage_.set_http_server_properties( | 96 storage_.set_http_server_properties( |
95 new net::HttpServerPropertiesImpl); | 97 new net::HttpServerPropertiesImpl); |
96 | 98 |
97 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 99 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
98 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, | 100 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, |
99 net::CACHE_BACKEND_DEFAULT, | 101 net::CACHE_BACKEND_DEFAULT, |
100 cache_path, | 102 cache_path, |
101 0, | 103 0, |
102 SimpleResourceLoaderBridge::GetCacheThread().get()); | 104 SimpleResourceLoaderBridge::GetCacheThread().get()); |
103 | 105 |
104 net::HttpNetworkSession::Params network_session_params; | 106 net::HttpNetworkSession::Params network_session_params; |
105 network_session_params.host_resolver = host_resolver(); | 107 network_session_params.host_resolver = host_resolver(); |
106 network_session_params.cert_verifier = cert_verifier(); | 108 network_session_params.cert_verifier = cert_verifier(); |
| 109 network_session_params.transport_security_state = transport_security_state(); |
107 network_session_params.server_bound_cert_service = | 110 network_session_params.server_bound_cert_service = |
108 server_bound_cert_service(); | 111 server_bound_cert_service(); |
109 network_session_params.proxy_service = proxy_service(); | 112 network_session_params.proxy_service = proxy_service(); |
110 network_session_params.ssl_config_service = ssl_config_service(); | 113 network_session_params.ssl_config_service = ssl_config_service(); |
111 network_session_params.http_auth_handler_factory = | 114 network_session_params.http_auth_handler_factory = |
112 http_auth_handler_factory(); | 115 http_auth_handler_factory(); |
113 network_session_params.http_server_properties = http_server_properties(); | 116 network_session_params.http_server_properties = http_server_properties(); |
114 network_session_params.host_resolver = host_resolver(); | 117 network_session_params.host_resolver = host_resolver(); |
115 | 118 |
116 net::HttpCache* cache = new net::HttpCache( | 119 net::HttpCache* cache = new net::HttpCache( |
(...skipping 16 matching lines...) Expand all Loading... |
133 job_factory->SetProtocolHandler( | 136 job_factory->SetProtocolHandler( |
134 "filesystem", | 137 "filesystem", |
135 fileapi::CreateFileSystemProtocolHandler(file_system_context_.get())); | 138 fileapi::CreateFileSystemProtocolHandler(file_system_context_.get())); |
136 job_factory->SetProtocolHandler("data", new net::DataProtocolHandler); | 139 job_factory->SetProtocolHandler("data", new net::DataProtocolHandler); |
137 job_factory->SetProtocolHandler("file", new net::FileProtocolHandler); | 140 job_factory->SetProtocolHandler("file", new net::FileProtocolHandler); |
138 storage_.set_job_factory(job_factory); | 141 storage_.set_job_factory(job_factory); |
139 } | 142 } |
140 | 143 |
141 TestShellRequestContext::~TestShellRequestContext() { | 144 TestShellRequestContext::~TestShellRequestContext() { |
142 } | 145 } |
OLD | NEW |