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

Unified Diff: chrome/service/cloud_print/cloud_print_url_fetcher.h

Issue 12208089: Changing CloudPrintURLFetcher instantiation to be more testable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified change to use static factory pattern Created 7 years, 10 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/service/cloud_print/cloud_print_url_fetcher.h
diff --git a/chrome/service/cloud_print/cloud_print_url_fetcher.h b/chrome/service/cloud_print/cloud_print_url_fetcher.h
index 22ea4a4f2e44bba0db486f38e145a4f61851d241..c5979d495065ade03999a9facc99f931794103a6 100644
--- a/chrome/service/cloud_print/cloud_print_url_fetcher.h
+++ b/chrome/service/cloud_print/cloud_print_url_fetcher.h
@@ -25,6 +25,17 @@ class URLRequestStatus;
namespace cloud_print {
+
gene 2013/02/11 23:34:05 one empty line is enough here
+// Factory for creating CloudPrintURLFetchers.
+class CloudPrintURLFetcher;
+class CloudPrintURLFetcherFactory {
+ public:
+ CloudPrintURLFetcherFactory();
gene 2013/02/11 23:34:05 May be we can omit constructor/destructor here?
+ virtual ~CloudPrintURLFetcherFactory();
+ virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher()=0;
gene 2013/02/11 23:34:05 add spaces around =. "() = 0;"
+};
+
+
gene 2013/02/11 23:34:05 one empty line is enough here
// A wrapper around URLFetcher for CloudPrint. URLFetcher applies retry logic
// only on HTTP response codes >= 500. In the cloud print case, we want to
// retry on all network errors. In addition, we want to treat non-JSON responses
@@ -92,6 +103,10 @@ class CloudPrintURLFetcher
protected:
virtual ~Delegate() {}
};
+
+ static CloudPrintURLFetcher* Create();
+ static void set_factory(CloudPrintURLFetcherFactory* factory);
+
CloudPrintURLFetcher();
gene 2013/02/11 23:34:05 Constructor should probably be in protected sectio
bool IsSameRequest(const net::URLFetcher* source);
@@ -134,6 +149,8 @@ class CloudPrintURLFetcher
std::string additional_headers_;
std::string post_data_mime_type_;
std::string post_data_;
+
+ static CloudPrintURLFetcherFactory* factory();
gene 2013/02/11 23:34:05 Can you move this before declaring member variable
};
typedef CloudPrintURLFetcher::Delegate CloudPrintURLFetcherDelegate;

Powered by Google App Engine
This is Rietveld 408576698