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 CRYPTO_SCOPED_TEST_NSS_CHROMEOS_USER_H_ | 5 #ifndef CRYPTO_SCOPED_TEST_NSS_CHROMEOS_USER_H_ |
6 #define CRYPTO_SCOPED_TEST_NSS_CHROMEOS_USER_H_ | 6 #define CRYPTO_SCOPED_TEST_NSS_CHROMEOS_USER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "crypto/crypto_export.h" | 12 #include "crypto/crypto_export.h" |
13 | 13 |
14 namespace crypto { | 14 namespace crypto { |
15 | 15 |
16 // Opens a persistent NSS software database in a temporary directory for the | 16 // Opens a persistent NSS software database in a temporary directory for the |
17 // user with |username_hash|. This database will be used for both the user's | 17 // user with |username_hash|. This database will be used for both the user's |
18 // public and private slot. | 18 // public and private slot. |
19 class CRYPTO_EXPORT_PRIVATE ScopedTestNSSChromeOSUser { | 19 class CRYPTO_EXPORT ScopedTestNSSChromeOSUser { |
20 public: | 20 public: |
21 // Opens the software database and sets the public slot for the user. The | 21 // Opens the software database and sets the public slot for the user. The |
22 // private slot will not be initialized until FinishInit() is called. | 22 // private slot will not be initialized until FinishInit() is called. |
23 explicit ScopedTestNSSChromeOSUser(const std::string& username_hash); | 23 explicit ScopedTestNSSChromeOSUser(const std::string& username_hash); |
24 ~ScopedTestNSSChromeOSUser(); | 24 ~ScopedTestNSSChromeOSUser(); |
25 | 25 |
26 std::string username_hash() const { return username_hash_; } | 26 std::string username_hash() const { return username_hash_; } |
27 bool constructed_successfully() const { return constructed_successfully_; } | 27 bool constructed_successfully() const { return constructed_successfully_; } |
28 | 28 |
29 // Completes initialization of user. Causes any waiting private slot callbacks | 29 // Completes initialization of user. Causes any waiting private slot callbacks |
30 // to run, see GetPrivateSlotForChromeOSUser(). | 30 // to run, see GetPrivateSlotForChromeOSUser(). |
31 void FinishInit(); | 31 void FinishInit(); |
32 | 32 |
33 private: | 33 private: |
34 const std::string username_hash_; | 34 const std::string username_hash_; |
35 base::ScopedTempDir temp_dir_; | 35 base::ScopedTempDir temp_dir_; |
36 bool constructed_successfully_; | 36 bool constructed_successfully_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(ScopedTestNSSChromeOSUser); | 38 DISALLOW_COPY_AND_ASSIGN(ScopedTestNSSChromeOSUser); |
39 }; | 39 }; |
40 | 40 |
41 } // namespace crypto | 41 } // namespace crypto |
42 | 42 |
43 #endif // CRYPTO_SCOPED_TEST_NSS_CHROMEOS_USER_H_ | 43 #endif // CRYPTO_SCOPED_TEST_NSS_CHROMEOS_USER_H_ |
OLD | NEW |