Index: content/public/test/mock_download_item.h |
diff --git a/content/public/test/mock_download_item.h b/content/public/test/mock_download_item.h |
index 6a365f52b432a719fff97fe11cb880040b7bf0ef..3476652f786dbd4c88d0433c918bd7ff51ed777d 100644 |
--- a/content/public/test/mock_download_item.h |
+++ b/content/public/test/mock_download_item.h |
@@ -6,6 +6,7 @@ |
#define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ |
#include "base/callback.h" |
+#include "base/observer_list.h" |
#include "base/time/time.h" |
#include "content/public/browser/download_interrupt_reasons.h" |
#include "content/public/browser/download_item.h" |
@@ -19,9 +20,19 @@ class MockDownloadItem : public DownloadItem { |
public: |
MockDownloadItem(); |
virtual ~MockDownloadItem(); |
- MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*)); |
- MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*)); |
- MOCK_METHOD0(UpdateObservers, void()); |
+ |
+ // Management of observer lists is common in tests. So Add/RemoveObserver |
+ // methods are not mocks. In addition, any registered observers will receive a |
+ // OnDownloadDestroyed() notification when the mock is destroyed. |
+ virtual void AddObserver(Observer* observer) OVERRIDE; |
+ virtual void RemoveObserver(Observer* observer) OVERRIDE; |
+ virtual void UpdateObservers() OVERRIDE; |
Randy Smith (Not in Mondays)
2014/04/23 19:28:35
I'd cluster this with the below and name it somewh
asanka
2014/04/25 21:31:27
Done.
|
+ |
+ // Dispatches an OnDownloadOpened() notification to observers. |
+ void UpdateObserversOnOpened(); |
+ // Dispatches an OnDownloadRemoved() notification to observers. |
+ void UpdateObserversOnRemoved(); |
+ |
MOCK_METHOD0(ValidateDangerousDownload, void()); |
MOCK_METHOD1(StealDangerousDownload, void(const AcquireFileCallback&)); |
MOCK_METHOD0(Pause, void()); |
@@ -87,6 +98,9 @@ class MockDownloadItem : public DownloadItem { |
MOCK_METHOD1(SetOpened, void(bool)); |
MOCK_METHOD1(SetDisplayName, void(const base::FilePath&)); |
MOCK_CONST_METHOD1(DebugString, std::string(bool)); |
+ |
+ private: |
+ ObserverList<Observer> observers_; |
}; |
} // namespace content |