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

Side by Side Diff: components/download/internal/test/test_store.h

Issue 2881173003: Download Service : Added leveldb proto layer (Closed)
Patch Set: Removed Model::Destroy Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_ 5 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_
6 #define COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_ 6 #define COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "components/download/internal/store.h" 13 #include "components/download/internal/store.h"
13 14
14 namespace download { 15 namespace download {
15 16
16 struct Entry; 17 struct Entry;
17 18
18 namespace test { 19 namespace test {
19 20
20 class TestStore : public Store { 21 class TestStore : public Store {
21 public: 22 public:
22 TestStore(); 23 TestStore();
23 ~TestStore() override; 24 ~TestStore() override;
24 25
25 // Store implementation. 26 // Store implementation.
26 bool IsInitialized() override; 27 bool IsInitialized() override;
27 void Initialize(InitCallback callback) override; 28 void Initialize(InitCallback callback) override;
28 void Destroy(StoreCallback callback) override;
29 void Update(const Entry& entry, StoreCallback callback) override; 29 void Update(const Entry& entry, StoreCallback callback) override;
30 void Remove(const std::string& guid, StoreCallback callback) override; 30 void Remove(const std::string& guid, StoreCallback callback) override;
31 31
32 // Callback trigger methods. 32 // Callback trigger methods.
33 void TriggerInit(bool success, std::unique_ptr<std::vector<Entry>> entries); 33 void TriggerInit(bool success, std::unique_ptr<std::vector<Entry>> entries);
34 void TriggerDestroy(bool success);
35 void TriggerUpdate(bool success); 34 void TriggerUpdate(bool success);
36 void TriggerRemove(bool success); 35 void TriggerRemove(bool success);
37 36
38 // Parameter access methods. 37 // Parameter access methods.
39 const Entry* LastUpdatedEntry() const; 38 const Entry* LastUpdatedEntry() const;
40 std::string LastRemovedEntry() const; 39 std::string LastRemovedEntry() const;
41 bool init_called() const { return init_called_; } 40 bool init_called() const { return init_called_; }
42 bool destroy_called() const { return destroy_called_; }
43 const std::vector<Entry>& updated_entries() const { return updated_entries_; } 41 const std::vector<Entry>& updated_entries() const { return updated_entries_; }
44 const std::vector<std::string>& removed_entries() const { 42 const std::vector<std::string>& removed_entries() const {
45 return removed_entries_; 43 return removed_entries_;
46 } 44 }
47 45
48 private: 46 private:
49 bool ready_; 47 bool ready_;
50 48
51 bool init_called_; 49 bool init_called_;
52 bool destroy_called_;
53 50
54 std::vector<Entry> updated_entries_; 51 std::vector<Entry> updated_entries_;
55 std::vector<std::string> removed_entries_; 52 std::vector<std::string> removed_entries_;
56 53
57 InitCallback init_callback_; 54 InitCallback init_callback_;
58 StoreCallback destroy_callback_;
59 StoreCallback update_callback_; 55 StoreCallback update_callback_;
60 StoreCallback remove_callback_; 56 StoreCallback remove_callback_;
61 57
62 DISALLOW_COPY_AND_ASSIGN(TestStore); 58 DISALLOW_COPY_AND_ASSIGN(TestStore);
63 }; 59 };
64 60
65 } // namespace test 61 } // namespace test
66 } // namespace download 62 } // namespace download
67 63
68 #endif // COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_ 64 #endif // COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_
OLDNEW
« no previous file with comments | « components/download/internal/test/noop_store.cc ('k') | components/download/internal/test/test_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698