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

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: Incorporated Gene's suggestions 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..4476ec6f61994081cbc7a1a1505daf73352d831e 100644
--- a/chrome/service/cloud_print/cloud_print_url_fetcher.h
+++ b/chrome/service/cloud_print/cloud_print_url_fetcher.h
@@ -25,6 +25,13 @@ class URLRequestStatus;
namespace cloud_print {
+// Factory for creating CloudPrintURLFetchers.
+class CloudPrintURLFetcher;
+class CloudPrintURLFetcherFactory {
+ public:
+ virtual CloudPrintURLFetcher* CreateCloudPrintURLFetcher() = 0;
+};
+
// 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,7 +99,9 @@ class CloudPrintURLFetcher
protected:
virtual ~Delegate() {}
};
- CloudPrintURLFetcher();
+
+ static CloudPrintURLFetcher* Create();
+ static void set_factory(CloudPrintURLFetcherFactory* factory);
bool IsSameRequest(const net::URLFetcher* source);
@@ -111,6 +120,7 @@ class CloudPrintURLFetcher
virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
protected:
+ CloudPrintURLFetcher();
friend class base::RefCountedThreadSafe<CloudPrintURLFetcher>;
virtual ~CloudPrintURLFetcher();
@@ -126,6 +136,7 @@ class CloudPrintURLFetcher
const std::string& post_data,
const std::string& additional_headers);
void SetupRequestHeaders();
+ static CloudPrintURLFetcherFactory* factory();
scoped_ptr<net::URLFetcher> request_;
Delegate* delegate_;
« no previous file with comments | « chrome/service/cloud_print/cloud_print_connector.cc ('k') | chrome/service/cloud_print/cloud_print_url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698