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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(kCertificates, &certificates); |
87 | 87 |
88 base::DictionaryValue* certificate; | 88 base::DictionaryValue* certificate; |
89 certificates->GetDictionary(0, &certificate); | 89 certificates->GetDictionary(0, &certificate); |
90 certificate->GetStringWithoutPathExpansion(kGUID, guid); | 90 certificate->GetStringWithoutPathExpansion(network_config::kGUID, guid); |
pneubeck (no reviews)
2013/01/18 10:27:41
(onc::)kGUID, see comment in onc_constant.h
| |
91 | 91 |
92 CertificateImporter importer(ONC_SOURCE_USER_IMPORT, | 92 CertificateImporter importer(ONC_SOURCE_USER_IMPORT, |
93 false /* don't allow web trust */); | 93 false /* don't allow web trust */); |
94 EXPECT_EQ(CertificateImporter::IMPORT_OK, | 94 EXPECT_EQ(CertificateImporter::IMPORT_OK, |
95 importer.ParseAndStoreCertificates(*certificates)); | 95 importer.ParseAndStoreCertificates(*certificates)); |
96 | 96 |
97 net::CertificateList result_list; | 97 net::CertificateList result_list; |
98 CertificateImporter::ListCertsWithNickname(*guid, &result_list); | 98 CertificateImporter::ListCertsWithNickname(*guid, &result_list); |
99 ASSERT_EQ(1ul, result_list.size()); | 99 ASSERT_EQ(1ul, result_list.size()); |
100 EXPECT_EQ(expected_type, GetCertType(result_list[0]->os_cert_handle())); | 100 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, | 252 std::make_pair(net::SERVER_CERT, |
253 std::make_pair("certificate-server.onc", | 253 std::make_pair("certificate-server.onc", |
254 "certificate-server-update.onc")), | 254 "certificate-server-update.onc")), |
255 std::make_pair( | 255 std::make_pair( |
256 net::CA_CERT, | 256 net::CA_CERT, |
257 std::make_pair("certificate-web-authority.onc", | 257 std::make_pair("certificate-web-authority.onc", |
258 "certificate-web-authority-update.onc")))); | 258 "certificate-web-authority-update.onc")))); |
259 | 259 |
260 } // namespace onc | 260 } // namespace onc |
261 } // namespace chromeos | 261 } // namespace chromeos |
OLD | NEW |