| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 virtual ~ONCCertificateImporterTest() {} | 77 virtual ~ONCCertificateImporterTest() {} |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 void AddCertificateFromFile(std::string filename, | 80 void AddCertificateFromFile(std::string filename, |
| 81 net::CertType expected_type, | 81 net::CertType expected_type, |
| 82 std::string* guid) { | 82 std::string* guid) { |
| 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(kCertificates, &certificates); | 86 onc->GetListWithoutPathExpansion(toplevel_config::kCertificates, |
| 87 &certificates); |
| 87 | 88 |
| 88 base::DictionaryValue* certificate; | 89 base::DictionaryValue* certificate; |
| 89 certificates->GetDictionary(0, &certificate); | 90 certificates->GetDictionary(0, &certificate); |
| 90 certificate->GetStringWithoutPathExpansion(kGUID, guid); | 91 certificate->GetStringWithoutPathExpansion(certificate::kGUID, guid); |
| 91 | 92 |
| 92 CertificateImporter importer(ONC_SOURCE_USER_IMPORT, | 93 CertificateImporter importer(ONC_SOURCE_USER_IMPORT, |
| 93 false /* don't allow web trust */); | 94 false /* don't allow web trust */); |
| 94 EXPECT_EQ(CertificateImporter::IMPORT_OK, | 95 EXPECT_EQ(CertificateImporter::IMPORT_OK, |
| 95 importer.ParseAndStoreCertificates(*certificates)); | 96 importer.ParseAndStoreCertificates(*certificates)); |
| 96 | 97 |
| 97 net::CertificateList result_list; | 98 net::CertificateList result_list; |
| 98 CertificateImporter::ListCertsWithNickname(*guid, &result_list); | 99 CertificateImporter::ListCertsWithNickname(*guid, &result_list); |
| 99 ASSERT_EQ(1ul, result_list.size()); | 100 ASSERT_EQ(1ul, result_list.size()); |
| 100 EXPECT_EQ(expected_type, GetCertType(result_list[0]->os_cert_handle())); | 101 EXPECT_EQ(expected_type, GetCertType(result_list[0]->os_cert_handle())); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 std::make_pair(net::SERVER_CERT, | 253 std::make_pair(net::SERVER_CERT, |
| 253 std::make_pair("certificate-server.onc", | 254 std::make_pair("certificate-server.onc", |
| 254 "certificate-server-update.onc")), | 255 "certificate-server-update.onc")), |
| 255 std::make_pair( | 256 std::make_pair( |
| 256 net::CA_CERT, | 257 net::CA_CERT, |
| 257 std::make_pair("certificate-web-authority.onc", | 258 std::make_pair("certificate-web-authority.onc", |
| 258 "certificate-web-authority-update.onc")))); | 259 "certificate-web-authority-update.onc")))); |
| 259 | 260 |
| 260 } // namespace onc | 261 } // namespace onc |
| 261 } // namespace chromeos | 262 } // namespace chromeos |
| OLD | NEW |