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

Unified Diff: chrome/common/net/x509_certificate_model_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: chrome/common/net/x509_certificate_model_unittest.cc
diff --git a/chrome/common/net/x509_certificate_model_unittest.cc b/chrome/common/net/x509_certificate_model_unittest.cc
index 8d010d77a60b583f7a2bd21ab64e9f0985e22a5c..37f3fe487a41ebff70f88028ae0cb7bdae3ebf87 100644
--- a/chrome/common/net/x509_certificate_model_unittest.cc
+++ b/chrome/common/net/x509_certificate_model_unittest.cc
@@ -11,7 +11,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_NSS)
-#include "crypto/nss_util_internal.h"
+#include "crypto/scoped_test_nss_db.h"
#include "net/cert/nss_cert_database.h"
#endif
@@ -224,12 +224,11 @@ TEST(X509CertificateModelTest, GetTypeCA) {
EXPECT_EQ(net::CA_CERT,
x509_certificate_model::GetType(cert->os_cert_handle()));
- // Additional parantheses required to disambiguate from function declaration.
- net::NSSCertDatabase db(
- (crypto::ScopedPK11Slot(
- crypto::GetPersistentNSSKeySlot())) /* public slot */,
- crypto::ScopedPK11Slot(
- crypto::GetPersistentNSSKeySlot()) /* private lot */);
+ crypto::ScopedTestNSSDB test_nssdb;
+ net::NSSCertDatabase db(crypto::ScopedPK11Slot(PK11_ReferenceSlot(
+ test_nssdb.slot())) /* public slot */,
+ crypto::ScopedPK11Slot(PK11_ReferenceSlot(
+ test_nssdb.slot())) /* private slot */);
// Test that explicitly distrusted CA certs are still returned as CA_CERT
// type. See http://crbug.com/96654.
@@ -259,12 +258,11 @@ TEST(X509CertificateModelTest, GetTypeServer) {
EXPECT_EQ(net::OTHER_CERT,
x509_certificate_model::GetType(cert->os_cert_handle()));
- // Additional parantheses required to disambiguate from function declaration.
- net::NSSCertDatabase db(
- (crypto::ScopedPK11Slot(
- crypto::GetPersistentNSSKeySlot())) /* public slot */,
- crypto::ScopedPK11Slot(
- crypto::GetPersistentNSSKeySlot()) /* private lot */);
+ crypto::ScopedTestNSSDB test_nssdb;
+ net::NSSCertDatabase db(crypto::ScopedPK11Slot(PK11_ReferenceSlot(
+ test_nssdb.slot())) /* public slot */,
+ crypto::ScopedPK11Slot(PK11_ReferenceSlot(
+ test_nssdb.slot())) /* private slot */);
// Test GetCertType with server certs and explicit trust.
EXPECT_TRUE(db.SetCertTrust(

Powered by Google App Engine
This is Rietveld 408576698