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

Unified Diff: chrome/common/net/test_url_fetcher_factory.cc

Issue 6969067: Allow URLFetcher to save results in a file. Have CRX updates use this capability. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 9 years, 7 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/common/net/test_url_fetcher_factory.cc
diff --git a/chrome/common/net/test_url_fetcher_factory.cc b/chrome/common/net/test_url_fetcher_factory.cc
index 04fea1b80192dad317faf7f3d80c9445a37bc836..b6768ed63189f77642ff5b7083a43d467750255c 100644
--- a/chrome/common/net/test_url_fetcher_factory.cc
+++ b/chrome/common/net/test_url_fetcher_factory.cc
@@ -30,6 +30,38 @@ void TestURLFetcher::AppendChunkToUpload(const std::string& data,
chunks_.push_back(data);
}
+void TestURLFetcher::set_status(const net::URLRequestStatus& status) {
+ fake_status_ = status;
+}
+
+void TestURLFetcher::SetResponseString(const std::string& response) {
+ response_destination_ = STRING;
+ fake_response_string_ = response;
+}
+
+void TestURLFetcher::SetResponseFilePath(const FilePath& path) {
+ response_destination_ = TEMP_FILE;
+ fake_response_file_path_ = path;
+}
+
+bool TestURLFetcher::GetResponseAsString(
+ std::string* out_response_string) const {
+ if (response_destination_ != STRING)
+ return false;
+
+ *out_response_string = fake_response_string_;
+ return true;
+}
+
+bool TestURLFetcher::GetResponseAsFilePath(
+ bool take_ownership, FilePath* out_response_path) const {
+ if (response_destination_ != TEMP_FILE)
+ return false;
+
+ *out_response_path = fake_response_file_path_;
+ return true;
+}
+
TestURLFetcherFactory::TestURLFetcherFactory() {}
TestURLFetcherFactory::~TestURLFetcherFactory() {}

Powered by Google App Engine
This is Rietveld 408576698