| 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 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ | 5 #ifndef NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ |
| 6 #define NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ | 6 #define NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 URLRequestFailedJob(URLRequest* request, | 37 URLRequestFailedJob(URLRequest* request, |
| 38 NetworkDelegate* network_delegate, | 38 NetworkDelegate* network_delegate, |
| 39 int net_error); | 39 int net_error); |
| 40 | 40 |
| 41 // URLRequestJob implementation: | 41 // URLRequestJob implementation: |
| 42 void Start() override; | 42 void Start() override; |
| 43 int ReadRawData(IOBuffer* buf, int buf_size) override; | 43 int ReadRawData(IOBuffer* buf, int buf_size) override; |
| 44 int GetResponseCode() const override; | 44 int GetResponseCode() const override; |
| 45 void GetResponseInfo(HttpResponseInfo* info) override; | 45 void GetResponseInfo(HttpResponseInfo* info) override; |
| 46 void PopulateNetErrorDetails(NetErrorDetails* details) const override; | 46 void PopulateNetErrorDetails(NetErrorDetails* details) const override; |
| 47 int64_t GetTotalReceivedBytes() const override; |
| 47 | 48 |
| 48 // Adds the testing URLs to the URLRequestFilter. | 49 // Adds the testing URLs to the URLRequestFilter. |
| 49 static void AddUrlHandler(); | 50 static void AddUrlHandler(); |
| 50 static void AddUrlHandlerForHostname(const std::string& hostname); | 51 static void AddUrlHandlerForHostname(const std::string& hostname); |
| 51 | 52 |
| 52 // Given a net error code, constructs a mock URL that will return that error | 53 // Given a net error code, constructs a mock URL that will return that error |
| 53 // asynchronously when started. |net_error| must be a valid net error code | 54 // asynchronously when started. |net_error| must be a valid net error code |
| 54 // other than net::OK. Passing net::ERR_IO_PENDING for |net_error| causes the | 55 // other than net::OK. Passing net::ERR_IO_PENDING for |net_error| causes the |
| 55 // resulting request to hang. | 56 // resulting request to hang. |
| 56 static GURL GetMockHttpUrl(int net_error); | 57 static GURL GetMockHttpUrl(int net_error); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 72 const std::string& hostname); | 73 const std::string& hostname); |
| 73 | 74 |
| 74 protected: | 75 protected: |
| 75 ~URLRequestFailedJob() override; | 76 ~URLRequestFailedJob() override; |
| 76 void StartAsync(); | 77 void StartAsync(); |
| 77 | 78 |
| 78 private: | 79 private: |
| 79 HttpResponseInfo response_info_; | 80 HttpResponseInfo response_info_; |
| 80 const FailurePhase phase_; | 81 const FailurePhase phase_; |
| 81 const int net_error_; | 82 const int net_error_; |
| 83 int64_t total_received_bytes_; |
| 82 | 84 |
| 83 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; | 85 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; |
| 84 | 86 |
| 85 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); | 87 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); |
| 86 }; | 88 }; |
| 87 | 89 |
| 88 } // namespace net | 90 } // namespace net |
| 89 | 91 |
| 90 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ | 92 #endif // NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ |
| OLD | NEW |