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

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: Rebased. 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 71e12646693f9745650b002352af8f70b17f0d3c..ffa61744f5c8416332b0edc5d862916cbd8e442e 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 */));
public_module_ = cert_db_->GetPublicModule();
// Test db should be empty at start of test.
@@ -99,9 +100,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