| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_CORE_STUB_OFFLINE_PAGE_MODEL_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_STUB_OFFLINE_PAGE_MODEL_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_STUB_OFFLINE_PAGE_MODEL_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_STUB_OFFLINE_PAGE_MODEL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
| 13 #include "components/offline_pages/core/client_policy_controller.h" | 13 #include "components/offline_pages/core/client_policy_controller.h" |
| 14 #include "components/offline_pages/core/offline_page_model.h" | 14 #include "components/offline_pages/core/offline_page_model.h" |
| 15 | 15 |
| 16 namespace offline_pages { | 16 namespace offline_pages { |
| 17 | 17 |
| 18 // Stub implementation of OfflinePageModel interface for testing. Besides using | 18 // Stub implementation of OfflinePageModel interface for testing. Besides using |
| 19 // as a stub for tests, it may also be subclassed to mock specific methods | 19 // as a stub for tests, it may also be subclassed to mock specific methods |
| 20 // needed for a set of tests. | 20 // needed for a set of tests. |
| 21 class StubOfflinePageModel : public OfflinePageModel, public KeyedService { | 21 class StubOfflinePageModel : public OfflinePageModel, public KeyedService { |
| 22 public: | 22 public: |
| 23 StubOfflinePageModel(); | 23 StubOfflinePageModel(); |
| 24 ~StubOfflinePageModel() override; | 24 ~StubOfflinePageModel() override; |
| 25 | 25 |
| 26 void AddObserver(Observer* observer) override; | 26 void AddObserver(Observer* observer) override; |
| 27 void RemoveObserver(Observer* observer) override; | 27 void RemoveObserver(Observer* observer) override; |
| 28 void SavePage(const SavePageParams& save_page_params, | 28 void SavePage(const SavePageParams& save_page_params, |
| 29 std::unique_ptr<OfflinePageArchiver> archiver, | 29 std::unique_ptr<OfflinePageArchiver> archiver, |
| 30 const std::vector<std::string>& signal_data, |
| 30 const SavePageCallback& callback) override; | 31 const SavePageCallback& callback) override; |
| 31 void MarkPageAccessed(int64_t offline_id) override; | 32 void MarkPageAccessed(int64_t offline_id) override; |
| 32 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, | 33 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids, |
| 33 const DeletePageCallback& callback) override; | 34 const DeletePageCallback& callback) override; |
| 34 void DeletePagesByClientIds(const std::vector<ClientId>& client_ids, | 35 void DeletePagesByClientIds(const std::vector<ClientId>& client_ids, |
| 35 const DeletePageCallback& callback) override; | 36 const DeletePageCallback& callback) override; |
| 36 void GetPagesMatchingQuery( | 37 void GetPagesMatchingQuery( |
| 37 std::unique_ptr<OfflinePageModelQuery> query, | 38 std::unique_ptr<OfflinePageModelQuery> query, |
| 38 const MultipleOfflinePageItemCallback& callback) override; | 39 const MultipleOfflinePageItemCallback& callback) override; |
| 39 void GetPagesByClientIds( | 40 void GetPagesByClientIds( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 61 OfflineEventLogger* GetLogger() override; | 62 OfflineEventLogger* GetLogger() override; |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 ClientPolicyController policy_controller_; | 65 ClientPolicyController policy_controller_; |
| 65 std::vector<int64_t> offline_ids_; | 66 std::vector<int64_t> offline_ids_; |
| 66 }; | 67 }; |
| 67 | 68 |
| 68 } // namespace offline_pages | 69 } // namespace offline_pages |
| 69 | 70 |
| 70 #endif // COMPONENTS_OFFLINE_PAGES_CORE_STUB_OFFLINE_PAGE_MODEL_H_ | 71 #endif // COMPONENTS_OFFLINE_PAGES_CORE_STUB_OFFLINE_PAGE_MODEL_H_ |
| OLD | NEW |