OLD | NEW |
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(const InitCallback& callback) override; |
28 void Destroy(StoreCallback callback) override; | 29 void Destroy(const StoreCallback& callback) override; |
29 void Update(const Entry& entry, StoreCallback callback) override; | 30 void Update(const Entry& entry, const StoreCallback& callback) override; |
30 void Remove(const std::string& guid, StoreCallback callback) override; | 31 void Remove(const std::string& guid, const StoreCallback& callback) override; |
31 | 32 |
32 // Callback trigger methods. | 33 // Callback trigger methods. |
33 void TriggerInit(bool success, std::unique_ptr<std::vector<Entry>> entries); | 34 void TriggerInit(bool success, std::unique_ptr<std::vector<Entry>> entries); |
34 void TriggerDestroy(bool success); | 35 void TriggerDestroy(bool success); |
35 void TriggerUpdate(bool success); | 36 void TriggerUpdate(bool success); |
36 void TriggerRemove(bool success); | 37 void TriggerRemove(bool success); |
37 | 38 |
38 // Parameter access methods. | 39 // Parameter access methods. |
39 const Entry* LastUpdatedEntry() const; | 40 const Entry* LastUpdatedEntry() const; |
40 std::string LastRemovedEntry() const; | 41 std::string LastRemovedEntry() const; |
(...skipping 18 matching lines...) Expand all Loading... |
59 StoreCallback update_callback_; | 60 StoreCallback update_callback_; |
60 StoreCallback remove_callback_; | 61 StoreCallback remove_callback_; |
61 | 62 |
62 DISALLOW_COPY_AND_ASSIGN(TestStore); | 63 DISALLOW_COPY_AND_ASSIGN(TestStore); |
63 }; | 64 }; |
64 | 65 |
65 } // namespace test | 66 } // namespace test |
66 } // namespace download | 67 } // namespace download |
67 | 68 |
68 #endif // COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_ | 69 #endif // COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_STORE_H_ |
OLD | NEW |