| 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/test/url_request/url_request_failed_job.h" | 5 #include "net/test/url_request/url_request_failed_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // If we have headers, get the response code from them. | 117 // If we have headers, get the response code from them. |
| 118 if (response_info_.headers) | 118 if (response_info_.headers) |
| 119 return response_info_.headers->response_code(); | 119 return response_info_.headers->response_code(); |
| 120 return URLRequestJob::GetResponseCode(); | 120 return URLRequestJob::GetResponseCode(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void URLRequestFailedJob::GetResponseInfo(HttpResponseInfo* info) { | 123 void URLRequestFailedJob::GetResponseInfo(HttpResponseInfo* info) { |
| 124 *info = response_info_; | 124 *info = response_info_; |
| 125 } | 125 } |
| 126 | 126 |
| 127 void URLRequestFailedJob::PopulateNetErrorDetails( |
| 128 NetErrorDetails* details) const { |
| 129 if (net_error_ == ERR_QUIC_PROTOCOL_ERROR) { |
| 130 details->quic_connection_error = QUIC_INTERNAL_ERROR; |
| 131 } |
| 132 } |
| 133 |
| 127 // static | 134 // static |
| 128 void URLRequestFailedJob::AddUrlHandler() { | 135 void URLRequestFailedJob::AddUrlHandler() { |
| 129 return AddUrlHandlerForHostname(kMockHostname); | 136 return AddUrlHandlerForHostname(kMockHostname); |
| 130 } | 137 } |
| 131 | 138 |
| 132 // static | 139 // static |
| 133 void URLRequestFailedJob::AddUrlHandlerForHostname( | 140 void URLRequestFailedJob::AddUrlHandlerForHostname( |
| 134 const std::string& hostname) { | 141 const std::string& hostname) { |
| 135 URLRequestFilter* filter = URLRequestFilter::GetInstance(); | 142 URLRequestFilter* filter = URLRequestFilter::GetInstance(); |
| 136 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. | 143 // Add |hostname| to URLRequestFilter for HTTP and HTTPS. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_)); | 188 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, net_error_)); |
| 182 return; | 189 return; |
| 183 } | 190 } |
| 184 return; | 191 return; |
| 185 } | 192 } |
| 186 response_info_.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK"); | 193 response_info_.headers = new net::HttpResponseHeaders("HTTP/1.1 200 OK"); |
| 187 NotifyHeadersComplete(); | 194 NotifyHeadersComplete(); |
| 188 } | 195 } |
| 189 | 196 |
| 190 } // namespace net | 197 } // namespace net |
| OLD | NEW |