| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ | 6 #define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "content/public/browser/download_interrupt_reasons.h" | 11 #include "content/public/browser/download_interrupt_reasons.h" |
| 12 #include "content/public/browser/download_item.h" | 12 #include "content/public/browser/download_item.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 class MockDownloadItem : public DownloadItem { | 19 class MockDownloadItem : public DownloadItem { |
| 20 public: | 20 public: |
| 21 MockDownloadItem(); | 21 MockDownloadItem(); |
| 22 virtual ~MockDownloadItem(); | 22 virtual ~MockDownloadItem(); |
| 23 | 23 |
| 24 // Management of observer lists is common in tests. So Add/RemoveObserver | 24 // Management of observer lists is common in tests. So Add/RemoveObserver |
| 25 // methods are not mocks. In addition, any registered observers will receive a | 25 // methods are not mocks. In addition, any registered observers will receive a |
| 26 // OnDownloadDestroyed() notification when the mock is destroyed. | 26 // OnDownloadDestroyed() notification when the mock is destroyed. |
| 27 virtual void AddObserver(Observer* observer) OVERRIDE; | 27 virtual void AddObserver(Observer* observer) override; |
| 28 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 28 virtual void RemoveObserver(Observer* observer) override; |
| 29 | 29 |
| 30 // Dispatches an OnDownloadOpened() notification to observers. | 30 // Dispatches an OnDownloadOpened() notification to observers. |
| 31 void NotifyObserversDownloadOpened(); | 31 void NotifyObserversDownloadOpened(); |
| 32 // Dispatches an OnDownloadRemoved() notification to observers. | 32 // Dispatches an OnDownloadRemoved() notification to observers. |
| 33 void NotifyObserversDownloadRemoved(); | 33 void NotifyObserversDownloadRemoved(); |
| 34 // Dispatches an OnDownloadUpdated() notification to observers. | 34 // Dispatches an OnDownloadUpdated() notification to observers. |
| 35 void NotifyObserversDownloadUpdated(); | 35 void NotifyObserversDownloadUpdated(); |
| 36 | 36 |
| 37 MOCK_METHOD0(UpdateObservers, void()); | 37 MOCK_METHOD0(UpdateObservers, void()); |
| 38 MOCK_METHOD0(ValidateDangerousDownload, void()); | 38 MOCK_METHOD0(ValidateDangerousDownload, void()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 MOCK_METHOD1(SetDisplayName, void(const base::FilePath&)); | 101 MOCK_METHOD1(SetDisplayName, void(const base::FilePath&)); |
| 102 MOCK_CONST_METHOD1(DebugString, std::string(bool)); | 102 MOCK_CONST_METHOD1(DebugString, std::string(bool)); |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 ObserverList<Observer> observers_; | 105 ObserverList<Observer> observers_; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace content | 108 } // namespace content |
| 109 | 109 |
| 110 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ | 110 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_ |
| OLD | NEW |