| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // static | 51 // static |
| 52 void URLRequestMockNetErrorJob::RemoveMockedURL(const GURL& url) { | 52 void URLRequestMockNetErrorJob::RemoveMockedURL(const GURL& url) { |
| 53 URLMockInfoMap::iterator iter = url_mock_info_map_.find(url); | 53 URLMockInfoMap::iterator iter = url_mock_info_map_.find(url); |
| 54 DCHECK(iter != url_mock_info_map_.end()); | 54 DCHECK(iter != url_mock_info_map_.end()); |
| 55 url_mock_info_map_.erase(iter); | 55 url_mock_info_map_.erase(iter); |
| 56 URLRequestFilter::GetInstance()->RemoveUrlHandler(url); | 56 URLRequestFilter::GetInstance()->RemoveUrlHandler(url); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 URLRequestJob* URLRequestMockNetErrorJob::Factory(net::URLRequest* request, | 60 net::URLRequestJob* URLRequestMockNetErrorJob::Factory( |
| 61 const std::string& scheme) { | 61 net::URLRequest* request, |
| 62 const std::string& scheme) { |
| 62 GURL url = request->url(); | 63 GURL url = request->url(); |
| 63 | 64 |
| 64 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); | 65 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); |
| 65 DCHECK(iter != url_mock_info_map_.end()); | 66 DCHECK(iter != url_mock_info_map_.end()); |
| 66 | 67 |
| 67 MockInfo mock_info = iter->second; | 68 MockInfo mock_info = iter->second; |
| 68 | 69 |
| 69 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We pass a | 70 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We pass a |
| 70 // FilePath so that the URLRequestFileJob methods will do the loading from | 71 // FilePath so that the URLRequestFileJob methods will do the loading from |
| 71 // the files. | 72 // the files. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 ssl_cert_.get()); | 110 ssl_cert_.get()); |
| 110 } else { | 111 } else { |
| 111 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); | 112 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 } | 115 } |
| 115 | 116 |
| 116 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { | 117 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { |
| 117 Start(); | 118 Start(); |
| 118 } | 119 } |
| OLD | NEW |