| 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 21 matching lines...) Expand all  Loading... | 
| 32                       FailurePhase phase, | 32                       FailurePhase phase, | 
| 33                       int net_error); | 33                       int net_error); | 
| 34 | 34 | 
| 35   // Same as above, except that the job fails at FailurePhase.START. | 35   // Same as above, except that the job fails at FailurePhase.START. | 
| 36   URLRequestFailedJob(URLRequest* request, | 36   URLRequestFailedJob(URLRequest* request, | 
| 37                       NetworkDelegate* network_delegate, | 37                       NetworkDelegate* network_delegate, | 
| 38                       int net_error); | 38                       int net_error); | 
| 39 | 39 | 
| 40   // URLRequestJob implementation: | 40   // URLRequestJob implementation: | 
| 41   void Start() override; | 41   void Start() override; | 
| 42   bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read) override; | 42   int ReadRawData(IOBuffer* buf, int buf_size) override; | 
| 43   int GetResponseCode() const override; | 43   int GetResponseCode() const override; | 
| 44   void GetResponseInfo(HttpResponseInfo* info) override; | 44   void GetResponseInfo(HttpResponseInfo* info) override; | 
| 45 | 45 | 
| 46   // Adds the testing URLs to the URLRequestFilter. | 46   // Adds the testing URLs to the URLRequestFilter. | 
| 47   static void AddUrlHandler(); | 47   static void AddUrlHandler(); | 
| 48   static void AddUrlHandlerForHostname(const std::string& hostname); | 48   static void AddUrlHandlerForHostname(const std::string& hostname); | 
| 49 | 49 | 
| 50   // Given a net error code, constructs a mock URL that will return that error | 50   // Given a net error code, constructs a mock URL that will return that error | 
| 51   // asynchronously when started. |net_error| must be a valid net error code | 51   // asynchronously when started. |net_error| must be a valid net error code | 
| 52   // other than net::OK. Passing net::ERR_IO_PENDING for |net_error| causes the | 52   // other than net::OK. Passing net::ERR_IO_PENDING for |net_error| causes the | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 78   const int net_error_; | 78   const int net_error_; | 
| 79 | 79 | 
| 80   base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; | 80   base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; | 
| 81 | 81 | 
| 82   DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); | 82   DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); | 
| 83 }; | 83 }; | 
| 84 | 84 | 
| 85 }  // namespace net | 85 }  // namespace net | 
| 86 | 86 | 
| 87 #endif  // NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ | 87 #endif  // NET_TEST_URL_REQUEST_URL_REQUEST_FAILED_JOB_H_ | 
| OLD | NEW | 
|---|