summaryrefslogtreecommitdiffstats
path: root/chromeos/cert_loader_unittest.cc
diff options
context:
space:
mode:
authortbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 01:29:11 +0000
committertbarzic@chromium.org <tbarzic@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-18 01:29:11 +0000
commit16dad0967576c62544c6693d8b517a733b578c75 (patch)
tree4964b47efbb6bf4383b64e5879eda3bf370e4937 /chromeos/cert_loader_unittest.cc
parent7078c49eb20ebef4eade402b98da8ae9586e3ea1 (diff)
downloadchromium_src-16dad0967576c62544c6693d8b517a733b578c75.zip
chromium_src-16dad0967576c62544c6693d8b517a733b578c75.tar.gz
chromium_src-16dad0967576c62544c6693d8b517a733b578c75.tar.bz2
Handle cases when user cert database has NULL slots
The slots can be NULL if the user's username hash is empty string (e.g. in retail mode) BUG=349085,340505 TEST= Retail mode does not immediately restart (i.e. no crash). In retail mode, go to chrome://settings/certificates -> buttons for importing certs should be disabled Review URL: https://codereview.chromium.org/193273002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257570 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/cert_loader_unittest.cc')
-rw-r--r--chromeos/cert_loader_unittest.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/chromeos/cert_loader_unittest.cc b/chromeos/cert_loader_unittest.cc
index 57def93..fc47704 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