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

Side by Side Diff: net/url_request/url_request_test_util.cc

Issue 398903002: Plumb redirect info out of net, through content, and into child processes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: darin comments Created 6 years, 4 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 | « net/url_request/url_request_test_util.h ('k') | net/url_request/url_request_unittest.cc » ('j') | 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) 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 188 }
189 189
190 TestDelegate::~TestDelegate() {} 190 TestDelegate::~TestDelegate() {}
191 191
192 void TestDelegate::ClearFullRequestHeaders() { 192 void TestDelegate::ClearFullRequestHeaders() {
193 full_request_headers_.Clear(); 193 full_request_headers_.Clear();
194 have_full_request_headers_ = false; 194 have_full_request_headers_ = false;
195 } 195 }
196 196
197 void TestDelegate::OnReceivedRedirect(URLRequest* request, 197 void TestDelegate::OnReceivedRedirect(URLRequest* request,
198 const GURL& new_url, 198 const RedirectInfo& redirect_info,
199 bool* defer_redirect) { 199 bool* defer_redirect) {
200 EXPECT_TRUE(request->is_redirecting()); 200 EXPECT_TRUE(request->is_redirecting());
201 201
202 have_full_request_headers_ = 202 have_full_request_headers_ =
203 request->GetFullRequestHeaders(&full_request_headers_); 203 request->GetFullRequestHeaders(&full_request_headers_);
204 204
205 received_redirect_count_++; 205 received_redirect_count_++;
206 if (quit_on_redirect_) { 206 if (quit_on_redirect_) {
207 *defer_redirect = true; 207 *defer_redirect = true;
208 base::MessageLoop::current()->PostTask(FROM_HERE, 208 base::MessageLoop::current()->PostTask(FROM_HERE,
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // destructor also calls Cancel. Either officially support this or fix the 359 // destructor also calls Cancel. Either officially support this or fix the
360 // ResourceLoader code. 360 // ResourceLoader code.
361 next_states_[request_id] = kStageBeforeURLRequest | kStageCompletedError; 361 next_states_[request_id] = kStageBeforeURLRequest | kStageCompletedError;
362 event_order_[request_id] = ""; 362 event_order_[request_id] = "";
363 } 363 }
364 } 364 }
365 365
366 int TestNetworkDelegate::OnBeforeURLRequest( 366 int TestNetworkDelegate::OnBeforeURLRequest(
367 URLRequest* request, 367 URLRequest* request,
368 const CompletionCallback& callback, 368 const CompletionCallback& callback,
369 GURL* new_url ) { 369 GURL* new_url) {
370 int req_id = request->identifier(); 370 int req_id = request->identifier();
371 InitRequestStatesIfNew(req_id); 371 InitRequestStatesIfNew(req_id);
372 event_order_[req_id] += "OnBeforeURLRequest\n"; 372 event_order_[req_id] += "OnBeforeURLRequest\n";
373 EXPECT_TRUE(next_states_[req_id] & kStageBeforeURLRequest) << 373 EXPECT_TRUE(next_states_[req_id] & kStageBeforeURLRequest) <<
374 event_order_[req_id]; 374 event_order_[req_id];
375 next_states_[req_id] = 375 next_states_[req_id] =
376 kStageBeforeSendHeaders | 376 kStageBeforeSendHeaders |
377 kStageResponseStarted | // data: URLs do not trigger sending headers 377 kStageResponseStarted | // data: URLs do not trigger sending headers
378 kStageBeforeRedirect | // a delegate can trigger a redirection 378 kStageBeforeRedirect | // a delegate can trigger a redirection
379 kStageCompletedError | // request canceled by delegate 379 kStageCompletedError | // request canceled by delegate
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 URLRequestJob* job = main_intercept_job_; 642 URLRequestJob* job = main_intercept_job_;
643 main_intercept_job_ = NULL; 643 main_intercept_job_ = NULL;
644 return job; 644 return job;
645 } 645 }
646 646
647 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) { 647 void TestJobInterceptor::set_main_intercept_job(URLRequestJob* job) {
648 main_intercept_job_ = job; 648 main_intercept_job_ = job;
649 } 649 }
650 650
651 } // namespace net 651 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_util.h ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698