| Index: crypto/nss_util.cc
|
| diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
|
| index 3915b7597953f66e5671927cd66d1273f06791ed..fdf2b3793d7a43e52dcec4acdc9ce8d2ff244db1 100644
|
| --- a/crypto/nss_util.cc
|
| +++ b/crypto/nss_util.cc
|
| @@ -573,11 +573,17 @@ class NSSInitSingleton {
|
| chromeos_user_map_.erase(i);
|
| }
|
|
|
| - void SetSystemKeySlotForTesting(ScopedPK11Slot slot) {
|
| + void SetSystemKeySlotForTesting(bool skip_tpm_initialization,
|
| + ScopedPK11Slot slot) {
|
| // Ensure that a previous value of test_system_slot_ is not overwritten.
|
| // Unsetting, i.e. setting a NULL, however is allowed.
|
| DCHECK(!slot || !test_system_slot_);
|
| test_system_slot_ = slot.Pass();
|
| + if (skip_tpm_initialization) {
|
| + EnableTPMTokenForNSS();
|
| + CHECK(test_system_slot_);
|
| + tpm_slot_ = PK11_ReferenceSlot(test_system_slot_.get());
|
| + }
|
| }
|
| #endif // defined(OS_CHROMEOS)
|
|
|
| @@ -1015,8 +1021,10 @@ ScopedPK11Slot GetSystemNSSKeySlot(
|
| return g_nss_singleton.Get().GetSystemNSSKeySlot(callback);
|
| }
|
|
|
| -void SetSystemKeySlotForTesting(ScopedPK11Slot slot) {
|
| - g_nss_singleton.Get().SetSystemKeySlotForTesting(ScopedPK11Slot());
|
| +void SetSystemKeySlotForTesting(bool skip_tpm_initialization,
|
| + ScopedPK11Slot slot) {
|
| + g_nss_singleton.Get().SetSystemKeySlotForTesting(skip_tpm_initialization,
|
| + slot.Pass());
|
| }
|
|
|
| void EnableTPMTokenForNSS() {
|
|
|