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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
14 #include "crypto/scoped_nss_types.h" | 15 #include "crypto/scoped_nss_types.h" |
15 #include "crypto/scoped_test_nss_db.h" | 16 #include "crypto/scoped_test_nss_db.h" |
16 #include "net/base/test_data_directory.h" | 17 #include "net/base/test_data_directory.h" |
17 #include "net/cert/nss_cert_database_chromeos.h" | 18 #include "net/cert/nss_cert_database_chromeos.h" |
(...skipping 14 matching lines...) Expand all Loading... |
32 return true; | 33 return true; |
33 } | 34 } |
34 } | 35 } |
35 return false; | 36 return false; |
36 } | 37 } |
37 | 38 |
38 class TestNSSCertDatabase : public net::NSSCertDatabaseChromeOS { | 39 class TestNSSCertDatabase : public net::NSSCertDatabaseChromeOS { |
39 public: | 40 public: |
40 TestNSSCertDatabase(crypto::ScopedPK11Slot public_slot, | 41 TestNSSCertDatabase(crypto::ScopedPK11Slot public_slot, |
41 crypto::ScopedPK11Slot private_slot) | 42 crypto::ScopedPK11Slot private_slot) |
42 : NSSCertDatabaseChromeOS(public_slot.Pass(), private_slot.Pass()) {} | 43 : NSSCertDatabaseChromeOS(std::move(public_slot), |
| 44 std::move(private_slot)) {} |
43 ~TestNSSCertDatabase() override {} | 45 ~TestNSSCertDatabase() override {} |
44 | 46 |
45 void NotifyOfCertAdded(const net::X509Certificate* cert) { | 47 void NotifyOfCertAdded(const net::X509Certificate* cert) { |
46 NSSCertDatabaseChromeOS::NotifyObserversOfCertAdded(cert); | 48 NSSCertDatabaseChromeOS::NotifyObserversOfCertAdded(cert); |
47 } | 49 } |
48 }; | 50 }; |
49 | 51 |
50 class CertLoaderTest : public testing::Test, | 52 class CertLoaderTest : public testing::Test, |
51 public CertLoader::Observer { | 53 public CertLoader::Observer { |
52 public: | 54 public: |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 ASSERT_TRUE(primary_certdb_->SetCertTrust(certs[0].get(), net::CA_CERT, | 276 ASSERT_TRUE(primary_certdb_->SetCertTrust(certs[0].get(), net::CA_CERT, |
275 net::NSSCertDatabase::TRUSTED_SSL)); | 277 net::NSSCertDatabase::TRUSTED_SSL)); |
276 | 278 |
277 // Cert trust change should trigger certificate reload in cert_loader_. | 279 // Cert trust change should trigger certificate reload in cert_loader_. |
278 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); | 280 ASSERT_EQ(0U, GetAndResetCertificatesLoadedEventsCount()); |
279 base::RunLoop().RunUntilIdle(); | 281 base::RunLoop().RunUntilIdle(); |
280 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); | 282 EXPECT_EQ(1U, GetAndResetCertificatesLoadedEventsCount()); |
281 } | 283 } |
282 | 284 |
283 } // namespace chromeos | 285 } // namespace chromeos |
OLD | NEW |