Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: crypto/scoped_test_nss_db.h

Issue 401623006: Extract ScopedTestNSSDB from nss_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl format Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: crypto/scoped_test_nss_db.h
diff --git a/crypto/scoped_test_nss_db.h b/crypto/scoped_test_nss_db.h
new file mode 100644
index 0000000000000000000000000000000000000000..63dfaaa8b9565261f946f72946205974c3eaea75
--- /dev/null
+++ b/crypto/scoped_test_nss_db.h
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CRYPTO_SCOPED_TEST_NSS_DB_H_
+#define CRYPTO_SCOPED_TEST_NSS_DB_H_
+
+#include "base/files/scoped_temp_dir.h"
+#include "base/macros.h"
+#include "crypto/crypto_export.h"
+#include "crypto/scoped_nss_types.h"
+
+namespace crypto {
+
+#if defined(USE_NSS)
Ryan Sleevi 2014/07/22 01:25:32 Use source controls to exclude this. Don't #ifdef.
pneubeck (no reviews) 2014/07/22 14:11:05 Done. I also added it to a new target crypto_test_
+// Exposed for tests only.
+// Opens a persistent NSS database in a temporary directory.
+// TODO(mattm): When NSS 3.14 is the minimum version required,
+// switch back to using a separate user DB for each test.
+// Because of https://bugzilla.mozilla.org/show_bug.cgi?id=588269 , the
+// opened user DB is not automatically closed.
Ryan Sleevi 2014/07/22 01:25:32 Update this comment to 3.15.1 (we require 3.14.3,
pneubeck (no reviews) 2014/07/22 06:23:27 Actually, I'm not sure that I understand the part
Ryan Sleevi 2014/07/22 08:35:09 Followed-up offline, but for posterity: Prior to
pneubeck (no reviews) 2014/07/22 14:11:05 This comment didn't apply anymore. Updated the com
+class CRYPTO_EXPORT_PRIVATE ScopedTestNSSDB {
+ public:
+ ScopedTestNSSDB();
+ ~ScopedTestNSSDB();
+
+ bool is_open() { return slot_; }
+ PK11SlotInfo* slot() { return slot_.get(); }
+
+ private:
+ base::ScopedTempDir temp_dir_;
+ ScopedPK11Slot slot_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedTestNSSDB);
+};
+#endif
+
+} // namespace crypto
+
+#endif // CRYPTO_SCOPED_TEST_NSS_DB_H_

Powered by Google App Engine
This is Rietveld 408576698