MediaDrmBridge: guards MediaDrm.removeKeys call in case of failure.
[chromium-blink-merge.git] / crypto / scoped_test_system_nss_key_slot.cc
blob53fbbffc1a99fb8b5b111c7ad399909c8969367d
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
3 // found in the LICENSE file.
5 #include "crypto/scoped_test_system_nss_key_slot.h"
7 #include "crypto/nss_util_internal.h"
8 #include "crypto/scoped_test_nss_db.h"
10 namespace crypto {
12 ScopedTestSystemNSSKeySlot::ScopedTestSystemNSSKeySlot()
13 : test_db_(new ScopedTestNSSDB) {
14 if (!test_db_->is_open())
15 return;
16 SetSystemKeySlotForTesting(
17 ScopedPK11Slot(PK11_ReferenceSlot(test_db_->slot())));
20 ScopedTestSystemNSSKeySlot::~ScopedTestSystemNSSKeySlot() {
21 SetSystemKeySlotForTesting(ScopedPK11Slot());
24 bool ScopedTestSystemNSSKeySlot::ConstructedSuccessfully() const {
25 return test_db_->is_open();
28 PK11SlotInfo* ScopedTestSystemNSSKeySlot::slot() const {
29 return test_db_->slot();
32 } // namespace crypto