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

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

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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 | « net/ssl/ssl_connection_status_flags.h ('k') | net/tools/crash_cache/crash_cache.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 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 std::string path_str = path.MaybeAsASCII(); 126 std::string path_str = path.MaybeAsASCII();
127 DCHECK(!path_str.empty()); // We only expect ASCII paths in tests. 127 DCHECK(!path_str.empty()); // We only expect ASCII paths in tests.
128 url.append(path_str); 128 url.append(path_str);
129 return GURL(url); 129 return GURL(url);
130 } 130 }
131 131
132 // static 132 // static
133 GURL URLRequestMockHTTPJob::GetMockUrlWithFailure(const base::FilePath& path, 133 GURL URLRequestMockHTTPJob::GetMockUrlWithFailure(const base::FilePath& path,
134 FailurePhase phase, 134 FailurePhase phase,
135 int net_error) { 135 int net_error) {
136 COMPILE_ASSERT(arraysize(kFailurePhase) == MAX_FAILURE_PHASE, 136 static_assert(arraysize(kFailurePhase) == MAX_FAILURE_PHASE,
137 kFailurePhase_must_match_FailurePhase_enum); 137 "kFailurePhase must match FailurePhase enum");
138 DCHECK_GE(phase, START); 138 DCHECK_GE(phase, START);
139 DCHECK_LE(phase, READ_SYNC); 139 DCHECK_LE(phase, READ_SYNC);
140 std::string url(GetMockUrl(path).spec()); 140 std::string url(GetMockUrl(path).spec());
141 url.append("?"); 141 url.append("?");
142 url.append(kFailurePhase[phase]); 142 url.append(kFailurePhase[phase]);
143 url.append("="); 143 url.append("=");
144 url.append(base::IntToString(net_error)); 144 url.append(base::IntToString(net_error));
145 return GURL(url); 145 return GURL(url);
146 } 146 }
147 147
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return net::URLRequestJob::GetResponseCode(); 277 return net::URLRequestJob::GetResponseCode();
278 } 278 }
279 279
280 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) { 280 bool URLRequestMockHTTPJob::GetCharset(std::string* charset) {
281 net::HttpResponseInfo info; 281 net::HttpResponseInfo info;
282 GetResponseInfo(&info); 282 GetResponseInfo(&info);
283 return info.headers.get() && info.headers->GetCharset(charset); 283 return info.headers.get() && info.headers->GetCharset(charset);
284 } 284 }
285 285
286 } // namespace net 286 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/ssl_connection_status_flags.h ('k') | net/tools/crash_cache/crash_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698