Chromium Code Reviews| 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 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 request_failed_(false), | 216 request_failed_(false), |
| 217 have_certificate_errors_(false), | 217 have_certificate_errors_(false), |
| 218 buf_(new net::IOBuffer(kBufferSize)) { | 218 buf_(new net::IOBuffer(kBufferSize)) { |
| 219 } | 219 } |
| 220 | 220 |
| 221 virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, | 221 virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, |
| 222 bool* defer_redirect) { | 222 bool* defer_redirect) { |
| 223 received_redirect_count_++; | 223 received_redirect_count_++; |
| 224 if (quit_on_redirect_) { | 224 if (quit_on_redirect_) { |
| 225 *defer_redirect = true; | 225 *defer_redirect = true; |
| 226 MessageLoop::current()->Quit(); | 226 MessageLoop::current()->Quit(); |
|
wtc
2011/01/25 15:46:43
Please make the same change here for consistency.
| |
| 227 } else if (cancel_in_rr_) { | 227 } else if (cancel_in_rr_) { |
| 228 request->Cancel(); | 228 request->Cancel(); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 virtual void OnResponseStarted(net::URLRequest* request) { | 232 virtual void OnResponseStarted(net::URLRequest* request) { |
| 233 // It doesn't make sense for the request to have IO pending at this point. | 233 // It doesn't make sense for the request to have IO pending at this point. |
| 234 DCHECK(!request->status().is_io_pending()); | 234 DCHECK(!request->status().is_io_pending()); |
| 235 | 235 |
| 236 response_started_count_++; | 236 response_started_count_++; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 if (!request->status().is_io_pending()) | 285 if (!request->status().is_io_pending()) |
| 286 OnResponseCompleted(request); | 286 OnResponseCompleted(request); |
| 287 else if (cancel_in_rd_pending_) | 287 else if (cancel_in_rd_pending_) |
| 288 request->Cancel(); | 288 request->Cancel(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 virtual void OnResponseCompleted(net::URLRequest* request) { | 291 virtual void OnResponseCompleted(net::URLRequest* request) { |
| 292 if (quit_on_complete_) | 292 if (quit_on_complete_) |
| 293 MessageLoop::current()->Quit(); | 293 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void OnAuthRequired(net::URLRequest* request, | 296 void OnAuthRequired(net::URLRequest* request, |
| 297 net::AuthChallengeInfo* auth_info) { | 297 net::AuthChallengeInfo* auth_info) { |
| 298 if (!username_.empty() || !password_.empty()) { | 298 if (!username_.empty() || !password_.empty()) { |
| 299 request->SetAuth(username_, password_); | 299 request->SetAuth(username_, password_); |
| 300 } else { | 300 } else { |
| 301 request->CancelAuth(); | 301 request->CancelAuth(); |
| 302 } | 302 } |
| 303 } | 303 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 bool received_data_before_response_; | 396 bool received_data_before_response_; |
| 397 bool request_failed_; | 397 bool request_failed_; |
| 398 bool have_certificate_errors_; | 398 bool have_certificate_errors_; |
| 399 std::string data_received_; | 399 std::string data_received_; |
| 400 | 400 |
| 401 // our read buffer | 401 // our read buffer |
| 402 scoped_refptr<net::IOBuffer> buf_; | 402 scoped_refptr<net::IOBuffer> buf_; |
| 403 }; | 403 }; |
| 404 | 404 |
| 405 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ | 405 #endif // NET_URL_REQUEST_URL_REQUEST_UNITTEST_H_ |
| OLD | NEW |