OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/network/onc/onc_certificate_importer.h" | 5 #include "chromeos/network/onc/onc_certificate_importer.h" |
6 | 6 |
7 #include <cert.h> | 7 #include <cert.h> |
8 #include <certdb.h> | 8 #include <certdb.h> |
9 #include <keyhi.h> | 9 #include <keyhi.h> |
10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 // Sort the result so that test comparisons can be deterministic. | 134 // Sort the result so that test comparisons can be deterministic. |
135 std::sort(result.begin(), result.end(), net::X509Certificate::LessThan()); | 135 std::sort(result.begin(), result.end(), net::X509Certificate::LessThan()); |
136 return result; | 136 return result; |
137 } | 137 } |
138 | 138 |
139 bool CleanupSlotContents() { | 139 bool CleanupSlotContents() { |
140 bool ok = true; | 140 bool ok = true; |
141 net::CertificateList certs = ListCertsInSlot(); | 141 net::CertificateList certs = ListCertsInSlot(); |
142 for (size_t i = 0; i < certs.size(); ++i) { | 142 for (size_t i = 0; i < certs.size(); ++i) { |
143 if (!net::NSSCertDatabase::GetInstance()->DeleteCertAndKey(certs[i])) | 143 if (!net::NSSCertDatabase::GetInstance()->DeleteCertAndKey(certs[i] |
| 144 .get())) |
144 ok = false; | 145 ok = false; |
145 } | 146 } |
146 return ok; | 147 return ok; |
147 } | 148 } |
148 | 149 |
149 crypto::ScopedTestNSSDB test_nssdb_; | 150 crypto::ScopedTestNSSDB test_nssdb_; |
150 }; | 151 }; |
151 | 152 |
152 TEST_F(ONCCertificateImporterTest, MultipleCertificates) { | 153 TEST_F(ONCCertificateImporterTest, MultipleCertificates) { |
153 AddCertificatesFromFile("managed_toplevel2.onc", | 154 AddCertificatesFromFile("managed_toplevel2.onc", |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 "certificate-client-update.onc"), | 307 "certificate-client-update.onc"), |
307 CertParam(net::SERVER_CERT, | 308 CertParam(net::SERVER_CERT, |
308 "certificate-server.onc", | 309 "certificate-server.onc", |
309 "certificate-server-update.onc"), | 310 "certificate-server-update.onc"), |
310 CertParam(net::CA_CERT, | 311 CertParam(net::CA_CERT, |
311 "certificate-web-authority.onc", | 312 "certificate-web-authority.onc", |
312 "certificate-web-authority-update.onc"))); | 313 "certificate-web-authority-update.onc"))); |
313 | 314 |
314 } // namespace onc | 315 } // namespace onc |
315 } // namespace chromeos | 316 } // namespace chromeos |
OLD | NEW |