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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 } | 157 } |
158 | 158 |
159 | 159 |
160 TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate) | 160 TestURLRequest::TestURLRequest(const GURL& url, Delegate* delegate) |
161 : net::URLRequest(url, delegate) { | 161 : net::URLRequest(url, delegate) { |
162 set_context(new TestURLRequestContext()); | 162 set_context(new TestURLRequestContext()); |
163 } | 163 } |
164 | 164 |
165 TestURLRequest::~TestURLRequest() {} | 165 TestURLRequest::~TestURLRequest() {} |
166 | 166 |
| 167 TestURLRequestContextGetter::TestURLRequestContextGetter( |
| 168 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy) |
| 169 : io_message_loop_proxy_(io_message_loop_proxy) { |
| 170 DCHECK(io_message_loop_proxy.get()); |
| 171 } |
| 172 |
| 173 TestURLRequestContextGetter::~TestURLRequestContextGetter() {} |
| 174 |
| 175 TestURLRequestContext* TestURLRequestContextGetter::GetURLRequestContext() { |
| 176 if (!context_) |
| 177 context_ = new TestURLRequestContext(); |
| 178 return context_.get(); |
| 179 } |
| 180 |
| 181 scoped_refptr<base::MessageLoopProxy> |
| 182 TestURLRequestContextGetter::GetIOMessageLoopProxy() const { |
| 183 return io_message_loop_proxy_; |
| 184 } |
| 185 |
167 TestDelegate::TestDelegate() | 186 TestDelegate::TestDelegate() |
168 : cancel_in_rr_(false), | 187 : cancel_in_rr_(false), |
169 cancel_in_rs_(false), | 188 cancel_in_rs_(false), |
170 cancel_in_rd_(false), | 189 cancel_in_rd_(false), |
171 cancel_in_rd_pending_(false), | 190 cancel_in_rd_pending_(false), |
172 quit_on_complete_(true), | 191 quit_on_complete_(true), |
173 quit_on_redirect_(false), | 192 quit_on_redirect_(false), |
174 allow_certificate_errors_(false), | 193 allow_certificate_errors_(false), |
175 cookie_options_bit_mask_(0), | 194 cookie_options_bit_mask_(0), |
176 response_started_count_(0), | 195 response_started_count_(0), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 536 |
518 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { | 537 ScopedCustomUrlRequestTestHttpHost::~ScopedCustomUrlRequestTestHttpHost() { |
519 DCHECK_EQ(value_, new_value_); | 538 DCHECK_EQ(value_, new_value_); |
520 value_ = old_value_; | 539 value_ = old_value_; |
521 } | 540 } |
522 | 541 |
523 // static | 542 // static |
524 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { | 543 const std::string& ScopedCustomUrlRequestTestHttpHost::value() { |
525 return value_; | 544 return value_; |
526 } | 545 } |
OLD | NEW |