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

Unified Diff: net/test/url_request/url_request_mock_http_job.cc

Issue 1143053006: Add std::string versions of URLRequestMockHTTPJob::GetMockUrl and GetMockHttpsUrl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/test/url_request/url_request_mock_http_job.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/url_request/url_request_mock_http_job.cc
diff --git a/net/test/url_request/url_request_mock_http_job.cc b/net/test/url_request/url_request_mock_http_job.cc
index b7b4cdbf619c016c90e4349f24e5db2d7881b731..297d0ffb5a3405d6a36782e94ec9eaaa2809681c 100644
--- a/net/test/url_request/url_request_mock_http_job.cc
+++ b/net/test/url_request/url_request_mock_http_job.cc
@@ -91,13 +91,8 @@ std::string DoFileIO(const base::FilePath& file_path) {
// For a given file |path| and |scheme|, return the URL served by the
// URlRequestMockHTTPJob.
-GURL GetMockUrlForScheme(const base::FilePath& path,
- const std::string& scheme) {
- std::string url = scheme + "://" + kMockHostname + "/";
- std::string path_str = path.MaybeAsASCII();
- DCHECK(!path_str.empty()); // We only expect ASCII paths in tests.
- url.append(path_str);
- return GURL(url);
+GURL GetMockUrlForScheme(const std::string& path, const std::string& scheme) {
+ return GURL(scheme + "://" + kMockHostname + "/" + path);
}
} // namespace
@@ -115,16 +110,30 @@ void URLRequestMockHTTPJob::AddUrlHandlers(
}
// static
-GURL URLRequestMockHTTPJob::GetMockUrl(const base::FilePath& path) {
+GURL URLRequestMockHTTPJob::GetMockUrl(const std::string& path) {
return GetMockUrlForScheme(path, "http");
}
// static
-GURL URLRequestMockHTTPJob::GetMockHttpsUrl(const base::FilePath& path) {
+GURL URLRequestMockHTTPJob::GetMockHttpsUrl(const std::string& path) {
return GetMockUrlForScheme(path, "https");
}
// static
+GURL URLRequestMockHTTPJob::GetMockUrl(const base::FilePath& path) {
+ std::string path_str = path.MaybeAsASCII();
+ DCHECK(!path_str.empty()); // We only expect ASCII paths in tests.
+ return GetMockUrlForScheme(path_str, "http");
+}
+
+// static
+GURL URLRequestMockHTTPJob::GetMockHttpsUrl(const base::FilePath& path) {
+ std::string path_str = path.MaybeAsASCII();
+ DCHECK(!path_str.empty()); // We only expect ASCII paths in tests.
+ return GetMockUrlForScheme(path_str, "https");
+}
+
+// static
scoped_ptr<URLRequestInterceptor> URLRequestMockHTTPJob::CreateInterceptor(
const base::FilePath& base_path,
const scoped_refptr<base::SequencedWorkerPool>& worker_pool) {
« no previous file with comments | « net/test/url_request/url_request_mock_http_job.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698