OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" |
11 #include "net/base/host_resolver.h" | 11 #include "net/base/host_resolver.h" |
12 #include "net/base/ssl_config_service.h" | 12 #include "net/base/ssl_config_service.h" |
| 13 #include "net/base/static_cookie_policy.h" |
13 #include "net/ftp/ftp_network_layer.h" | 14 #include "net/ftp/ftp_network_layer.h" |
14 #include "net/proxy/proxy_config_service.h" | 15 #include "net/proxy/proxy_config_service.h" |
15 #include "net/proxy/proxy_config_service_fixed.h" | 16 #include "net/proxy/proxy_config_service_fixed.h" |
16 #include "net/proxy/proxy_service.h" | 17 #include "net/proxy/proxy_service.h" |
17 #include "webkit/glue/webkit_glue.h" | 18 #include "webkit/glue/webkit_glue.h" |
18 | 19 |
19 TestShellRequestContext::TestShellRequestContext() { | 20 TestShellRequestContext::TestShellRequestContext() { |
20 Init(FilePath(), net::HttpCache::NORMAL, false); | 21 Init(FilePath(), net::HttpCache::NORMAL, false); |
21 } | 22 } |
22 | 23 |
23 TestShellRequestContext::TestShellRequestContext( | 24 TestShellRequestContext::TestShellRequestContext( |
24 const FilePath& cache_path, | 25 const FilePath& cache_path, |
25 net::HttpCache::Mode cache_mode, | 26 net::HttpCache::Mode cache_mode, |
26 bool no_proxy) { | 27 bool no_proxy) { |
27 Init(cache_path, cache_mode, no_proxy); | 28 Init(cache_path, cache_mode, no_proxy); |
28 } | 29 } |
29 | 30 |
30 void TestShellRequestContext::Init( | 31 void TestShellRequestContext::Init( |
31 const FilePath& cache_path, | 32 const FilePath& cache_path, |
32 net::HttpCache::Mode cache_mode, | 33 net::HttpCache::Mode cache_mode, |
33 bool no_proxy) { | 34 bool no_proxy) { |
34 cookie_store_ = new net::CookieMonster(); | 35 cookie_store_ = new net::CookieMonster(); |
| 36 cookie_policy_ = new net::StaticCookiePolicy(); |
35 | 37 |
36 // hard-code A-L and A-C for test shells | 38 // hard-code A-L and A-C for test shells |
37 accept_language_ = "en-us,en"; | 39 accept_language_ = "en-us,en"; |
38 accept_charset_ = "iso-8859-1,*,utf-8"; | 40 accept_charset_ = "iso-8859-1,*,utf-8"; |
39 | 41 |
40 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 42 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
41 // Use no proxy to avoid ProxyConfigServiceLinux. | 43 // Use no proxy to avoid ProxyConfigServiceLinux. |
42 // Enabling use of the ProxyConfigServiceLinux requires: | 44 // Enabling use of the ProxyConfigServiceLinux requires: |
43 // -Calling from a thread with a TYPE_UI MessageLoop, | 45 // -Calling from a thread with a TYPE_UI MessageLoop, |
44 // -If at all possible, passing in a pointer to the IO thread's MessageLoop, | 46 // -If at all possible, passing in a pointer to the IO thread's MessageLoop, |
(...skipping 23 matching lines...) Expand all Loading... |
68 } | 70 } |
69 cache->set_mode(cache_mode); | 71 cache->set_mode(cache_mode); |
70 http_transaction_factory_ = cache; | 72 http_transaction_factory_ = cache; |
71 | 73 |
72 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); | 74 ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); |
73 } | 75 } |
74 | 76 |
75 TestShellRequestContext::~TestShellRequestContext() { | 77 TestShellRequestContext::~TestShellRequestContext() { |
76 delete ftp_transaction_factory_; | 78 delete ftp_transaction_factory_; |
77 delete http_transaction_factory_; | 79 delete http_transaction_factory_; |
| 80 delete static_cast<net::StaticCookiePolicy*>(cookie_policy_); |
78 } | 81 } |
79 | 82 |
80 const std::string& TestShellRequestContext::GetUserAgent( | 83 const std::string& TestShellRequestContext::GetUserAgent( |
81 const GURL& url) const { | 84 const GURL& url) const { |
82 return webkit_glue::GetUserAgent(url); | 85 return webkit_glue::GetUserAgent(url); |
83 } | 86 } |
OLD | NEW |