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

Unified Diff: net/cert/nss_cert_database_unittest.cc

Issue 401623006: Extract ScopedTestNSSDB from nss_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a DCHECK to SetTestSystemKeySlot. 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: net/cert/nss_cert_database_unittest.cc
diff --git a/net/cert/nss_cert_database_unittest.cc b/net/cert/nss_cert_database_unittest.cc
index f422ef81dfb0af497bb7c73d4b5ade2d19d2f16a..75d54e5e5dcbf9c18887c749ee95f04e6cb0ab88 100644
--- a/net/cert/nss_cert_database_unittest.cc
+++ b/net/cert/nss_cert_database_unittest.cc
@@ -19,9 +19,8 @@
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "crypto/nss_util.h"
-#include "crypto/nss_util_internal.h"
#include "crypto/scoped_nss_types.h"
+#include "crypto/scoped_test_nss_db.h"
#include "net/base/crypto_module.h"
#include "net/base/net_errors.h"
#include "net/base/test_data_directory.h"
@@ -59,8 +58,10 @@ class CertDatabaseNSSTest : public testing::Test {
virtual void SetUp() {
ASSERT_TRUE(test_nssdb_.is_open());
cert_db_.reset(new NSSCertDatabase(
- crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot()),
- crypto::ScopedPK11Slot(crypto::GetPersistentNSSKeySlot())));
+ crypto::ScopedPK11Slot(
+ PK11_ReferenceSlot(test_nssdb_.slot())) /* public slot */,
+ crypto::ScopedPK11Slot(
+ PK11_ReferenceSlot(test_nssdb_.slot())) /* private slot */));
// Test db should be empty at start of test.
EXPECT_EQ(0U, ListCerts().size());
@@ -98,9 +99,7 @@ class CertDatabaseNSSTest : public testing::Test {
CertificateList ListCerts() {
CertificateList result;
-
- CERTCertList* cert_list =
- PK11_ListCertsInSlot(cert_db_->GetPublicSlot().get());
+ CERTCertList* cert_list = PK11_ListCertsInSlot(test_nssdb_.slot());
for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list);
!CERT_LIST_END(node, cert_list);
node = CERT_LIST_NEXT(node)) {

Powered by Google App Engine
This is Rietveld 408576698