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

Side by Side Diff: crypto/scoped_test_system_nss_key_slot.h

Issue 424523002: Enable system NSS key slot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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_SYSTEM_NSS_KEY_SLOT_H_ 5 #ifndef CRYPTO_SCOPED_TEST_SYSTEM_NSS_KEY_SLOT_H_
6 #define CRYPTO_SCOPED_TEST_SYSTEM_NSS_KEY_SLOT_H_ 6 #define CRYPTO_SCOPED_TEST_SYSTEM_NSS_KEY_SLOT_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "crypto/crypto_export.h" 10 #include "crypto/crypto_export.h"
11 11
12 // Forward declaration, from <pk11pub.h>
13 typedef struct PK11SlotInfoStr PK11SlotInfo;
14
12 namespace crypto { 15 namespace crypto {
13 16
14 class ScopedTestNSSDB; 17 class ScopedTestNSSDB;
15 18
16 // Opens a persistent NSS software database in a temporary directory and sets 19 // Opens a persistent NSS software database in a temporary directory and sets
17 // the test system slot to the opened database. This helper should be created in 20 // the test system slot to the opened database. This helper should be created in
18 // tests where no system token is provided by the Chaps module and before 21 // tests where no system token is provided by the Chaps module.
19 // InitializeTPMTokenAndSystemSlot is called. Then the opened test database will 22 // If |skip_tpm_initialization| is true, then the TPM initialization that is
23 // usually triggered by InitializeTPMTokenAndSystemSlot is skipped and instead
24 // the |slot| is directly exposed through |GetSystemNSSKeySlot| and
25 // |IsTPMTokenReady| will return true.
26 // If |skip_tpm_initialization| is false, InitializeTPMTokenAndSystemSlot must
27 // be called afterwards. Then the opened test database will
20 // be used and the initialization continues as if Chaps had provided this test 28 // be used and the initialization continues as if Chaps had provided this test
21 // database. In particular, the DB will be exposed by |GetSystemNSSKeySlot| and 29 // database. Again, the DB will be exposed by |GetSystemNSSKeySlot| and
22 // |IsTPMTokenReady| will return true. 30 // |IsTPMTokenReady| will return true.
23 // At most one instance of this helper must be used at a time. 31 // At most one instance of this helper must be used at a time.
24 class CRYPTO_EXPORT_PRIVATE ScopedTestSystemNSSKeySlot { 32 class CRYPTO_EXPORT_PRIVATE ScopedTestSystemNSSKeySlot {
25 public: 33 public:
26 explicit ScopedTestSystemNSSKeySlot(); 34 explicit ScopedTestSystemNSSKeySlot(bool skip_tpm_initialization);
27 ~ScopedTestSystemNSSKeySlot(); 35 ~ScopedTestSystemNSSKeySlot();
28 36
29 bool ConstructedSuccessfully() const; 37 bool ConstructedSuccessfully() const;
38 PK11SlotInfo* slot() const;
30 39
31 private: 40 private:
32 scoped_ptr<ScopedTestNSSDB> test_db_; 41 scoped_ptr<ScopedTestNSSDB> test_db_;
33 42
34 DISALLOW_COPY_AND_ASSIGN(ScopedTestSystemNSSKeySlot); 43 DISALLOW_COPY_AND_ASSIGN(ScopedTestSystemNSSKeySlot);
35 }; 44 };
36 45
37 } // namespace crypto 46 } // namespace crypto
38 47
39 #endif // CRYPTO_SCOPED_TEST_SYSTEM_NSS_KEY_SLOT_H_ 48 #endif // CRYPTO_SCOPED_TEST_SYSTEM_NSS_KEY_SLOT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698