OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/cert_loader.h" | 5 #include "chromeos/cert_loader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 primary_db_->GetCertTrust(certs[0], net::CA_CERT)); | 298 primary_db_->GetCertTrust(certs[0], net::CA_CERT)); |
299 ASSERT_TRUE(primary_db_->SetCertTrust( | 299 ASSERT_TRUE(primary_db_->SetCertTrust( |
300 certs[0], net::CA_CERT, net::NSSCertDatabase::TRUSTED_SSL)); | 300 certs[0], net::CA_CERT, net::NSSCertDatabase::TRUSTED_SSL)); |
301 | 301 |
302 // Cert trust change should trigger certificate reload in cert_loader_. | 302 // Cert trust change should trigger certificate reload in cert_loader_. |
303 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); | 303 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); |
304 base::RunLoop().RunUntilIdle(); | 304 base::RunLoop().RunUntilIdle(); |
305 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); | 305 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); |
306 } | 306 } |
307 | 307 |
308 TEST_F(CertLoaderTest, DatabaseWithUnsetSlots) { | |
309 primary_db_.reset(new net::NSSCertDatabaseChromeOS(crypto::ScopedPK11Slot(), | |
310 crypto::ScopedPK11Slot())); | |
311 primary_db_->SetSlowTaskRunnerForTest(message_loop_.message_loop_proxy()); | |
312 cert_loader_->StartWithNSSDB(primary_db_.get()); | |
313 | |
314 base::RunLoop().RunUntilIdle(); | |
315 EXPECT_EQ(1u, GetAndResetCertificatesLoadedEventsCount()); | |
316 | |
317 EXPECT_TRUE(cert_loader_->certificates_loaded()); | |
318 EXPECT_EQ(-1, cert_loader_->TPMTokenSlotID()); | |
319 EXPECT_FALSE(cert_loader_->IsHardwareBacked()); | |
320 } | |
321 | |
322 } // namespace | 308 } // namespace |
323 } // namespace chromeos | 309 } // namespace chromeos |
OLD | NEW |