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 #include "crypto/scoped_test_system_nss_key_slot.h" | 5 #include "crypto/scoped_test_system_nss_key_slot.h" |
6 | 6 |
7 #include "crypto/nss_util_internal.h" | 7 #include "crypto/nss_util_internal.h" |
8 #include "crypto/scoped_test_nss_db.h" | 8 #include "crypto/scoped_test_nss_db.h" |
9 | 9 |
10 namespace crypto { | 10 namespace crypto { |
11 | 11 |
12 ScopedTestSystemNSSKeySlot::ScopedTestSystemNSSKeySlot() | 12 ScopedTestSystemNSSKeySlot::ScopedTestSystemNSSKeySlot( |
| 13 bool skip_tpm_initialization) |
13 : test_db_(new ScopedTestNSSDB) { | 14 : test_db_(new ScopedTestNSSDB) { |
14 if (!test_db_->is_open()) | 15 if (!test_db_->is_open()) |
15 return; | 16 return; |
16 SetSystemKeySlotForTesting( | 17 SetSystemKeySlotForTesting( |
| 18 skip_tpm_initialization, |
17 ScopedPK11Slot(PK11_ReferenceSlot(test_db_->slot()))); | 19 ScopedPK11Slot(PK11_ReferenceSlot(test_db_->slot()))); |
18 } | 20 } |
19 | 21 |
20 ScopedTestSystemNSSKeySlot::~ScopedTestSystemNSSKeySlot() { | 22 ScopedTestSystemNSSKeySlot::~ScopedTestSystemNSSKeySlot() { |
21 SetSystemKeySlotForTesting(ScopedPK11Slot()); | 23 SetSystemKeySlotForTesting(false, ScopedPK11Slot()); |
22 } | 24 } |
23 | 25 |
24 bool ScopedTestSystemNSSKeySlot::ConstructedSuccessfully() const { | 26 bool ScopedTestSystemNSSKeySlot::ConstructedSuccessfully() const { |
25 return test_db_->is_open(); | 27 return test_db_->is_open(); |
26 } | 28 } |
27 | 29 |
| 30 PK11SlotInfo* ScopedTestSystemNSSKeySlot::slot() const { |
| 31 return test_db_->slot(); |
| 32 } |
| 33 |
28 } // namespace crypto | 34 } // namespace crypto |
OLD | NEW |