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

Side by Side Diff: content/test/net/url_request_mock_http_job.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/test/net/url_request_mock_http_job.h" 5 #include "content/test/net/url_request_mock_http_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 "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return; 143 return;
144 144
145 // ParseRawHeaders expects \0 to end each header line. 145 // ParseRawHeaders expects \0 to end each header line.
146 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); 146 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1));
147 info->headers = new net::HttpResponseHeaders(raw_headers); 147 info->headers = new net::HttpResponseHeaders(raw_headers);
148 } 148 }
149 149
150 bool URLRequestMockHTTPJob::GetMimeType(std::string* mime_type) const { 150 bool URLRequestMockHTTPJob::GetMimeType(std::string* mime_type) const {
151 net::HttpResponseInfo info; 151 net::HttpResponseInfo info;
152 GetResponseInfoConst(&info); 152 GetResponseInfoConst(&info);
153 return info.headers && info.headers->GetMimeType(mime_type); 153 return info.headers.get() && info.headers->GetMimeType(mime_type);
154 } 154 }
155 155
156 int URLRequestMockHTTPJob::GetResponseCode() const { 156 int URLRequestMockHTTPJob::GetResponseCode() const {
157 net::HttpResponseInfo info; 157 net::HttpResponseInfo info;
158 GetResponseInfoConst(&info); 158 GetResponseInfoConst(&info);
159 // If we have headers, get the response code from them. 159 // If we have headers, get the response code from them.
160 if (info.headers) 160 if (info.headers.get())
161 return info.headers->response_code(); 161 return info.headers->response_code();
162 return net::URLRequestJob::GetResponseCode(); 162 return net::URLRequestJob::GetResponseCode();
163 } 163 }
164 164
165 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { 165 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) {
166 net::HttpResponseInfo info; 166 net::HttpResponseInfo info;
167 GetResponseInfo(&info); 167 GetResponseInfo(&info);
168 return info.headers && info.headers->GetCharset(charset); 168 return info.headers.get() && info.headers->GetCharset(charset);
169 } 169 }
170 170
171 } // namespace content 171 } // namespace content
OLDNEW
« no previous file with comments | « content/test/net/url_request_abort_on_end_job.cc ('k') | content/test/net/url_request_slow_download_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698