OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_VALUE_STORE_TESTING_VALUE_STORE_H_ | 5 #ifndef CHROME_BROWSER_VALUE_STORE_TESTING_VALUE_STORE_H_ |
6 #define CHROME_BROWSER_VALUE_STORE_TESTING_VALUE_STORE_H_ | 6 #define CHROME_BROWSER_VALUE_STORE_TESTING_VALUE_STORE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/value_store/value_store.h" | 10 #include "chrome/browser/value_store/value_store.h" |
11 | 11 |
12 // ValueStore for testing, with an in-memory storage but the ability to | 12 // ValueStore for testing, with an in-memory storage but the ability to |
13 // optionally fail all operations. | 13 // optionally fail all operations. |
14 class TestingSettingsStorage : public ValueStore { | 14 class TestingValueStore : public ValueStore { |
15 public: | 15 public: |
16 TestingSettingsStorage(); | 16 TestingValueStore(); |
17 virtual ~TestingSettingsStorage(); | 17 virtual ~TestingValueStore(); |
18 | 18 |
19 // Sets whether to fail all requests (default is false). | 19 // Sets whether to fail all requests (default is false). |
20 void SetFailAllRequests(bool fail_all_requests); | 20 void SetFailAllRequests(bool fail_all_requests); |
21 | 21 |
22 // ValueStore implementation. | 22 // ValueStore implementation. |
23 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE; | 23 virtual size_t GetBytesInUse(const std::string& key) OVERRIDE; |
24 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE; | 24 virtual size_t GetBytesInUse(const std::vector<std::string>& keys) OVERRIDE; |
25 virtual size_t GetBytesInUse() OVERRIDE; | 25 virtual size_t GetBytesInUse() OVERRIDE; |
26 virtual ReadResult Get(const std::string& key) OVERRIDE; | 26 virtual ReadResult Get(const std::string& key) OVERRIDE; |
27 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; | 27 virtual ReadResult Get(const std::vector<std::string>& keys) OVERRIDE; |
28 virtual ReadResult Get() OVERRIDE; | 28 virtual ReadResult Get() OVERRIDE; |
29 virtual WriteResult Set( | 29 virtual WriteResult Set( |
30 WriteOptions options, | 30 WriteOptions options, |
31 const std::string& key, | 31 const std::string& key, |
32 const Value& value) OVERRIDE; | 32 const Value& value) OVERRIDE; |
33 virtual WriteResult Set( | 33 virtual WriteResult Set( |
34 WriteOptions options, const DictionaryValue& values) OVERRIDE; | 34 WriteOptions options, const DictionaryValue& values) OVERRIDE; |
35 virtual WriteResult Remove(const std::string& key) OVERRIDE; | 35 virtual WriteResult Remove(const std::string& key) OVERRIDE; |
36 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; | 36 virtual WriteResult Remove(const std::vector<std::string>& keys) OVERRIDE; |
37 virtual WriteResult Clear() OVERRIDE; | 37 virtual WriteResult Clear() OVERRIDE; |
38 | 38 |
39 private: | 39 private: |
40 DictionaryValue storage_; | 40 DictionaryValue storage_; |
41 | 41 |
42 bool fail_all_requests_; | 42 bool fail_all_requests_; |
43 | 43 |
44 DISALLOW_COPY_AND_ASSIGN(TestingSettingsStorage); | 44 DISALLOW_COPY_AND_ASSIGN(TestingValueStore); |
45 }; | 45 }; |
46 | 46 |
47 #endif // CHROME_BROWSER_VALUE_STORE_TESTING_VALUE_STORE_H_ | 47 #endif // CHROME_BROWSER_VALUE_STORE_TESTING_VALUE_STORE_H_ |
OLD | NEW |