Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: net/url_request/url_request_unittest.h

Issue 6329019: Use QuitTask instead of Quit() to signal request completion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698