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

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

Issue 2566943002: Dispatch transfer size update notification on mojo-loading (Closed)
Patch Set: fix Created 4 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
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 "net/test/url_request/url_request_mock_http_job.h" 5 #include "net/test/url_request/url_request_mock_http_job.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 weak_ptr_factory_.GetWeakPtr())); 177 weak_ptr_factory_.GetWeakPtr()));
178 } 178 }
179 179
180 void URLRequestMockHTTPJob::SetHeadersAndStart(const std::string& raw_headers) { 180 void URLRequestMockHTTPJob::SetHeadersAndStart(const std::string& raw_headers) {
181 raw_headers_ = raw_headers; 181 raw_headers_ = raw_headers;
182 // Handle CRLF line-endings. 182 // Handle CRLF line-endings.
183 base::ReplaceSubstringsAfterOffset(&raw_headers_, 0, "\r\n", "\n"); 183 base::ReplaceSubstringsAfterOffset(&raw_headers_, 0, "\r\n", "\n");
184 // ParseRawHeaders expects \0 to end each header line. 184 // ParseRawHeaders expects \0 to end each header line.
185 base::ReplaceSubstringsAfterOffset( 185 base::ReplaceSubstringsAfterOffset(
186 &raw_headers_, 0, "\n", base::StringPiece("\0", 1)); 186 &raw_headers_, 0, "\n", base::StringPiece("\0", 1));
187 total_received_bytes_ += raw_headers_.size();
187 URLRequestFileJob::Start(); 188 URLRequestFileJob::Start();
188 } 189 }
189 190
190 // Private const version. 191 // Private const version.
191 void URLRequestMockHTTPJob::GetResponseInfoConst(HttpResponseInfo* info) const { 192 void URLRequestMockHTTPJob::GetResponseInfoConst(HttpResponseInfo* info) const {
192 info->headers = new HttpResponseHeaders(raw_headers_); 193 info->headers = new HttpResponseHeaders(raw_headers_);
193 } 194 }
194 195
195 int64_t URLRequestMockHTTPJob::GetTotalReceivedBytes() const { 196 int64_t URLRequestMockHTTPJob::GetTotalReceivedBytes() const {
196 return total_received_bytes_; 197 return total_received_bytes_;
(...skipping 14 matching lines...) Expand all
211 return URLRequestJob::GetResponseCode(); 212 return URLRequestJob::GetResponseCode();
212 } 213 }
213 214
214 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { 215 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) {
215 HttpResponseInfo info; 216 HttpResponseInfo info;
216 GetResponseInfo(&info); 217 GetResponseInfo(&info);
217 return info.headers.get() && info.headers->GetCharset(charset); 218 return info.headers.get() && info.headers->GetCharset(charset);
218 } 219 }
219 220
220 } // namespace net 221 } // namespace net
OLDNEW
« no previous file with comments | « content/test/data/gzip-content.svgz.mock-http-headers ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698