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

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

Issue 165353: Merge 21668 - Make AutomationProxyTest.NavigateToURLWithTimeout* tests notfla... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/url_request_mock_http_job.cc
===================================================================
--- chrome/browser/automation/url_request_mock_http_job.cc (revision 23129)
+++ chrome/browser/automation/url_request_mock_http_job.cc (working copy)
@@ -19,22 +19,8 @@
/* static */
URLRequestJob* URLRequestMockHTTPJob::Factory(URLRequest* request,
const std::string& scheme) {
- std::wstring file_url(L"file:///");
- file_url += base_path_;
- const std::string& url = request->url().spec();
- // Fix up the url to be the file url we're loading from disk.
- std::string host_prefix("http://");
- host_prefix.append(kMockHostname);
- size_t host_prefix_len = host_prefix.length();
- if (url.compare(0, host_prefix_len, host_prefix.data(),
- host_prefix_len) == 0) {
- file_url += UTF8ToWide(url.substr(host_prefix_len));
- }
-
- // Convert the file:/// URL to a path on disk.
- FilePath file_path;
- net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path);
- return new URLRequestMockHTTPJob(request, file_path);
+ return new URLRequestMockHTTPJob(request,
+ GetOnDiskPath(base_path_, request, scheme));
}
/* static */
@@ -56,6 +42,28 @@
return GURL(url);
}
+/* static */
+FilePath URLRequestMockHTTPJob::GetOnDiskPath(const std::wstring& base_path,
+ URLRequest* request,
+ const std::string& scheme) {
+ std::wstring file_url(L"file:///");
+ file_url += base_path;
+ const std::string& url = request->url().spec();
+ // Fix up the url to be the file url we're loading from disk.
+ std::string host_prefix("http://");
+ host_prefix.append(kMockHostname);
+ size_t host_prefix_len = host_prefix.length();
+ if (url.compare(0, host_prefix_len, host_prefix.data(),
+ host_prefix_len) == 0) {
+ file_url += UTF8ToWide(url.substr(host_prefix_len));
+ }
+
+ // Convert the file:/// URL to a path on disk.
+ FilePath file_path;
+ net::FileURLToFilePath(GURL(WideToUTF8(file_url)), &file_path);
+ return file_path;
+}
+
URLRequestMockHTTPJob::URLRequestMockHTTPJob(URLRequest* request,
const FilePath& file_path)
: URLRequestFileJob(request, file_path) { }
Property changes on: chrome\browser\automation\url_request_mock_http_job.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/chrome/browser/automation/url_request_mock_http_job.cc:r69-2775
Merged /trunk/src/chrome/browser/automation/url_request_mock_http_job.cc:r21668
« no previous file with comments | « chrome/browser/automation/url_request_mock_http_job.h ('k') | chrome/browser/automation/url_request_slow_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698