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/files/file_util.h" | 8 #include "base/files/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // parameter (which is irrelevant for these tests). | 165 // parameter (which is irrelevant for these tests). |
166 crypto::ScopedTestNSSChromeOSUser primary_user_; | 166 crypto::ScopedTestNSSChromeOSUser primary_user_; |
167 scoped_ptr<net::NSSCertDatabaseChromeOS> primary_db_; | 167 scoped_ptr<net::NSSCertDatabaseChromeOS> primary_db_; |
168 | 168 |
169 base::MessageLoop message_loop_; | 169 base::MessageLoop message_loop_; |
170 | 170 |
171 private: | 171 private: |
172 size_t certificates_loaded_events_count_; | 172 size_t certificates_loaded_events_count_; |
173 }; | 173 }; |
174 | 174 |
| 175 // http://crbug.com/418369 |
| 176 #ifndef NDEBUG |
175 TEST_F(CertLoaderTest, Basic) { | 177 TEST_F(CertLoaderTest, Basic) { |
176 EXPECT_FALSE(cert_loader_->CertificatesLoading()); | 178 EXPECT_FALSE(cert_loader_->CertificatesLoading()); |
177 EXPECT_FALSE(cert_loader_->certificates_loaded()); | 179 EXPECT_FALSE(cert_loader_->certificates_loaded()); |
178 EXPECT_FALSE(cert_loader_->IsHardwareBacked()); | 180 EXPECT_FALSE(cert_loader_->IsHardwareBacked()); |
179 | 181 |
180 FinishUserInitAndGetDatabase(&primary_user_, &primary_db_); | 182 FinishUserInitAndGetDatabase(&primary_user_, &primary_db_); |
181 | 183 |
182 cert_loader_->StartWithNSSDB(primary_db_.get()); | 184 cert_loader_->StartWithNSSDB(primary_db_.get()); |
183 | 185 |
184 EXPECT_FALSE(cert_loader_->certificates_loaded()); | 186 EXPECT_FALSE(cert_loader_->certificates_loaded()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 primary_db_->GetCertTrust(certs[0].get(), net::CA_CERT)); | 308 primary_db_->GetCertTrust(certs[0].get(), net::CA_CERT)); |
307 ASSERT_TRUE(primary_db_->SetCertTrust( | 309 ASSERT_TRUE(primary_db_->SetCertTrust( |
308 certs[0].get(), net::CA_CERT, net::NSSCertDatabase::TRUSTED_SSL)); | 310 certs[0].get(), net::CA_CERT, net::NSSCertDatabase::TRUSTED_SSL)); |
309 | 311 |
310 // Cert trust change should trigger certificate reload in cert_loader_. | 312 // Cert trust change should trigger certificate reload in cert_loader_. |
311 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); | 313 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); |
312 base::RunLoop().RunUntilIdle(); | 314 base::RunLoop().RunUntilIdle(); |
313 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); | 315 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); |
314 } | 316 } |
315 | 317 |
| 318 #endif |
| 319 |
316 } // namespace | 320 } // namespace |
317 } // namespace chromeos | 321 } // namespace chromeos |
OLD | NEW |