Chromium Code Reviews| Index: components/offline_content/core/test_support/mock_offline_content_provider.h |
| diff --git a/components/offline_content/core/test_support/mock_offline_content_provider.h b/components/offline_content/core/test_support/mock_offline_content_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a062d6b601f7cd1d179608435970993e337a230e |
| --- /dev/null |
| +++ b/components/offline_content/core/test_support/mock_offline_content_provider.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
|
qinmin
2017/02/14 07:37:20
remove (c)
David Trainor- moved to gerrit
2017/02/22 01:23:13
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_OFFLINE_CONTENT_CORE_TEST_SUPPORT_MOCK_OFFLINE_CONTENT_PROVIDER_H_ |
| +#define COMPONENTS_OFFLINE_CONTENT_CORE_TEST_SUPPORT_MOCK_OFFLINE_CONTENT_PROVIDER_H_ |
| + |
| +#include "base/observer_list.h" |
| +#include "components/offline_content/core/offline_content_provider.h" |
| +#include "components/offline_content/core/offline_item.h" |
| +#include "testing/gmock/include/gmock/gmock.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace offline_content { |
| + |
| +class MockOfflineContentProvider : public OfflineContentProvider { |
| + public: |
| + class MockObserver : public OfflineContentProvider::Observer { |
| + public: |
| + MockObserver(); |
| + ~MockObserver() override; |
| + |
| + // OfflineContentProvider::Observer implementation. |
| + MOCK_METHOD1(OnItemsAvailable, void(OfflineContentProvider*)); |
| + MOCK_METHOD1(OnItemsAdded, void(const OfflineItemList&)); |
| + MOCK_METHOD1(OnItemRemoved, void(const ContentId&)); |
| + MOCK_METHOD1(OnItemUpdated, void(const OfflineItem&)); |
| + }; |
| + |
| + MockOfflineContentProvider(); |
| + ~MockOfflineContentProvider() override; |
| + |
| + bool HasObserver(Observer* observer); |
| + void NotifyOnItemsAvailable(); |
| + void NotifyOnItemsAdded(const OfflineItemList& items); |
| + void NotifyOnItemRemoved(const ContentId& id); |
| + void NotifyOnItemUpdated(const OfflineItem& item); |
| + |
| + // OfflineContentProvider implementation. |
| + bool AreItemsAvailable() override; |
| + MOCK_METHOD1(OpenItem, void(const ContentId&)); |
| + MOCK_METHOD1(RemoveItem, void(const ContentId&)); |
| + MOCK_METHOD1(CancelDownload, void(const ContentId&)); |
| + MOCK_METHOD1(PauseDownload, void(const ContentId&)); |
| + MOCK_METHOD1(ResumeDownload, void(const ContentId&)); |
| + MOCK_METHOD1(GetItemById, OfflineItem*(const ContentId&)); |
| + MOCK_METHOD0(GetAllItems, OfflineItemList()); |
| + void AddObserver(Observer* observer) override; |
| + void RemoveObserver(Observer* observer) override; |
| + |
| + private: |
| + base::ObserverList<Observer> observers_; |
| + bool items_available_; |
| +}; |
| + |
| +} // namespace offline_content |
| + |
| +#endif // COMPONENTS_OFFLINE_CONTENT_CORE_TEST_SUPPORT_MOCK_OFFLINE_CONTENT_PROVIDER_H_ |