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

Unified Diff: chromeos/cert_loader_unittest.cc

Issue 193273002: Handle cases when user cert database has NULL slots (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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
« no previous file with comments | « chromeos/cert_loader.cc ('k') | chromeos/network/onc/onc_certificate_importer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/cert_loader_unittest.cc
diff --git a/chromeos/cert_loader_unittest.cc b/chromeos/cert_loader_unittest.cc
index 57def93e963dca73bc918ec4c8e0fdf414f92408..fc47704a34c3257682fb662c5de5794e81255c6a 100644
--- a/chromeos/cert_loader_unittest.cc
+++ b/chromeos/cert_loader_unittest.cc
@@ -11,6 +11,7 @@
#include "base/run_loop.h"
#include "crypto/nss_util.h"
#include "crypto/nss_util_internal.h"
+#include "crypto/scoped_nss_types.h"
#include "net/base/net_errors.h"
#include "net/base/test_data_directory.h"
#include "net/cert/nss_cert_database_chromeos.h"
@@ -304,5 +305,19 @@ TEST_F(CertLoaderTest, UpdatedOnCACertTrustChange) {
EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount());
}
+TEST_F(CertLoaderTest, DatabaseWithUnsetSlots) {
+ primary_db_.reset(new net::NSSCertDatabaseChromeOS(crypto::ScopedPK11Slot(),
+ crypto::ScopedPK11Slot()));
+ primary_db_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy());
+ cert_loader_->StartWithNSSDB(primary_db_.get());
+
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(1u, GetAndResetCertificatesLoadedEventsCount());
+
+ EXPECT_TRUE(cert_loader_->certificates_loaded());
+ EXPECT_EQ(-1, cert_loader_->TPMTokenSlotID());
+ EXPECT_FALSE(cert_loader_->IsHardwareBacked());
+}
+
} // namespace
} // namespace chromeos
« no previous file with comments | « chromeos/cert_loader.cc ('k') | chromeos/network/onc/onc_certificate_importer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698