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

Unified Diff: chrome/browser/net/url_request_mock_http_job.cc

Issue 271066: Use FilePath in URLRequestMocks. (Closed)
Patch Set: Created 11 years, 2 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 | « chrome/browser/net/url_request_mock_http_job.h ('k') | chrome/browser/net/url_request_mock_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/url_request_mock_http_job.cc
diff --git a/chrome/browser/net/url_request_mock_http_job.cc b/chrome/browser/net/url_request_mock_http_job.cc
index 7e0cd712c9889fcbf597968e79082bdc650397e8..5887a558daffa47db38907333f80630b25190224 100644
--- a/chrome/browser/net/url_request_mock_http_job.cc
+++ b/chrome/browser/net/url_request_mock_http_job.cc
@@ -12,9 +12,10 @@
#include "net/url_request/url_request_filter.h"
static const char kMockHostname[] = "mock.http";
-static const wchar_t kMockHeaderFileSuffix[] = L".mock-http-headers";
+static const FilePath::CharType kMockHeaderFileSuffix[] =
+ FILE_PATH_LITERAL(".mock-http-headers");
tony 2009/10/13 00:31:39 Nit: Maybe make this a char* and use AppendASCII?
Evan Martin 2009/10/13 00:45:42 Unfortunately, AppendASCII is for appending path c
-std::wstring URLRequestMockHTTPJob::base_path_ = L"";
+FilePath URLRequestMockHTTPJob::base_path_;
/* static */
URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request,
@@ -24,7 +25,7 @@ URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request,
}
/* static */
-void URLRequestMockHTTPJob::AddUrlHandler(const std::wstring& base_path) {
+void URLRequestMockHTTPJob::AddUrlHandler(const FilePath& base_path) {
base_path_ = base_path;
// Add kMockHostname to URLRequestFilter.
@@ -34,20 +35,20 @@ void URLRequestMockHTTPJob::AddUrlHandler(const std::wstring& base_path) {
}
/* static */
-GURL URLRequestMockHTTPJob::GetMockUrl(const std::wstring& path) {
+GURL URLRequestMockHTTPJob::GetMockUrl(const FilePath& path) {
std::string url = "http://";
url.append(kMockHostname);
url.append("/");
- url.append(WideToUTF8(path));
+ url.append(WideToUTF8(path.ToWStringHack()));
return GURL(url);
}
/* static */
-FilePath URLRequestMockHTTPJob::GetOnDiskPath(const std::wstring& base_path,
+FilePath URLRequestMockHTTPJob::GetOnDiskPath(const FilePath& base_path,
URLRequest* request,
const std::string& scheme) {
std::string file_url("file:///");
- file_url += WideToUTF8(base_path);
+ file_url += WideToUTF8(base_path.ToWStringHack());
file_url += request->url().path();
// Convert the file:/// URL to a path on disk.
@@ -76,7 +77,7 @@ bool URLRequestMockHTTPJob::IsRedirectResponse(GURL* location,
// Private const version.
void URLRequestMockHTTPJob::GetResponseInfoConst(
net::HttpResponseInfo* info) const {
- std::wstring header_file = file_path_.ToWStringHack() + kMockHeaderFileSuffix;
+ FilePath header_file = FilePath(file_path_.value() + kMockHeaderFileSuffix);
std::string raw_headers;
if (!file_util::ReadFileToString(header_file, &raw_headers))
return;
« no previous file with comments | « chrome/browser/net/url_request_mock_http_job.h ('k') | chrome/browser/net/url_request_mock_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698