Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / crypto / scoped_test_nss_db.h
blob88c2d55dbe4ed55d184e65fb4c1cf02753c1b604
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 #ifndef CRYPTO_SCOPED_TEST_NSS_DB_H_
6 #define CRYPTO_SCOPED_TEST_NSS_DB_H_
8 #include "base/files/scoped_temp_dir.h"
9 #include "base/macros.h"
10 #include "crypto/crypto_export.h"
11 #include "crypto/scoped_nss_types.h"
13 namespace crypto {
15 // Opens a persistent NSS database in a temporary directory.
16 // Prior NSS version 3.15.1, because of http://bugzil.la/875601 , the opened DB
17 // will not be closed automatically.
18 class CRYPTO_EXPORT_PRIVATE ScopedTestNSSDB {
19 public:
20 ScopedTestNSSDB();
21 ~ScopedTestNSSDB();
23 bool is_open() const { return slot_; }
24 PK11SlotInfo* slot() const { return slot_.get(); }
26 private:
27 base::ScopedTempDir temp_dir_;
28 ScopedPK11Slot slot_;
30 DISALLOW_COPY_AND_ASSIGN(ScopedTestNSSDB);
33 } // namespace crypto
35 #endif // CRYPTO_SCOPED_TEST_NSS_DB_H_