Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: components/offline_pages/offline_page_test_store.h

Issue 2329283002: [Offline pages] OPM SQL store: moving load to constructor, updating read to GetOfflinePages (Closed)
Patch Set: Addressing CR feedback Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 18 matching lines...) Expand all
29 LOAD_FAILED, 29 LOAD_FAILED,
30 REMOVE_FAILED, 30 REMOVE_FAILED,
31 }; 31 };
32 32
33 explicit OfflinePageTestStore( 33 explicit OfflinePageTestStore(
34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
35 explicit OfflinePageTestStore(const OfflinePageTestStore& other_store); 35 explicit OfflinePageTestStore(const OfflinePageTestStore& other_store);
36 ~OfflinePageTestStore() override; 36 ~OfflinePageTestStore() override;
37 37
38 // OfflinePageMetadataStore overrides: 38 // OfflinePageMetadataStore overrides:
39 void Load(const LoadCallback& callback) override; 39 void GetOfflinePages(const LoadCallback& callback) override;
40 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, 40 void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page,
41 const UpdateCallback& callback) override; 41 const UpdateCallback& callback) override;
42 void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, 42 void RemoveOfflinePages(const std::vector<int64_t>& offline_ids,
43 const UpdateCallback& callback) override; 43 const UpdateCallback& callback) override;
44 void Reset(const ResetCallback& callback) override; 44 void Reset(const ResetCallback& callback) override;
45 StoreState state() const override;
45 46
46 void UpdateLastAccessTime(int64_t offline_id, 47 void UpdateLastAccessTime(int64_t offline_id,
47 const base::Time& last_access_time); 48 const base::Time& last_access_time);
48 49
49 // Returns all pages, regardless their states. 50 // Returns all pages, regardless their states.
50 std::vector<OfflinePageItem> GetAllPages() const; 51 std::vector<OfflinePageItem> GetAllPages() const;
51 52
52 // Clear all pages in the store. 53 // Clear all pages in the store.
53 void ClearAllPages(); 54 void ClearAllPages();
54 55
55 const OfflinePageItem& last_saved_page() const { return last_saved_page_; } 56 const OfflinePageItem& last_saved_page() const { return last_saved_page_; }
56 57
57 void set_test_scenario(TestScenario scenario) { scenario_ = scenario; }; 58 void set_test_scenario(TestScenario scenario) { scenario_ = scenario; };
58 59
59 private: 60 private:
60 OfflinePageItem last_saved_page_; 61 OfflinePageItem last_saved_page_;
61 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 62 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
62 TestScenario scenario_; 63 TestScenario scenario_;
63 64
64 std::map<int64_t, OfflinePageItem> offline_pages_; 65 std::map<int64_t, OfflinePageItem> offline_pages_;
65 66
66 DISALLOW_ASSIGN(OfflinePageTestStore); 67 DISALLOW_ASSIGN(OfflinePageTestStore);
67 }; 68 };
68 69
69 } // namespace offline_pages 70 } // namespace offline_pages
70 71
71 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_ 72 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_STORE_H_
OLDNEW
« no previous file with comments | « components/offline_pages/offline_page_model_impl.cc ('k') | components/offline_pages/offline_page_test_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698