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/net/url_request_mock_net_error_job.h" | 5 #include "chrome/browser/net/url_request_mock_net_error_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 net::URLRequestJob* URLRequestMockNetErrorJob::Factory( | 60 net::URLRequestJob* URLRequestMockNetErrorJob::Factory( |
61 net::URLRequest* request, | 61 net::URLRequest* request, |
62 const std::string& scheme) { | 62 const std::string& scheme) { |
63 GURL url = request->url(); | 63 GURL url = request->url(); |
64 | 64 |
65 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); | 65 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); |
66 DCHECK(iter != url_mock_info_map_.end()); | 66 DCHECK(iter != url_mock_info_map_.end()); |
67 | 67 |
68 MockInfo mock_info = iter->second; | 68 MockInfo mock_info = iter->second; |
69 | 69 |
70 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We pass a | 70 // URLRequestMockNetErrorJob derives from net::URLRequestFileJob. We pass a |
71 // FilePath so that the URLRequestFileJob methods will do the loading from | 71 // FilePath so that the net::URLRequestFileJob methods will do the loading |
72 // the files. | 72 // from the files. |
73 std::wstring file_url(L"file:///"); | 73 std::wstring file_url(L"file:///"); |
74 file_url.append(mock_info.base); | 74 file_url.append(mock_info.base); |
75 file_url.append(UTF8ToWide(url.path())); | 75 file_url.append(UTF8ToWide(url.path())); |
76 // Convert the file:/// URL to a path on disk. | 76 // Convert the file:/// URL to a path on disk. |
77 FilePath file_path; | 77 FilePath file_path; |
78 net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); | 78 net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); |
79 return new URLRequestMockNetErrorJob(request, mock_info.errors, | 79 return new URLRequestMockNetErrorJob(request, mock_info.errors, |
80 mock_info.ssl_cert, | 80 mock_info.ssl_cert, |
81 file_path); | 81 file_path); |
82 } | 82 } |
(...skipping 27 matching lines...) Expand all Loading... |
110 ssl_cert_.get()); | 110 ssl_cert_.get()); |
111 } else { | 111 } else { |
112 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); | 112 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { | 117 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { |
118 Start(); | 118 Start(); |
119 } | 119 } |
OLD | NEW |