| 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 #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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 *defer_redirect = true; | 188 *defer_redirect = true; |
| 189 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); | 189 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); |
| 190 } else if (cancel_in_rr_) { | 190 } else if (cancel_in_rr_) { |
| 191 request->Cancel(); | 191 request->Cancel(); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 void TestDelegate::OnAuthRequired(net::URLRequest* request, | 195 void TestDelegate::OnAuthRequired(net::URLRequest* request, |
| 196 net::AuthChallengeInfo* auth_info) { | 196 net::AuthChallengeInfo* auth_info) { |
| 197 auth_required_ = true; | 197 auth_required_ = true; |
| 198 if (!username_.empty() || !password_.empty()) { | 198 if (!credentials_.Empty()) { |
| 199 request->SetAuth(username_, password_); | 199 request->SetAuth(credentials_); |
| 200 } else { | 200 } else { |
| 201 request->CancelAuth(); | 201 request->CancelAuth(); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 void TestDelegate::OnSSLCertificateError(net::URLRequest* request, | 205 void TestDelegate::OnSSLCertificateError(net::URLRequest* request, |
| 206 const net::SSLInfo& ssl_info, | 206 const net::SSLInfo& ssl_info, |
| 207 bool is_hsts_host) { | 207 bool is_hsts_host) { |
| 208 // The caller can control whether it needs all SSL requests to go through, | 208 // The caller can control whether it needs all SSL requests to go through, |
| 209 // independent of any possible errors, or whether it wants SSL errors to | 209 // independent of any possible errors, or whether it wants SSL errors to |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 event_order_[req_id] += "OnAuthRequired\n"; | 487 event_order_[req_id] += "OnAuthRequired\n"; |
| 488 EXPECT_TRUE(next_states_[req_id] & kStageAuthRequired) << | 488 EXPECT_TRUE(next_states_[req_id] & kStageAuthRequired) << |
| 489 event_order_[req_id]; | 489 event_order_[req_id]; |
| 490 next_states_[req_id] = kStageBeforeSendHeaders | | 490 next_states_[req_id] = kStageBeforeSendHeaders | |
| 491 kStageHeadersReceived | // Request canceled by delegate simulates empty | 491 kStageHeadersReceived | // Request canceled by delegate simulates empty |
| 492 // response. | 492 // response. |
| 493 kStageResponseStarted | // data: URLs do not trigger sending headers | 493 kStageResponseStarted | // data: URLs do not trigger sending headers |
| 494 kStageBeforeRedirect; // a delegate can trigger a redirection | 494 kStageBeforeRedirect; // a delegate can trigger a redirection |
| 495 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 495 return net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
| 496 } | 496 } |
| OLD | NEW |