| 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 #include "chrome/browser/automation/url_request_mock_net_error_job.h" | 5 #include "chrome/browser/automation/url_request_mock_net_error_job.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 mock_info.ssl_cert); | 51 mock_info.ssl_cert); |
| 52 | 52 |
| 53 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We set the | 53 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We set the |
| 54 // file_path_ of the job so that the URLRequestFileJob methods will do the | 54 // file_path_ of the job so that the URLRequestFileJob methods will do the |
| 55 // loading from the files. | 55 // loading from the files. |
| 56 std::wstring file_url(L"file:///"); | 56 std::wstring file_url(L"file:///"); |
| 57 file_url.append(mock_info.base); | 57 file_url.append(mock_info.base); |
| 58 file_url.append(UTF8ToWide(url.path())); | 58 file_url.append(UTF8ToWide(url.path())); |
| 59 // Convert the file:/// URL to a path on disk. | 59 // Convert the file:/// URL to a path on disk. |
| 60 std::wstring file_path; | 60 std::wstring file_path; |
| 61 net::FileURLToFilePath(GURL(file_url), &file_path); | 61 net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); |
| 62 job->file_path_ = file_path; | 62 job->file_path_ = file_path; |
| 63 return job; | 63 return job; |
| 64 } | 64 } |
| 65 | 65 |
| 66 URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request, | 66 URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request, |
| 67 const std::vector<int>& errors, net::X509Certificate* cert) | 67 const std::vector<int>& errors, net::X509Certificate* cert) |
| 68 : URLRequestMockHTTPJob(request), | 68 : URLRequestMockHTTPJob(request), |
| 69 errors_(errors), | 69 errors_(errors), |
| 70 ssl_cert_(cert) { | 70 ssl_cert_(cert) { |
| 71 } | 71 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 92 } else { | 92 } else { |
| 93 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); | 93 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { | 98 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { |
| 99 Start(); | 99 Start(); |
| 100 } | 100 } |
| 101 | 101 |
| OLD | NEW |