[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / crypto / scoped_test_system_nss_key_slot.cc
1 // Copyright 2014 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "crypto/scoped_test_system_nss_key_slot.h"
6
7 #include "crypto/nss_util.h"
8 #include "crypto/nss_util_internal.h"
9 #include "crypto/scoped_test_nss_db.h"
10
11 namespace crypto {
12
13 ScopedTestSystemNSSKeySlot::ScopedTestSystemNSSKeySlot(
14     bool simulate_token_loader)
15     : test_db_(new ScopedTestNSSDB) {
16   if (!test_db_->is_open())
17     return;
18
19   PrepareSystemSlotForTesting(  // IN-TEST
20       ScopedPK11Slot(PK11_ReferenceSlot(test_db_->slot())));
21
22   if (simulate_token_loader)
23     FinishInitializingTPMTokenAndSystemSlot();
24 }
25
26 ScopedTestSystemNSSKeySlot::~ScopedTestSystemNSSKeySlot() {
27   ResetSystemSlotForTesting();  // IN-TEST
28 }
29
30 bool ScopedTestSystemNSSKeySlot::ConstructedSuccessfully() const {
31   return test_db_->is_open();
32 }
33
34 PK11SlotInfo* ScopedTestSystemNSSKeySlot::slot() const {
35   return test_db_->slot();
36 }
37
38 }  // namespace crypto