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 "content/test/net/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/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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/url_request/url_request.h" | 12 #include "net/url_request/url_request.h" |
13 #include "net/url_request/url_request_filter.h" | 13 #include "net/url_request/url_request_filter.h" |
14 | 14 |
15 namespace content { | 15 namespace net { |
16 namespace { | 16 namespace { |
17 | 17 |
18 const char kMockHostname[] = "mock.failed.request"; | 18 const char kMockHostname[] = "mock.failed.request"; |
19 | 19 |
20 // Gets the numeric net error code from URL of the form: | 20 // Gets the numeric net error code from URL of the form: |
21 // scheme://kMockHostname/error_code. The error code must be a valid | 21 // scheme://kMockHostname/error_code. The error code must be a valid |
22 // net error code, and not net::OK or net::ERR_IO_PENDING. | 22 // net error code, and not net::OK or net::ERR_IO_PENDING. |
23 int GetErrorCode(net::URLRequest* request) { | 23 int GetErrorCode(net::URLRequest* request) { |
24 int net_error; | 24 int net_error; |
25 std::string path = request->url().path(); | 25 std::string path = request->url().path(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const std::string& scheme) { | 100 const std::string& scheme) { |
101 return new URLRequestFailedJob( | 101 return new URLRequestFailedJob( |
102 request, network_delegate, GetErrorCode(request)); | 102 request, network_delegate, GetErrorCode(request)); |
103 } | 103 } |
104 | 104 |
105 void URLRequestFailedJob::StartAsync() { | 105 void URLRequestFailedJob::StartAsync() { |
106 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, | 106 NotifyStartError(net::URLRequestStatus(net::URLRequestStatus::FAILED, |
107 net_error_)); | 107 net_error_)); |
108 } | 108 } |
109 | 109 |
110 } // namespace content | 110 } // namespace net |
OLD | NEW |