Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/browser/net/url_request_mock_net_error_job.cc

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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(URLRequest* request, 60 URLRequestJob* URLRequestMockNetErrorJob::Factory(net::URLRequest* request,
61 const std::string& scheme) { 61 const std::string& scheme) {
62 GURL url = request->url(); 62 GURL url = request->url();
63 63
64 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); 64 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url);
65 DCHECK(iter != url_mock_info_map_.end()); 65 DCHECK(iter != url_mock_info_map_.end());
66 66
67 MockInfo mock_info = iter->second; 67 MockInfo mock_info = iter->second;
68 68
69 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We pass a 69 // URLRequestMockNetErrorJob derives from URLRequestFileJob. We pass a
70 // FilePath so that the URLRequestFileJob methods will do the loading from 70 // FilePath so that the URLRequestFileJob methods will do the loading from
71 // the files. 71 // the files.
72 std::wstring file_url(L"file:///"); 72 std::wstring file_url(L"file:///");
73 file_url.append(mock_info.base); 73 file_url.append(mock_info.base);
74 file_url.append(UTF8ToWide(url.path())); 74 file_url.append(UTF8ToWide(url.path()));
75 // Convert the file:/// URL to a path on disk. 75 // Convert the file:/// URL to a path on disk.
76 FilePath file_path; 76 FilePath file_path;
77 net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path); 77 net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path);
78 return new URLRequestMockNetErrorJob(request, mock_info.errors, 78 return new URLRequestMockNetErrorJob(request, mock_info.errors,
79 mock_info.ssl_cert, 79 mock_info.ssl_cert,
80 file_path); 80 file_path);
81 } 81 }
82 82
83 URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(URLRequest* request, 83 URLRequestMockNetErrorJob::URLRequestMockNetErrorJob(net::URLRequest* request,
84 const std::vector<int>& errors, net::X509Certificate* cert, 84 const std::vector<int>& errors, net::X509Certificate* cert,
85 const FilePath& file_path) 85 const FilePath& file_path)
86 : URLRequestMockHTTPJob(request, file_path), 86 : URLRequestMockHTTPJob(request, file_path),
87 errors_(errors), 87 errors_(errors),
88 ssl_cert_(cert) { 88 ssl_cert_(cert) {
89 } 89 }
90 90
91 URLRequestMockNetErrorJob::~URLRequestMockNetErrorJob() { 91 URLRequestMockNetErrorJob::~URLRequestMockNetErrorJob() {
92 } 92 }
93 93
(...skipping 15 matching lines...) Expand all
109 ssl_cert_.get()); 109 ssl_cert_.get());
110 } else { 110 } else {
111 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); 111 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error));
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 void URLRequestMockNetErrorJob::ContinueDespiteLastError() { 116 void URLRequestMockNetErrorJob::ContinueDespiteLastError() {
117 Start(); 117 Start();
118 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698