OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "net/base/cert_verifier.h" |
10 #include "net/base/cookie_monster.h" | 11 #include "net/base/cookie_monster.h" |
11 #include "net/base/host_resolver.h" | 12 #include "net/base/host_resolver.h" |
12 #include "net/base/ssl_config_service.h" | 13 #include "net/base/ssl_config_service.h" |
13 #include "net/base/static_cookie_policy.h" | 14 #include "net/base/static_cookie_policy.h" |
14 #include "net/ftp/ftp_network_layer.h" | 15 #include "net/ftp/ftp_network_layer.h" |
15 #include "net/http/http_auth_handler_factory.h" | 16 #include "net/http/http_auth_handler_factory.h" |
16 #include "net/proxy/proxy_config_service.h" | 17 #include "net/proxy/proxy_config_service.h" |
17 #include "net/proxy/proxy_config_service_fixed.h" | 18 #include "net/proxy/proxy_config_service_fixed.h" |
18 #include "net/proxy/proxy_service.h" | 19 #include "net/proxy/proxy_service.h" |
19 #include "webkit/blob/blob_storage_controller.h" | 20 #include "webkit/blob/blob_storage_controller.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 new net::ProxyConfigServiceFixed(net::ProxyConfig())); | 56 new net::ProxyConfigServiceFixed(net::ProxyConfig())); |
56 #else | 57 #else |
57 // Use the system proxy settings. | 58 // Use the system proxy settings. |
58 scoped_ptr<net::ProxyConfigService> proxy_config_service( | 59 scoped_ptr<net::ProxyConfigService> proxy_config_service( |
59 net::ProxyService::CreateSystemProxyConfigService( | 60 net::ProxyService::CreateSystemProxyConfigService( |
60 MessageLoop::current(), NULL)); | 61 MessageLoop::current(), NULL)); |
61 #endif | 62 #endif |
62 host_resolver_ = | 63 host_resolver_ = |
63 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, | 64 net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, |
64 NULL, NULL); | 65 NULL, NULL); |
| 66 cert_verifier_ = new net::CertVerifier; |
65 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( | 67 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( |
66 proxy_config_service.release(), 0, NULL); | 68 proxy_config_service.release(), 0, NULL); |
67 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); | 69 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); |
68 | 70 |
69 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( | 71 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( |
70 host_resolver_); | 72 host_resolver_); |
71 | 73 |
72 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 74 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
73 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, | 75 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, |
74 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); | 76 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); |
75 | 77 |
76 net::HttpCache* cache = | 78 net::HttpCache* cache = |
77 new net::HttpCache(host_resolver_, NULL, NULL, proxy_service_, | 79 new net::HttpCache(host_resolver_, cert_verifier_, NULL, NULL, |
78 ssl_config_service_, http_auth_handler_factory_, NULL, | 80 proxy_service_, ssl_config_service_, |
79 NULL, backend); | 81 http_auth_handler_factory_, NULL, NULL, backend); |
80 | 82 |
81 cache->set_mode(cache_mode); | 83 cache->set_mode(cache_mode); |
82 http_transaction_factory_ = cache; | 84 http_transaction_factory_ = cache; |
83 | 85 |
84 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); | 86 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); |
85 | 87 |
86 blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); | 88 blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); |
87 } | 89 } |
88 | 90 |
89 TestShellRequestContext::~TestShellRequestContext() { | 91 TestShellRequestContext::~TestShellRequestContext() { |
90 delete ftp_transaction_factory_; | 92 delete ftp_transaction_factory_; |
91 delete http_transaction_factory_; | 93 delete http_transaction_factory_; |
92 delete http_auth_handler_factory_; | 94 delete http_auth_handler_factory_; |
93 delete static_cast<net::StaticCookiePolicy*>(cookie_policy_); | 95 delete static_cast<net::StaticCookiePolicy*>(cookie_policy_); |
| 96 delete cert_verifier_; |
94 delete host_resolver_; | 97 delete host_resolver_; |
95 } | 98 } |
96 | 99 |
97 const std::string& TestShellRequestContext::GetUserAgent( | 100 const std::string& TestShellRequestContext::GetUserAgent( |
98 const GURL& url) const { | 101 const GURL& url) const { |
99 return webkit_glue::GetUserAgent(url); | 102 return webkit_glue::GetUserAgent(url); |
100 } | 103 } |
OLD | NEW |