OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_LEVELDB_PROTO_TESTING_FAKE_DB_H_ | 5 #ifndef COMPONENTS_LEVELDB_PROTO_TESTING_FAKE_DB_H_ |
6 #define COMPONENTS_LEVELDB_PROTO_TESTING_FAKE_DB_H_ | 6 #define COMPONENTS_LEVELDB_PROTO_TESTING_FAKE_DB_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 typedef base::Callback<void(bool)> Callback; | 22 typedef base::Callback<void(bool)> Callback; |
23 | 23 |
24 public: | 24 public: |
25 typedef typename base::hash_map<std::string, T> EntryMap; | 25 typedef typename base::hash_map<std::string, T> EntryMap; |
26 | 26 |
27 explicit FakeDB(EntryMap* db); | 27 explicit FakeDB(EntryMap* db); |
28 virtual ~FakeDB(); | 28 virtual ~FakeDB(); |
29 | 29 |
30 virtual void Init(const base::FilePath& database_dir, | 30 virtual void Init(const base::FilePath& database_dir, |
31 typename ProtoDatabase<T>::InitCallback callback) | 31 typename ProtoDatabase<T>::InitCallback callback) |
32 OVERRIDE; | 32 override; |
33 | 33 |
34 virtual void UpdateEntries( | 34 virtual void UpdateEntries( |
35 scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save, | 35 scoped_ptr<typename ProtoDatabase<T>::KeyEntryVector> entries_to_save, |
36 scoped_ptr<std::vector<std::string> > keys_to_remove, | 36 scoped_ptr<std::vector<std::string> > keys_to_remove, |
37 typename ProtoDatabase<T>::UpdateCallback callback) OVERRIDE; | 37 typename ProtoDatabase<T>::UpdateCallback callback) override; |
38 | 38 |
39 virtual void LoadEntries(typename ProtoDatabase<T>::LoadCallback callback) | 39 virtual void LoadEntries(typename ProtoDatabase<T>::LoadCallback callback) |
40 OVERRIDE; | 40 override; |
41 base::FilePath& GetDirectory(); | 41 base::FilePath& GetDirectory(); |
42 | 42 |
43 void InitCallback(bool success); | 43 void InitCallback(bool success); |
44 | 44 |
45 void LoadCallback(bool success); | 45 void LoadCallback(bool success); |
46 | 46 |
47 void UpdateCallback(bool success); | 47 void UpdateCallback(bool success); |
48 | 48 |
49 static base::FilePath DirectoryForTestDB(); | 49 static base::FilePath DirectoryForTestDB(); |
50 | 50 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // static | 137 // static |
138 template <typename T> | 138 template <typename T> |
139 base::FilePath FakeDB<T>::DirectoryForTestDB() { | 139 base::FilePath FakeDB<T>::DirectoryForTestDB() { |
140 return base::FilePath(FILE_PATH_LITERAL("/fake/path")); | 140 return base::FilePath(FILE_PATH_LITERAL("/fake/path")); |
141 } | 141 } |
142 | 142 |
143 } // namespace test | 143 } // namespace test |
144 } // namespace leveldb_proto | 144 } // namespace leveldb_proto |
145 | 145 |
146 #endif // COMPONENTS_LEVELDB_PROTO_TESTING_FAKE_DB_H_ | 146 #endif // COMPONENTS_LEVELDB_PROTO_TESTING_FAKE_DB_H_ |
OLD | NEW |