| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 scoped_ptr<base::DictionaryValue> onc = | 83 scoped_ptr<base::DictionaryValue> onc = |
| 84 test_utils::ReadTestDictionary(filename); | 84 test_utils::ReadTestDictionary(filename); |
| 85 base::ListValue* certificates; | 85 base::ListValue* certificates; |
| 86 onc->GetListWithoutPathExpansion(toplevel_config::kCertificates, | 86 onc->GetListWithoutPathExpansion(toplevel_config::kCertificates, |
| 87 &certificates); | 87 &certificates); |
| 88 | 88 |
| 89 base::DictionaryValue* certificate; | 89 base::DictionaryValue* certificate; |
| 90 certificates->GetDictionary(0, &certificate); | 90 certificates->GetDictionary(0, &certificate); |
| 91 certificate->GetStringWithoutPathExpansion(certificate::kGUID, guid); | 91 certificate->GetStringWithoutPathExpansion(certificate::kGUID, guid); |
| 92 | 92 |
| 93 CertificateImporter importer(ONC_SOURCE_USER_IMPORT, | 93 CertificateImporter importer(true /* allow web trust */); |
| 94 false /* don't allow web trust */); | |
| 95 EXPECT_EQ(CertificateImporter::IMPORT_OK, | 94 EXPECT_EQ(CertificateImporter::IMPORT_OK, |
| 96 importer.ParseAndStoreCertificates(*certificates)); | 95 importer.ParseAndStoreCertificates(*certificates)); |
| 97 | 96 |
| 98 net::CertificateList result_list; | 97 net::CertificateList result_list; |
| 99 CertificateImporter::ListCertsWithNickname(*guid, &result_list); | 98 CertificateImporter::ListCertsWithNickname(*guid, &result_list); |
| 100 ASSERT_EQ(1ul, result_list.size()); | 99 ASSERT_EQ(1ul, result_list.size()); |
| 101 EXPECT_EQ(expected_type, GetCertType(result_list[0]->os_cert_handle())); | 100 EXPECT_EQ(expected_type, GetCertType(result_list[0]->os_cert_handle())); |
| 102 } | 101 } |
| 103 | 102 |
| 104 scoped_refptr<net::CryptoModule> slot_; | 103 scoped_refptr<net::CryptoModule> slot_; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 std::make_pair(net::SERVER_CERT, | 252 std::make_pair(net::SERVER_CERT, |
| 254 std::make_pair("certificate-server.onc", | 253 std::make_pair("certificate-server.onc", |
| 255 "certificate-server-update.onc")), | 254 "certificate-server-update.onc")), |
| 256 std::make_pair( | 255 std::make_pair( |
| 257 net::CA_CERT, | 256 net::CA_CERT, |
| 258 std::make_pair("certificate-web-authority.onc", | 257 std::make_pair("certificate-web-authority.onc", |
| 259 "certificate-web-authority-update.onc")))); | 258 "certificate-web-authority-update.onc")))); |
| 260 | 259 |
| 261 } // namespace onc | 260 } // namespace onc |
| 262 } // namespace chromeos | 261 } // namespace chromeos |
| OLD | NEW |