| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/url_request/url_request_test_util.h" | 5 #include "net/url_request/url_request_test_util.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (!ssl_config_service()) | 77 if (!ssl_config_service()) |
| 78 context_storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); | 78 context_storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); |
| 79 if (!http_auth_handler_factory()) { | 79 if (!http_auth_handler_factory()) { |
| 80 context_storage_.set_http_auth_handler_factory( | 80 context_storage_.set_http_auth_handler_factory( |
| 81 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); | 81 net::HttpAuthHandlerFactory::CreateDefault(host_resolver())); |
| 82 } | 82 } |
| 83 if (!http_server_properties()) { | 83 if (!http_server_properties()) { |
| 84 context_storage_.set_http_server_properties( | 84 context_storage_.set_http_server_properties( |
| 85 new net::HttpServerPropertiesImpl); | 85 new net::HttpServerPropertiesImpl); |
| 86 } | 86 } |
| 87 // In-memory server bound cert service. |
| 88 if (!server_bound_cert_service()) { |
| 89 context_storage_.set_server_bound_cert_service( |
| 90 new net::ServerBoundCertService( |
| 91 new net::DefaultServerBoundCertStore(NULL), |
| 92 base::WorkerPool::GetTaskRunner(true))); |
| 93 } |
| 87 net::HttpNetworkSession::Params params; | 94 net::HttpNetworkSession::Params params; |
| 88 params.host_resolver = host_resolver(); | 95 params.host_resolver = host_resolver(); |
| 89 params.cert_verifier = cert_verifier(); | 96 params.cert_verifier = cert_verifier(); |
| 97 params.server_bound_cert_service = server_bound_cert_service(); |
| 90 params.proxy_service = proxy_service(); | 98 params.proxy_service = proxy_service(); |
| 91 params.ssl_config_service = ssl_config_service(); | 99 params.ssl_config_service = ssl_config_service(); |
| 92 params.http_auth_handler_factory = http_auth_handler_factory(); | 100 params.http_auth_handler_factory = http_auth_handler_factory(); |
| 93 params.network_delegate = network_delegate(); | 101 params.network_delegate = network_delegate(); |
| 94 params.http_server_properties = http_server_properties(); | 102 params.http_server_properties = http_server_properties(); |
| 95 | 103 |
| 96 if (!http_transaction_factory()) { | 104 if (!http_transaction_factory()) { |
| 97 context_storage_.set_http_transaction_factory(new net::HttpCache( | 105 context_storage_.set_http_transaction_factory(new net::HttpCache( |
| 98 new net::HttpNetworkSession(params), | 106 new net::HttpNetworkSession(params), |
| 99 net::HttpCache::DefaultBackend::InMemory(0))); | 107 net::HttpCache::DefaultBackend::InMemory(0))); |
| 100 } | 108 } |
| 101 // In-memory cookie store. | 109 // In-memory cookie store. |
| 102 if (!cookie_store()) | 110 if (!cookie_store()) |
| 103 context_storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); | 111 context_storage_.set_cookie_store(new net::CookieMonster(NULL, NULL)); |
| 104 // In-memory origin bound cert service. | |
| 105 if (!server_bound_cert_service()) { | |
| 106 context_storage_.set_server_bound_cert_service( | |
| 107 new net::ServerBoundCertService( | |
| 108 new net::DefaultServerBoundCertStore(NULL), | |
| 109 base::WorkerPool::GetTaskRunner(true))); | |
| 110 } | |
| 111 if (accept_language().empty()) | 112 if (accept_language().empty()) |
| 112 set_accept_language("en-us,fr"); | 113 set_accept_language("en-us,fr"); |
| 113 if (accept_charset().empty()) | 114 if (accept_charset().empty()) |
| 114 set_accept_charset("iso-8859-1,*,utf-8"); | 115 set_accept_charset("iso-8859-1,*,utf-8"); |
| 115 if (!job_factory()) | 116 if (!job_factory()) |
| 116 context_storage_.set_job_factory(new net::URLRequestJobFactoryImpl); | 117 context_storage_.set_job_factory(new net::URLRequestJobFactoryImpl); |
| 117 } | 118 } |
| 118 | 119 |
| 119 TestURLRequest::TestURLRequest(const GURL& url, | 120 TestURLRequest::TestURLRequest(const GURL& url, |
| 120 Delegate* delegate, | 121 Delegate* delegate, |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 522 |
| 522 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { | 523 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { |
| 523 DCHECK_EQ(value_, new_value_); | 524 DCHECK_EQ(value_, new_value_); |
| 524 value_ = old_value_; | 525 value_ = old_value_; |
| 525 } | 526 } |
| 526 | 527 |
| 527 // static | 528 // static |
| 528 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { | 529 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { |
| 529 return value_; | 530 return value_; |
| 530 } | 531 } |
| OLD | NEW |