OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_OFFLINE_PAGE_TEST_STORE_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 void RemoveOfflinePages(const std::vector<int64>& bookmark_ids, | 40 void RemoveOfflinePages(const std::vector<int64>& bookmark_ids, |
41 const UpdateCallback& callback) override; | 41 const UpdateCallback& callback) override; |
42 void Reset(const ResetCallback& callback) override; | 42 void Reset(const ResetCallback& callback) override; |
43 | 43 |
44 void UpdateLastAccessTime(int64 bookmark_id, | 44 void UpdateLastAccessTime(int64 bookmark_id, |
45 const base::Time& last_access_time); | 45 const base::Time& last_access_time); |
46 | 46 |
47 // Returns all pages, regardless their states. | 47 // Returns all pages, regardless their states. |
48 std::vector<OfflinePageItem> GetAllPages() const; | 48 std::vector<OfflinePageItem> GetAllPages() const; |
49 | 49 |
| 50 // Utility method to inject items in store. |
| 51 void SetStoreState(const std::vector<OfflinePageItem>& offline_pages); |
| 52 |
50 const OfflinePageItem& last_saved_page() const { return last_saved_page_; } | 53 const OfflinePageItem& last_saved_page() const { return last_saved_page_; } |
51 | 54 |
52 void set_test_scenario(TestScenario scenario) { scenario_ = scenario; }; | 55 void set_test_scenario(TestScenario scenario) { scenario_ = scenario; }; |
53 | 56 |
54 private: | 57 private: |
55 OfflinePageItem last_saved_page_; | 58 OfflinePageItem last_saved_page_; |
56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
57 TestScenario scenario_; | 60 TestScenario scenario_; |
58 | 61 |
59 std::map<int64, OfflinePageItem> offline_pages_; | 62 std::map<int64, OfflinePageItem> offline_pages_; |
60 | 63 |
61 DISALLOW_ASSIGN(OfflinePageTestStore); | 64 DISALLOW_ASSIGN(OfflinePageTestStore); |
62 }; | 65 }; |
63 | 66 |
64 } // namespace offline_pages | 67 } // namespace offline_pages |
65 | 68 |
66 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ | 69 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ |
OLD | NEW |