OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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_OS_CRYPT_KEY_STORAGE_MOCK_H_ | |
6 #define COMPONENTS_OS_CRYPT_KEY_STORAGE_MOCK_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 | |
12 #include "components/os_crypt/key_storage_linux.h" | |
13 | |
14 // Holds and serves a password from memory. | |
15 class KeyStorageMock : public KeyStorage { | |
16 public: | |
17 KeyStorageMock() = default; | |
Lei Zhang
2016/05/18 22:38:16
Do you need both ctors?
cfroussios
2016/05/19 21:18:18
Done.
| |
18 explicit KeyStorageMock(std::string in_key); | |
Lei Zhang
2016/05/18 22:38:15
Parameter should be const-ref.
cfroussios
2016/05/19 21:18:18
This constructor was removed for not being necessa
| |
19 ~KeyStorageMock() override = default; | |
20 | |
21 // KeyStorage | |
22 std::string GetKey() override; | |
23 bool Init() override; | |
24 | |
25 // Set the password that |KeyStorageMock| holds | |
26 void ResetTo(std::string new_key); | |
27 | |
28 // Get a pointer to the stored password. Lives as long as this | |
Lei Zhang
2016/05/18 22:38:16
"Lives as long ..." -> KeyStorageMock owns the ret
cfroussios
2016/05/19 21:18:18
Done.
| |
29 // |KeyStorageMock| lives | |
30 std::string* GetKeyPtr(); | |
31 | |
32 private: | |
33 std::string key_; | |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(KeyStorageMock); | |
36 }; | |
37 | |
38 #endif // COMPONENTS_OS_CRYPT_KEY_STORAGE_MOCK_H_ | |
OLD | NEW |