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

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

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added URLRequestMockHTTPJob.test_dir_ and URLRequestMockHTTPJob.temp_dir_ Created 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/url_request_mock_util.cc
diff --git a/chrome/browser/net/url_request_mock_util.cc b/chrome/browser/net/url_request_mock_util.cc
index c0b1fbbd425234cd3a432b35fff93eb28c8f2bad..9df6304c9138681873d33418ec9efeae003e7fa6 100644
--- a/chrome/browser/net/url_request_mock_util.cc
+++ b/chrome/browser/net/url_request_mock_util.cc
@@ -6,6 +6,7 @@
#include <string>
+#include "base/file_util.h"
#include "base/path_service.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/net/url_request_mock_link_doctor_job.h"
@@ -36,10 +37,16 @@ void SetUrlRequestMocksEnabled(bool enabled) {
URLRequestMockLinkDoctorJob::AddUrlHandler();
URLRequestSlowDownloadJob::AddUrlHandler();
- FilePath root_http;
- PathService::Get(chrome::DIR_TEST_DATA, &root_http);
- URLRequestMockHTTPJob::AddUrlHandler(root_http);
- URLRequestSlowHTTPJob::AddUrlHandler(root_http);
+ FilePath test_dir;
+ if (!PathService::Get(chrome::DIR_TEST_DATA, &test_dir))
+ NOTREACHED();
+ URLRequestMockHTTPJob::AddUrlHandler(test_dir);
+ URLRequestSlowHTTPJob::AddUrlHandler(test_dir);
+
+ FilePath temp_dir;
+ if (!file_util::GetTempDir(&temp_dir))
+ NOTREACHED();
+ URLRequestMockHTTPJob::AddUrlOfTempDirHandler(temp_dir);
} else {
// Revert to the default handlers.
net::URLRequestFilter::GetInstance()->ClearHandlers();

Powered by Google App Engine
This is Rietveld 408576698