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

Side by Side Diff: webkit/tools/test_shell/test_shell_request_context.cc

Issue 10834215: Remove static variables from HttpStreamFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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
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 "webkit/tools/test_shell/test_shell_request_context.h" 5 #include "webkit/tools/test_shell/test_shell_request_context.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
12 #include "base/threading/worker_pool.h" 12 #include "base/threading/worker_pool.h"
13 #include "net/base/cert_verifier.h" 13 #include "net/base/cert_verifier.h"
14 #include "net/base/default_server_bound_cert_store.h" 14 #include "net/base/default_server_bound_cert_store.h"
15 #include "net/base/host_resolver.h" 15 #include "net/base/host_resolver.h"
16 #include "net/base/server_bound_cert_service.h" 16 #include "net/base/server_bound_cert_service.h"
17 #include "net/base/ssl_config_service_defaults.h" 17 #include "net/base/ssl_config_service_defaults.h"
18 #include "net/cookies/cookie_monster.h" 18 #include "net/cookies/cookie_monster.h"
19 #include "net/ftp/ftp_network_layer.h" 19 #include "net/ftp/ftp_network_layer.h"
20 #include "net/http/http_auth_handler_factory.h" 20 #include "net/http/http_auth_handler_factory.h"
21 #include "net/http/http_network_session.h"
21 #include "net/http/http_server_properties_impl.h" 22 #include "net/http/http_server_properties_impl.h"
22 #include "net/proxy/proxy_config_service.h" 23 #include "net/proxy/proxy_config_service.h"
23 #include "net/proxy/proxy_config_service_fixed.h" 24 #include "net/proxy/proxy_config_service_fixed.h"
24 #include "net/proxy/proxy_service.h" 25 #include "net/proxy/proxy_service.h"
25 #include "net/url_request/url_request_job_factory.h" 26 #include "net/url_request/url_request_job_factory.h"
26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
27 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatfo rmSupport.h" 28 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebKitPlatfo rmSupport.h"
28 #include "webkit/blob/blob_storage_controller.h" 29 #include "webkit/blob/blob_storage_controller.h"
29 #include "webkit/blob/blob_url_request_job_factory.h" 30 #include "webkit/blob/blob_url_request_job_factory.h"
30 #include "webkit/fileapi/file_system_context.h" 31 #include "webkit/fileapi/file_system_context.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 storage_.set_http_auth_handler_factory( 90 storage_.set_http_auth_handler_factory(
90 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); 91 net::HttpAuthHandlerFactory::CreateDefault(host_resolver()));
91 storage_.set_http_server_properties( 92 storage_.set_http_server_properties(
92 new net::HttpServerPropertiesImpl); 93 new net::HttpServerPropertiesImpl);
93 94
94 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( 95 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend(
95 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, 96 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE,
96 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); 97 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread());
97 98
98 net::HttpCache* cache = 99 net::HttpNetworkSession::Params network_session_params;
99 new net::HttpCache(host_resolver(), 100 network_session_params.host_resolver = host_resolver();
100 cert_verifier(), 101 network_session_params.cert_verifier = cert_verifier();
101 server_bound_cert_service(), 102 network_session_params.server_bound_cert_service =
102 NULL, /* transport_security_state */ 103 server_bound_cert_service();
103 proxy_service(), 104 network_session_params.proxy_service = proxy_service();
104 "", /* ssl_session_cache_shard */ 105 network_session_params.ssl_config_service = ssl_config_service();
105 ssl_config_service(), 106 network_session_params.http_auth_handler_factory =
106 http_auth_handler_factory(), 107 http_auth_handler_factory();
107 NULL, /* network_delegate */ 108 network_session_params.http_server_properties = http_server_properties();
108 http_server_properties(),
109 NULL, /* netlog */
110 backend,
111 "" /* trusted_spdy_proxy */ );
112 109
110 network_session_params.host_resolver = host_resolver();
111 network_session_params.host_resolver = host_resolver();
112 network_session_params.host_resolver = host_resolver();
113 network_session_params.host_resolver = host_resolver();
mmenke 2012/08/23 18:11:28 I think that once should generally be enough.
114
115 net::HttpCache* cache = new net::HttpCache(
116 network_session_params, backend);
113 cache->set_mode(cache_mode); 117 cache->set_mode(cache_mode);
114 storage_.set_http_transaction_factory(cache); 118 storage_.set_http_transaction_factory(cache);
115 119
116 storage_.set_ftp_transaction_factory( 120 storage_.set_ftp_transaction_factory(
117 new net::FtpNetworkLayer(host_resolver())); 121 new net::FtpNetworkLayer(host_resolver()));
118 122
119 blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); 123 blob_storage_controller_.reset(new webkit_blob::BlobStorageController());
120 file_system_context_ = static_cast<SimpleFileSystem*>( 124 file_system_context_ = static_cast<SimpleFileSystem*>(
121 WebKit::webKitPlatformSupport()->fileSystem())->file_system_context(); 125 WebKit::webKitPlatformSupport()->fileSystem())->file_system_context();
122 126
123 net::URLRequestJobFactory* job_factory = new net::URLRequestJobFactory; 127 net::URLRequestJobFactory* job_factory = new net::URLRequestJobFactory;
124 job_factory->SetProtocolHandler( 128 job_factory->SetProtocolHandler(
125 "blob", 129 "blob",
126 new webkit_blob::BlobProtocolHandler( 130 new webkit_blob::BlobProtocolHandler(
127 blob_storage_controller_.get(), 131 blob_storage_controller_.get(),
128 SimpleResourceLoaderBridge::GetIoThread())); 132 SimpleResourceLoaderBridge::GetIoThread()));
129 job_factory->SetProtocolHandler( 133 job_factory->SetProtocolHandler(
130 "filesystem", 134 "filesystem",
131 fileapi::CreateFileSystemProtocolHandler(file_system_context_.get())); 135 fileapi::CreateFileSystemProtocolHandler(file_system_context_.get()));
132 storage_.set_job_factory(job_factory); 136 storage_.set_job_factory(job_factory);
133 } 137 }
134 138
135 TestShellRequestContext::~TestShellRequestContext() { 139 TestShellRequestContext::~TestShellRequestContext() {
136 } 140 }
137 141
138 const std::string& TestShellRequestContext::GetUserAgent( 142 const std::string& TestShellRequestContext::GetUserAgent(
139 const GURL& url) const { 143 const GURL& url) const {
140 return webkit_glue::GetUserAgent(url); 144 return webkit_glue::GetUserAgent(url);
141 } 145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698