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 CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ | 5 #ifndef CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ |
6 #define CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ | 6 #define CONTENT_TEST_NET_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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "net/url_request/url_request_job.h" | 13 #include "net/url_request/url_request_job.h" |
14 | 14 |
| 15 namespace content { |
| 16 |
15 // This class simulates a URLRequestJob failing with a given error code while | 17 // This class simulates a URLRequestJob failing with a given error code while |
16 // trying to connect. | 18 // trying to connect. |
17 class URLRequestFailedJob : public net::URLRequestJob { | 19 class URLRequestFailedJob : public net::URLRequestJob { |
18 public: | 20 public: |
19 URLRequestFailedJob(net::URLRequest* request, | 21 URLRequestFailedJob(net::URLRequest* request, |
20 net::NetworkDelegate* network_delegate, | 22 net::NetworkDelegate* network_delegate, |
21 int net_error); | 23 int net_error); |
22 | 24 |
23 virtual void Start() OVERRIDE; | 25 virtual void Start() OVERRIDE; |
24 | 26 |
(...skipping 16 matching lines...) Expand all Loading... |
41 // Simulate a failure. | 43 // Simulate a failure. |
42 void StartAsync(); | 44 void StartAsync(); |
43 | 45 |
44 const int net_error_; | 46 const int net_error_; |
45 | 47 |
46 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; | 48 base::WeakPtrFactory<URLRequestFailedJob> weak_factory_; |
47 | 49 |
48 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); | 50 DISALLOW_COPY_AND_ASSIGN(URLRequestFailedJob); |
49 }; | 51 }; |
50 | 52 |
| 53 } // namespace content |
| 54 |
51 #endif // CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ | 55 #endif // CONTENT_TEST_NET_URL_REQUEST_FAILED_JOB_H_ |
OLD | NEW |