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/cookie_monster.h" | 10 #include "net/base/cookie_monster.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // non-functional on linux in this context because of v8 threading | 50 // non-functional on linux in this context because of v8 threading |
51 // issues. | 51 // issues. |
52 // TODO(port): rename "linux" to some nonspecific unix. | 52 // TODO(port): rename "linux" to some nonspecific unix. |
53 scoped_ptr<net::ProxyConfigService> proxy_config_service( | 53 scoped_ptr<net::ProxyConfigService> proxy_config_service( |
54 new net::ProxyConfigServiceFixed(net::ProxyConfig())); | 54 new net::ProxyConfigServiceFixed(net::ProxyConfig())); |
55 #else | 55 #else |
56 // Use the system proxy settings. | 56 // Use the system proxy settings. |
57 scoped_ptr<net::ProxyConfigService> proxy_config_service( | 57 scoped_ptr<net::ProxyConfigService> proxy_config_service( |
58 net::ProxyService::CreateSystemProxyConfigService(NULL, NULL)); | 58 net::ProxyService::CreateSystemProxyConfigService(NULL, NULL)); |
59 #endif | 59 #endif |
60 host_resolver_ = net::CreateSystemHostResolver(NULL); | 60 host_resolver_ = net::CreateSystemHostResolver(); |
61 proxy_service_ = net::ProxyService::Create(proxy_config_service.release(), | 61 proxy_service_ = net::ProxyService::Create(proxy_config_service.release(), |
62 false, NULL, NULL, NULL, NULL); | 62 false, NULL, NULL, NULL); |
63 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); | 63 ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); |
64 | 64 |
65 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(); | 65 http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault(); |
66 | 66 |
67 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 67 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
68 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, | 68 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, |
69 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); | 69 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); |
70 | 70 |
71 net::HttpCache* cache = | 71 net::HttpCache* cache = |
72 new net::HttpCache(NULL, host_resolver_, proxy_service_, | 72 new net::HttpCache(host_resolver_, proxy_service_, ssl_config_service_, |
73 ssl_config_service_, http_auth_handler_factory_, | 73 http_auth_handler_factory_, NULL, NULL, backend); |
74 NULL, NULL, backend); | |
75 | 74 |
76 cache->set_mode(cache_mode); | 75 cache->set_mode(cache_mode); |
77 http_transaction_factory_ = cache; | 76 http_transaction_factory_ = cache; |
78 | 77 |
79 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); | 78 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); |
80 } | 79 } |
81 | 80 |
82 TestShellRequestContext::~TestShellRequestContext() { | 81 TestShellRequestContext::~TestShellRequestContext() { |
83 delete ftp_transaction_factory_; | 82 delete ftp_transaction_factory_; |
84 delete http_transaction_factory_; | 83 delete http_transaction_factory_; |
85 delete http_auth_handler_factory_; | 84 delete http_auth_handler_factory_; |
86 delete static_cast<net::StaticCookiePolicy*>(cookie_policy_); | 85 delete static_cast<net::StaticCookiePolicy*>(cookie_policy_); |
87 } | 86 } |
88 | 87 |
89 const std::string& TestShellRequestContext::GetUserAgent( | 88 const std::string& TestShellRequestContext::GetUserAgent( |
90 const GURL& url) const { | 89 const GURL& url) const { |
91 return webkit_glue::GetUserAgent(url); | 90 return webkit_glue::GetUserAgent(url); |
92 } | 91 } |
OLD | NEW |