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

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

Issue 448143008: Move StringToUpperASCII and LowerCaseEqualsASCII to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 // 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/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 void URLRequestAbortOnEndJob::AddUrlHandler() { 46 void URLRequestAbortOnEndJob::AddUrlHandler() {
47 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 47 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
48 base::Bind(AddUrlHandlerOnIOThread)); 48 base::Bind(AddUrlHandlerOnIOThread));
49 } 49 }
50 50
51 // Private const version. 51 // Private const version.
52 void URLRequestAbortOnEndJob::GetResponseInfoConst( 52 void URLRequestAbortOnEndJob::GetResponseInfoConst(
53 net::HttpResponseInfo* info) const { 53 net::HttpResponseInfo* info) const {
54 // Send back mock headers. 54 // Send back mock headers.
55 std::string raw_headers; 55 std::string raw_headers;
56 if (LowerCaseEqualsASCII(k400AbortOnEndUrl, 56 if (base::LowerCaseEqualsASCII(k400AbortOnEndUrl,
57 request_->url().spec().c_str())) { 57 request_->url().spec().c_str())) {
58 raw_headers.append( 58 raw_headers.append(
59 "HTTP/1.1 400 This is not OK\n" 59 "HTTP/1.1 400 This is not OK\n"
60 "Content-type: text/plain\n"); 60 "Content-type: text/plain\n");
61 } else { 61 } else {
62 NOTREACHED(); 62 NOTREACHED();
63 } 63 }
64 // ParseRawHeaders expects \0 to end each header line. 64 // ParseRawHeaders expects \0 to end each header line.
65 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1)); 65 ReplaceSubstringsAfterOffset(&raw_headers, 0, "\n", std::string("\0", 1));
66 info->headers = new net::HttpResponseHeaders(raw_headers); 66 info->headers = new net::HttpResponseHeaders(raw_headers);
67 } 67 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return true; 107 return true;
108 } 108 }
109 109
110 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED, 110 SetStatus(net::URLRequestStatus(net::URLRequestStatus::FAILED,
111 net::ERR_CONNECTION_ABORTED)); 111 net::ERR_CONNECTION_ABORTED));
112 *bytes_read = -1; 112 *bytes_read = -1;
113 return false; 113 return false;
114 } 114 }
115 115
116 } // namespace content 116 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/savable_resources.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