| 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/message_loop.h" | 9 #include "base/message_loop/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 TestURLRequestContext::TestURLRequestContext(bool delay_initialization) | 54 TestURLRequestContext::TestURLRequestContext(bool delay_initialization) |
| 55 : initialized_(false), | 55 : initialized_(false), |
| 56 client_socket_factory_(NULL), | 56 client_socket_factory_(NULL), |
| 57 context_storage_(this) { | 57 context_storage_(this) { |
| 58 if (!delay_initialization) | 58 if (!delay_initialization) |
| 59 Init(); | 59 Init(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 TestURLRequestContext::~TestURLRequestContext() { | 62 TestURLRequestContext::~TestURLRequestContext() { |
| 63 DCHECK(initialized_); | 63 DCHECK(initialized_); |
| 64 AssertNoURLRequests(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void TestURLRequestContext::Init() { | 67 void TestURLRequestContext::Init() { |
| 67 DCHECK(!initialized_); | 68 DCHECK(!initialized_); |
| 68 initialized_ = true; | 69 initialized_ = true; |
| 69 | 70 |
| 70 if (!host_resolver()) | 71 if (!host_resolver()) |
| 71 context_storage_.set_host_resolver( | 72 context_storage_.set_host_resolver( |
| 72 scoped_ptr<HostResolver>(new MockCachingHostResolver())); | 73 scoped_ptr<HostResolver>(new MockCachingHostResolver())); |
| 73 if (!proxy_service()) | 74 if (!proxy_service()) |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 URLRequestJob* job = main_intercept_job_; | 642 URLRequestJob* job = main_intercept_job_; |
| 642 main_intercept_job_ = NULL; | 643 main_intercept_job_ = NULL; |
| 643 return job; | 644 return job; |
| 644 } | 645 } |
| 645 | 646 |
| 646 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { | 647 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { |
| 647 main_intercept_job_ = job; | 648 main_intercept_job_ = job; |
| 648 } | 649 } |
| 649 | 650 |
| 650 } // namespace net | 651 } // namespace net |
| OLD | NEW |