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

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

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 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
« no previous file with comments | « content/public/test/test_launcher.cc ('k') | extensions/browser/user_script_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This class simulates what wininet does when a dns lookup fails. 4 // This class simulates what wininet does when a dns lookup fails.
5 5
6 #include <algorithm> 6 #include <algorithm>
7 #include <cstring> 7 #include <cstring>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 std::string raw_headers; 69 std::string raw_headers;
70 if (base::LowerCaseEqualsASCII(k400AbortOnEndUrl, 70 if (base::LowerCaseEqualsASCII(k400AbortOnEndUrl,
71 request_->url().spec().c_str())) { 71 request_->url().spec().c_str())) {
72 raw_headers.append( 72 raw_headers.append(
73 "HTTP/1.1 400 This is not OK\n" 73 "HTTP/1.1 400 This is not OK\n"
74 "Content-type: text/plain\n"); 74 "Content-type: text/plain\n");
75 } else { 75 } else {
76 NOTREACHED(); 76 NOTREACHED();
77 } 77 }
78 // ParseRawHeaders expects \0 to end each header line. 78 // ParseRawHeaders expects \0 to end each header line.
79 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); 79 base::ReplaceSubstringsAfterOffset(
80 &raw_headers, 0, "\n", base::StringPiece("\0", 1));
80 info->headers = new net::HttpResponseHeaders(raw_headers); 81 info->headers = new net::HttpResponseHeaders(raw_headers);
81 } 82 }
82 83
83 URLRequestAbortOnEndJob::URLRequestAbortOnEndJob( 84 URLRequestAbortOnEndJob::URLRequestAbortOnEndJob(
84 net::URLRequest* request, net::NetworkDelegate* network_delegate) 85 net::URLRequest* request, net::NetworkDelegate* network_delegate)
85 : URLRequestJob(request, network_delegate), 86 : URLRequestJob(request, network_delegate),
86 sent_data_(false), 87 sent_data_(false),
87 weak_factory_(this) { 88 weak_factory_(this) {
88 } 89 }
89 90
(...skipping 30 matching lines...) Expand all
120 return true; 121 return true;
121 } 122 }
122 123
123 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, 124 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED,
124 net::ERR_CONNECTION_ABORTED)); 125 net::ERR_CONNECTION_ABORTED));
125 *bytes_read = -1; 126 *bytes_read = -1;
126 return false; 127 return false;
127 } 128 }
128 129
129 } // namespace content 130 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_launcher.cc ('k') | extensions/browser/user_script_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698