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

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

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

Powered by Google App Engine
This is Rietveld 408576698