OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // A URLRequestJob class that simulates network errors (including https | 5 // A URLRequestJob class that simulates network errors (including https |
6 // related). | 6 // related). |
7 // It is based on URLRequestMockHttpJob. | 7 // It is based on URLRequestMockHttpJob. |
8 | 8 |
9 #ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_NET_ERROR_H__ | 9 #ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_NET_ERROR_H__ |
10 #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_NET_ERROR_H__ | 10 #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_NET_ERROR_H__ |
11 | 11 |
12 #include "chrome/browser/automation/url_request_mock_http_job.h" | 12 #include "chrome/browser/automation/url_request_mock_http_job.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 | 14 |
15 class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { | 15 class URLRequestMockNetErrorJob : public URLRequestMockHTTPJob { |
16 public: | 16 public: |
17 URLRequestMockNetErrorJob(URLRequest* request, | 17 URLRequestMockNetErrorJob(URLRequest* request, |
18 const std::vector<int>& errors, | 18 const std::vector<int>& errors, |
19 net::X509Certificate* ssl_cert); | 19 net::X509Certificate* ssl_cert, |
| 20 const FilePath& file_path); |
20 virtual ~URLRequestMockNetErrorJob(); | 21 virtual ~URLRequestMockNetErrorJob(); |
21 | 22 |
22 virtual void Start(); | 23 virtual void Start(); |
23 virtual void ContinueDespiteLastError(); | 24 virtual void ContinueDespiteLastError(); |
24 | 25 |
25 // Add the specified URL to the list of URLs that should be mocked. When this | 26 // Add the specified URL to the list of URLs that should be mocked. When this |
26 // URL is hit, the specified |errors| will be played. If any of these errors | 27 // URL is hit, the specified |errors| will be played. If any of these errors |
27 // is a cert error, |ssl_cert| will be used as the ssl cert when notifying of | 28 // is a cert error, |ssl_cert| will be used as the ssl cert when notifying of |
28 // the error. |ssl_cert| can be NULL if |errors| does not contain any cert | 29 // the error. |ssl_cert| can be NULL if |errors| does not contain any cert |
29 // errors. |base| is the location on disk where the file mocking the URL | 30 // errors. |base| is the location on disk where the file mocking the URL |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 scoped_refptr<net::X509Certificate> ssl_cert_; | 63 scoped_refptr<net::X509Certificate> ssl_cert_; |
63 | 64 |
64 typedef std::map<GURL, MockInfo> URLMockInfoMap; | 65 typedef std::map<GURL, MockInfo> URLMockInfoMap; |
65 static URLMockInfoMap url_mock_info_map_; | 66 static URLMockInfoMap url_mock_info_map_; |
66 | 67 |
67 DISALLOW_EVIL_CONSTRUCTORS(URLRequestMockNetErrorJob); | 68 DISALLOW_EVIL_CONSTRUCTORS(URLRequestMockNetErrorJob); |
68 }; | 69 }; |
69 | 70 |
70 #endif // #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_NET_ERROR_H__ | 71 #endif // #define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_NET_ERROR_H__ |
71 | 72 |
OLD | NEW |