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

Side by Side Diff: net/test/embedded_test_server/embedded_test_server.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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
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/embedded_test_server/embedded_test_server.h" 5 #include "net/test/embedded_test_server/embedded_test_server.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 256 }
257 257
258 // Drop the connection, since we do not support multiple requests per 258 // Drop the connection, since we do not support multiple requests per
259 // connection. 259 // connection.
260 connections_.erase(connection->socket_.get()); 260 connections_.erase(connection->socket_.get());
261 delete connection; 261 delete connection;
262 } 262 }
263 263
264 GURL EmbeddedTestServer::GetURL(const std::string& relative_url) const { 264 GURL EmbeddedTestServer::GetURL(const std::string& relative_url) const {
265 DCHECK(Started()) << "You must start the server first."; 265 DCHECK(Started()) << "You must start the server first.";
266 DCHECK(base::StartsWithASCII(relative_url, "/", true /* case_sensitive */)) 266 DCHECK(base::StartsWith(relative_url, "/", base::CompareCase::SENSITIVE))
Ryan Sleevi 2015/07/06 08:52:02 PEDANTRY NIT: This is another example of case sens
brettw 2015/07/06 16:52:34 Kept, I did this on purpose. One problem with the
267 << relative_url; 267 << relative_url;
268 return base_url_.Resolve(relative_url); 268 return base_url_.Resolve(relative_url);
269 } 269 }
270 270
271 GURL EmbeddedTestServer::GetURL( 271 GURL EmbeddedTestServer::GetURL(
272 const std::string& hostname, 272 const std::string& hostname,
273 const std::string& relative_url) const { 273 const std::string& relative_url) const {
274 GURL local_url = GetURL(relative_url); 274 GURL local_url = GetURL(relative_url);
275 GURL::Replacements replace_host; 275 GURL::Replacements replace_host;
276 replace_host.SetHostStr(hostname); 276 replace_host.SetHostStr(hostname);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 run_loop.QuitClosure())) { 357 run_loop.QuitClosure())) {
358 return false; 358 return false;
359 } 359 }
360 run_loop.Run(); 360 run_loop.Run();
361 361
362 return true; 362 return true;
363 } 363 }
364 364
365 } // namespace test_server 365 } // namespace test_server
366 } // namespace net 366 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698