| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 TestURLRequestContext::~TestURLRequestContext() { | 55 TestURLRequestContext::~TestURLRequestContext() { |
| 56 DCHECK(initialized_); | 56 DCHECK(initialized_); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void TestURLRequestContext::Init() { | 59 void TestURLRequestContext::Init() { |
| 60 DCHECK(!initialized_); | 60 DCHECK(!initialized_); |
| 61 initialized_ = true; | 61 initialized_ = true; |
| 62 | 62 |
| 63 if (!host_resolver()) | 63 if (!host_resolver()) |
| 64 context_storage_.set_host_resolver(new net::MockCachingHostResolver()); | 64 context_storage_.set_host_resolver( |
| 65 scoped_ptr<net::HostResolver>(new net::MockCachingHostResolver())); |
| 65 if (!proxy_service()) | 66 if (!proxy_service()) |
| 66 context_storage_.set_proxy_service(net::ProxyService::CreateDirect()); | 67 context_storage_.set_proxy_service(net::ProxyService::CreateDirect()); |
| 67 if (!cert_verifier()) | 68 if (!cert_verifier()) |
| 68 context_storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); | 69 context_storage_.set_cert_verifier(net::CertVerifier::CreateDefault()); |
| 69 if (!ftp_transaction_factory()) { | 70 if (!ftp_transaction_factory()) { |
| 70 #if !defined(DISABLE_FTP_SUPPORT) | 71 #if !defined(DISABLE_FTP_SUPPORT) |
| 71 context_storage_.set_ftp_transaction_factory( | 72 context_storage_.set_ftp_transaction_factory( |
| 72 new net::FtpNetworkLayer(host_resolver())); | 73 new net::FtpNetworkLayer(host_resolver())); |
| 73 #else | 74 #else |
| 74 context_storage_.set_ftp_transaction_factory(NULL); | 75 context_storage_.set_ftp_transaction_factory(NULL); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 551 |
| 551 net::URLRequestJob* TestJobInterceptor::MaybeInterceptResponse( | 552 net::URLRequestJob* TestJobInterceptor::MaybeInterceptResponse( |
| 552 net::URLRequest* request, | 553 net::URLRequest* request, |
| 553 net::NetworkDelegate* network_delegate) const { | 554 net::NetworkDelegate* network_delegate) const { |
| 554 return NULL; | 555 return NULL; |
| 555 } | 556 } |
| 556 | 557 |
| 557 void TestJobInterceptor::set_main_intercept_job(net::URLRequestJob* job) { | 558 void TestJobInterceptor::set_main_intercept_job(net::URLRequestJob* job) { |
| 558 main_intercept_job_ = job; | 559 main_intercept_job_ = job; |
| 559 } | 560 } |
| OLD | NEW |