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

Unified Diff: content/common/net/url_fetcher.h

Issue 8395038: Make test URLFetcher implementations not derive from the URLFetcher implementation, since we want... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: move factory to its own file and remove Create function from URLFetcher impl Created 9 years, 2 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: content/common/net/url_fetcher.h
===================================================================
--- content/common/net/url_fetcher.h (revision 107268)
+++ content/common/net/url_fetcher.h (working copy)
@@ -21,21 +21,12 @@
#include "base/time.h"
#include "content/public/common/url_fetcher.h"
+namespace content {
+class URLFetcherFactory;
+}
+
class CONTENT_EXPORT URLFetcher : public content::URLFetcher{
public:
- // URLFetcher::Create uses the currently registered Factory to create the
- // URLFetcher. Factory is intended for testing.
- class Factory {
- public:
- virtual URLFetcher* CreateURLFetcher(int id,
- const GURL& url,
- RequestType request_type,
- content::URLFetcherDelegate* d) = 0;
-
- protected:
- virtual ~Factory() {}
- };
-
// |url| is the URL to send the request to.
// |request_type| is the type of request to make.
// |d| the object that will receive the callback on fetch completion.
@@ -44,13 +35,6 @@
content::URLFetcherDelegate* d);
virtual ~URLFetcher();
- // Creates a URLFetcher, ownership returns to the caller. If there is no
- // Factory (the default) this creates and returns a new URLFetcher. See the
- // constructor for a description of the args. |id| may be used during testing
- // to identify who is creating the URLFetcher.
- static URLFetcher* Create(int id, const GURL& url, RequestType request_type,
- content::URLFetcherDelegate* d);
-
// content::URLFetcher implementation:
virtual void SetUploadData(const std::string& upload_content_type,
const std::string& upload_content) OVERRIDE;
@@ -71,8 +55,6 @@
virtual void SetMaxRetries(int max_retries) OVERRIDE;
virtual int GetMaxRetries() const OVERRIDE;
virtual base::TimeDelta GetBackoffDelay() const OVERRIDE;
- virtual void SetBackoffDelayForTesting(
- base::TimeDelta backoff_delay) OVERRIDE;
virtual void SaveResponseToTemporaryFile(
scoped_refptr<base::MessageLoopProxy> file_message_loop_proxy) OVERRIDE;
virtual net::HttpResponseHeaders* GetResponseHeaders() const OVERRIDE;
@@ -116,9 +98,6 @@
// Used by tests.
void set_response_headers(scoped_refptr<net::HttpResponseHeaders> headers);
- virtual void SetResponseDestinationForTesting(ResponseDestinationType);
- virtual ResponseDestinationType GetResponseDestinationForTesting() const;
-
private:
friend class ScopedURLFetcherFactory;
friend class TestURLFetcher;
@@ -128,22 +107,18 @@
// actively running.
static int GetNumFetcherCores();
- static Factory* factory() { return factory_; }
+ static content::URLFetcherFactory* factory();
// Sets the factory used by the static method Create to create a URLFetcher.
// URLFetcher does not take ownership of |factory|. A value of NULL results
// in a URLFetcher being created directly.
//
// NOTE: for safety, this should only be used through ScopedURLFetcherFactory!
- static void set_factory(Factory* factory) {
- factory_ = factory;
- }
+ static void set_factory(content::URLFetcherFactory* factory);
class Core;
scoped_refptr<Core> core_;
- static Factory* factory_;
-
DISALLOW_COPY_AND_ASSIGN(URLFetcher);
};

Powered by Google App Engine
This is Rietveld 408576698