| 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 "net/base/cookie_monster.h" | 7 #include "net/base/cookie_monster.h" |
| 8 #include "net/proxy/proxy_service.h" | 8 #include "net/proxy/proxy_service.h" |
| 9 #include "webkit/glue/webkit_glue.h" | 9 #include "webkit/glue/webkit_glue.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 void TestShellRequestContext::Init( | 22 void TestShellRequestContext::Init( |
| 23 const std::wstring& cache_path, | 23 const std::wstring& cache_path, |
| 24 net::HttpCache::Mode cache_mode, | 24 net::HttpCache::Mode cache_mode, |
| 25 bool no_proxy) { | 25 bool no_proxy) { |
| 26 cookie_store_ = new net::CookieMonster(); | 26 cookie_store_ = new net::CookieMonster(); |
| 27 | 27 |
| 28 // hard-code A-L and A-C for test shells | 28 // hard-code A-L and A-C for test shells |
| 29 accept_language_ = "en-us,en"; | 29 accept_language_ = "en-us,en"; |
| 30 accept_charset_ = "iso-8859-1,*,utf-8"; | 30 accept_charset_ = "iso-8859-1,*,utf-8"; |
| 31 | 31 |
| 32 net::ProxyInfo proxy_info; | 32 net::ProxyConfig proxy_config; |
| 33 proxy_info.UseDirect(); | 33 proxy_service_ = net::ProxyService::Create(no_proxy ? &proxy_config : NULL); |
| 34 proxy_service_ = net::ProxyService::Create(no_proxy ? &proxy_info : NULL); | |
| 35 | 34 |
| 36 net::HttpCache *cache; | 35 net::HttpCache *cache; |
| 37 if (cache_path.empty()) { | 36 if (cache_path.empty()) { |
| 38 cache = new net::HttpCache(proxy_service_, 0); | 37 cache = new net::HttpCache(proxy_service_, 0); |
| 39 } else { | 38 } else { |
| 40 cache = new net::HttpCache(proxy_service_, cache_path, 0); | 39 cache = new net::HttpCache(proxy_service_, cache_path, 0); |
| 41 } | 40 } |
| 42 cache->set_mode(cache_mode); | 41 cache->set_mode(cache_mode); |
| 43 http_transaction_factory_ = cache; | 42 http_transaction_factory_ = cache; |
| 44 } | 43 } |
| 45 | 44 |
| 46 TestShellRequestContext::~TestShellRequestContext() { | 45 TestShellRequestContext::~TestShellRequestContext() { |
| 47 delete cookie_store_; | 46 delete cookie_store_; |
| 48 delete http_transaction_factory_; | 47 delete http_transaction_factory_; |
| 49 delete proxy_service_; | 48 delete proxy_service_; |
| 50 } | 49 } |
| 51 | 50 |
| 52 const std::string& TestShellRequestContext::GetUserAgent( | 51 const std::string& TestShellRequestContext::GetUserAgent( |
| 53 const GURL& url) const { | 52 const GURL& url) const { |
| 54 return webkit_glue::GetUserAgent(url); | 53 return webkit_glue::GetUserAgent(url); |
| 55 } | 54 } |
| OLD | NEW |