| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/cert_verifier.h" | 11 #include "net/base/cert_verifier.h" |
| 12 #include "net/base/cookie_monster.h" | 12 #include "net/base/cookie_monster.h" |
| 13 #include "net/base/default_origin_bound_cert_store.h" |
| 13 #include "net/base/host_resolver.h" | 14 #include "net/base/host_resolver.h" |
| 15 #include "net/base/origin_bound_cert_service.h" |
| 14 #include "net/base/ssl_config_service_defaults.h" | 16 #include "net/base/ssl_config_service_defaults.h" |
| 15 #include "net/ftp/ftp_network_layer.h" | 17 #include "net/ftp/ftp_network_layer.h" |
| 16 #include "net/http/http_auth_handler_factory.h" | 18 #include "net/http/http_auth_handler_factory.h" |
| 17 #include "net/proxy/proxy_config_service.h" | 19 #include "net/proxy/proxy_config_service.h" |
| 18 #include "net/proxy/proxy_config_service_fixed.h" | 20 #include "net/proxy/proxy_config_service_fixed.h" |
| 19 #include "net/proxy/proxy_service.h" | 21 #include "net/proxy/proxy_service.h" |
| 20 #include "net/url_request/url_request_job_factory.h" | 22 #include "net/url_request/url_request_job_factory.h" |
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" |
| 23 #include "webkit/blob/blob_storage_controller.h" | 25 #include "webkit/blob/blob_storage_controller.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 39 bool no_proxy) | 41 bool no_proxy) |
| 40 : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { | 42 : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) { |
| 41 Init(cache_path, cache_mode, no_proxy); | 43 Init(cache_path, cache_mode, no_proxy); |
| 42 } | 44 } |
| 43 | 45 |
| 44 void TestShellRequestContext::Init( | 46 void TestShellRequestContext::Init( |
| 45 const FilePath& cache_path, | 47 const FilePath& cache_path, |
| 46 net::HttpCache::Mode cache_mode, | 48 net::HttpCache::Mode cache_mode, |
| 47 bool no_proxy) { | 49 bool no_proxy) { |
| 48 storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); | 50 storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); |
| 51 storage_.set_origin_bound_cert_service(new net::OriginBoundCertService( |
| 52 new net::DefaultOriginBoundCertStore(NULL))); |
| 49 | 53 |
| 50 // hard-code A-L and A-C for test shells | 54 // hard-code A-L and A-C for test shells |
| 51 set_accept_language("en-us,en"); | 55 set_accept_language("en-us,en"); |
| 52 set_accept_charset("iso-8859-1,*,utf-8"); | 56 set_accept_charset("iso-8859-1,*,utf-8"); |
| 53 | 57 |
| 54 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 58 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 55 // Use no proxy to avoid ProxyConfigServiceLinux. | 59 // Use no proxy to avoid ProxyConfigServiceLinux. |
| 56 // Enabling use of the ProxyConfigServiceLinux requires: | 60 // Enabling use of the ProxyConfigServiceLinux requires: |
| 57 // -Calling from a thread with a TYPE_UI MessageLoop, | 61 // -Calling from a thread with a TYPE_UI MessageLoop, |
| 58 // -If at all possible, passing in a pointer to the IO thread's MessageLoop, | 62 // -If at all possible, passing in a pointer to the IO thread's MessageLoop, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 79 new net::SSLConfigServiceDefaults); | 83 new net::SSLConfigServiceDefaults); |
| 80 | 84 |
| 81 storage_.set_http_auth_handler_factory( | 85 storage_.set_http_auth_handler_factory( |
| 82 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); | 86 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); |
| 83 | 87 |
| 84 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 88 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
| 85 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, | 89 cache_path.empty() ? net::MEMORY_CACHE : net::DISK_CACHE, |
| 86 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); | 90 cache_path, 0, SimpleResourceLoaderBridge::GetCacheThread()); |
| 87 | 91 |
| 88 net::HttpCache* cache = | 92 net::HttpCache* cache = |
| 89 new net::HttpCache(host_resolver(), cert_verifier(), NULL, NULL, | 93 new net::HttpCache(host_resolver(), cert_verifier(), |
| 94 origin_bound_cert_service(), NULL, NULL, |
| 90 proxy_service(), ssl_config_service(), | 95 proxy_service(), ssl_config_service(), |
| 91 http_auth_handler_factory(), NULL, NULL, backend); | 96 http_auth_handler_factory(), NULL, NULL, backend); |
| 92 | 97 |
| 93 cache->set_mode(cache_mode); | 98 cache->set_mode(cache_mode); |
| 94 storage_.set_http_transaction_factory(cache); | 99 storage_.set_http_transaction_factory(cache); |
| 95 | 100 |
| 96 storage_.set_ftp_transaction_factory( | 101 storage_.set_ftp_transaction_factory( |
| 97 new net::FtpNetworkLayer(host_resolver())); | 102 new net::FtpNetworkLayer(host_resolver())); |
| 98 | 103 |
| 99 blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); | 104 blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 114 storage_.set_job_factory(job_factory); | 119 storage_.set_job_factory(job_factory); |
| 115 } | 120 } |
| 116 | 121 |
| 117 TestShellRequestContext::~TestShellRequestContext() { | 122 TestShellRequestContext::~TestShellRequestContext() { |
| 118 } | 123 } |
| 119 | 124 |
| 120 const std::string& TestShellRequestContext::GetUserAgent( | 125 const std::string& TestShellRequestContext::GetUserAgent( |
| 121 const GURL& url) const { | 126 const GURL& url) const { |
| 122 return webkit_glue::GetUserAgent(url); | 127 return webkit_glue::GetUserAgent(url); |
| 123 } | 128 } |
| OLD | NEW |