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 <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
14 #include "components/offline_pages/offline_page_item.h" | 16 #include "components/offline_pages/offline_page_item.h" |
15 #include "components/offline_pages/offline_page_metadata_store.h" | 17 #include "components/offline_pages/offline_page_metadata_store.h" |
16 | 18 |
17 namespace offline_pages { | 19 namespace offline_pages { |
(...skipping 12 matching lines...) Expand all Loading... |
30 | 32 |
31 explicit OfflinePageTestStore( | 33 explicit OfflinePageTestStore( |
32 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
33 explicit OfflinePageTestStore(const OfflinePageTestStore& other_store); | 35 explicit OfflinePageTestStore(const OfflinePageTestStore& other_store); |
34 ~OfflinePageTestStore() override; | 36 ~OfflinePageTestStore() override; |
35 | 37 |
36 // OfflinePageMetadataStore overrides: | 38 // OfflinePageMetadataStore overrides: |
37 void Load(const LoadCallback& callback) override; | 39 void Load(const LoadCallback& callback) override; |
38 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, | 40 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, |
39 const UpdateCallback& callback) override; | 41 const UpdateCallback& callback) override; |
40 void RemoveOfflinePages(const std::vector<int64>& bookmark_ids, | 42 void RemoveOfflinePages(const std::vector<int64_t>& bookmark_ids, |
41 const UpdateCallback& callback) override; | 43 const UpdateCallback& callback) override; |
42 void Reset(const ResetCallback& callback) override; | 44 void Reset(const ResetCallback& callback) override; |
43 | 45 |
44 void UpdateLastAccessTime(int64 bookmark_id, | 46 void UpdateLastAccessTime(int64_t bookmark_id, |
45 const base::Time& last_access_time); | 47 const base::Time& last_access_time); |
46 | 48 |
47 // Returns all pages, regardless their states. | 49 // Returns all pages, regardless their states. |
48 std::vector<OfflinePageItem> GetAllPages() const; | 50 std::vector<OfflinePageItem> GetAllPages() const; |
49 | 51 |
50 const OfflinePageItem& last_saved_page() const { return last_saved_page_; } | 52 const OfflinePageItem& last_saved_page() const { return last_saved_page_; } |
51 | 53 |
52 void set_test_scenario(TestScenario scenario) { scenario_ = scenario; }; | 54 void set_test_scenario(TestScenario scenario) { scenario_ = scenario; }; |
53 | 55 |
54 private: | 56 private: |
55 OfflinePageItem last_saved_page_; | 57 OfflinePageItem last_saved_page_; |
56 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
57 TestScenario scenario_; | 59 TestScenario scenario_; |
58 | 60 |
59 std::map<int64, OfflinePageItem> offline_pages_; | 61 std::map<int64_t, OfflinePageItem> offline_pages_; |
60 | 62 |
61 DISALLOW_ASSIGN(OfflinePageTestStore); | 63 DISALLOW_ASSIGN(OfflinePageTestStore); |
62 }; | 64 }; |
63 | 65 |
64 } // namespace offline_pages | 66 } // namespace offline_pages |
65 | 67 |
66 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ | 68 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ |
OLD | NEW |