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

Unified Diff: content/browser/download/download_request_handle.h

Issue 8399001: Use a DownloadRequestHandle pointer in construction to allow mocking for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to TOT. 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
« no previous file with comments | « content/browser/download/download_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_request_handle.h
diff --git a/content/browser/download/download_request_handle.h b/content/browser/download/download_request_handle.h
index a971714fd03d3276d55da74cb470b7c557edbec3..43762e6e6a96959704568cdf1af71ae6505d6e1b 100644
--- a/content/browser/download/download_request_handle.h
+++ b/content/browser/download/download_request_handle.h
@@ -8,6 +8,7 @@
#include <string>
+#include "base/compiler_specific.h"
#include "content/common/content_export.h"
class DownloadManager;
@@ -18,7 +19,30 @@ class TabContents;
// or objects conditional on it (e.g. TabContents).
// This class needs to be copyable, so we can pass it across threads and not
// worry about lifetime or const-ness.
-class CONTENT_EXPORT DownloadRequestHandle {
+//
+// DownloadRequestHandleInterface is defined for mocking purposes.
+class CONTENT_EXPORT DownloadRequestHandleInterface {
+ public:
+ virtual ~DownloadRequestHandleInterface() {}
+
+ // These functions must be called on the UI thread.
+ virtual TabContents* GetTabContents() const = 0;
+ virtual DownloadManager* GetDownloadManager() const = 0;
+
+ // Pause or resume the matching URL request.
+ virtual void PauseRequest() const = 0;
+ virtual void ResumeRequest() const = 0;
+
+ // Cancel the request.
+ virtual void CancelRequest() const = 0;
+
+ // Describe the object.
+ virtual std::string DebugString() const = 0;
+};
+
+
+class CONTENT_EXPORT DownloadRequestHandle
+ : public DownloadRequestHandleInterface {
public:
// Create a null DownloadRequestHandle: getters will return null, and
// all actions are no-ops.
@@ -35,18 +59,13 @@ class CONTENT_EXPORT DownloadRequestHandle {
int render_view_id,
int request_id);
- // These functions must be called on the UI thread.
- TabContents* GetTabContents() const;
- DownloadManager* GetDownloadManager() const;
-
- // Pause or resume the matching URL request.
- void PauseRequest() const;
- void ResumeRequest() const;
-
- // Cancel the request
- void CancelRequest() const;
-
- std::string DebugString() const;
+ // Implement DownloadRequestHandleInterface interface.
+ virtual TabContents* GetTabContents() const OVERRIDE;
+ virtual DownloadManager* GetDownloadManager() const OVERRIDE;
+ virtual void PauseRequest() const OVERRIDE;
+ virtual void ResumeRequest() const OVERRIDE;
+ virtual void CancelRequest() const OVERRIDE;
+ virtual std::string DebugString() const OVERRIDE;
private:
// The resource dispatcher host.
« no previous file with comments | « content/browser/download/download_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698