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

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

Issue 6037013: net: Add namespace net to URLRequestFilter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 12 months 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) 2010 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"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
(...skipping 25 matching lines...) Expand all
37 void URLRequestMockNetErrorJob::AddMockedURL(const GURL& url, 37 void URLRequestMockNetErrorJob::AddMockedURL(const GURL& url,
38 const std::wstring& base, 38 const std::wstring& base,
39 const std::vector<int>& errors, 39 const std::vector<int>& errors,
40 net::X509Certificate* ssl_cert) { 40 net::X509Certificate* ssl_cert) {
41 #ifndef NDEBUG 41 #ifndef NDEBUG
42 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url); 42 URLMockInfoMap::const_iterator iter = url_mock_info_map_.find(url);
43 DCHECK(iter == url_mock_info_map_.end()); 43 DCHECK(iter == url_mock_info_map_.end());
44 #endif 44 #endif
45 45
46 url_mock_info_map_[url] = MockInfo(base, errors, ssl_cert); 46 url_mock_info_map_[url] = MockInfo(base, errors, ssl_cert);
47 URLRequestFilter::GetInstance() 47 net::URLRequestFilter::GetInstance()
48 ->AddUrlHandler(url, &URLRequestMockNetErrorJob::Factory); 48 ->AddUrlHandler(url, &URLRequestMockNetErrorJob::Factory);
49 } 49 }
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 net::URLRequestFilter::GetInstance()->RemoveUrlHandler(url);
57 } 57 }
58 58
59 // static 59 // static
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());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698