Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Side by Side Diff: net/base/cert_database_nss_unittest.cc

Issue 2944008: Refactor X509Certificate caching to cache the OS handle, rather than the X509Certificate (Closed)
Patch Set: Rebase before commit Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/cert_database_nss.cc ('k') | net/base/x509_certificate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <cert.h> 5 #include <cert.h>
6 #include <pk11pub.h> 6 #include <pk11pub.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 certs_dir = certs_dir.AppendASCII("certificates"); 44 certs_dir = certs_dir.AppendASCII("certificates");
45 return certs_dir; 45 return certs_dir;
46 } 46 }
47 47
48 CertificateList ListCertsInSlot(PK11SlotInfo* slot) { 48 CertificateList ListCertsInSlot(PK11SlotInfo* slot) {
49 CertificateList result; 49 CertificateList result;
50 CERTCertList* cert_list = PK11_ListCertsInSlot(slot); 50 CERTCertList* cert_list = PK11_ListCertsInSlot(slot);
51 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); 51 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list);
52 !CERT_LIST_END(node, cert_list); 52 !CERT_LIST_END(node, cert_list);
53 node = CERT_LIST_NEXT(node)) { 53 node = CERT_LIST_NEXT(node)) {
54 result.push_back( 54 result.push_back(X509Certificate::CreateFromHandle(
55 X509Certificate::CreateFromHandle( 55 node->cert, X509Certificate::OSCertHandles()));
56 node->cert,
57 X509Certificate::SOURCE_LONE_CERT_IMPORT,
58 X509Certificate::OSCertHandles()));
59 } 56 }
60 CERT_DestroyCertList(cert_list); 57 CERT_DestroyCertList(cert_list);
61 58
62 // Sort the result so that test comparisons can be deterministic. 59 // Sort the result so that test comparisons can be deterministic.
63 std::sort(result.begin(), result.end(), X509Certificate::LessThan()); 60 std::sort(result.begin(), result.end(), X509Certificate::LessThan());
64 return result; 61 return result;
65 } 62 }
66 63
67 bool CleanupSlotContents(PK11SlotInfo* slot) { 64 bool CleanupSlotContents(PK11SlotInfo* slot) {
68 CertDatabase cert_db; 65 CertDatabase cert_db;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 puny_cert.get(), CA_CERT, 546 puny_cert.get(), CA_CERT,
550 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL)); 547 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL));
551 548
552 verify_result.Reset(); 549 verify_result.Reset();
553 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result); 550 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result);
554 EXPECT_EQ(OK, error); 551 EXPECT_EQ(OK, error);
555 EXPECT_EQ(0, verify_result.cert_status); 552 EXPECT_EQ(0, verify_result.cert_status);
556 } 553 }
557 554
558 } // namespace net 555 } // namespace net
OLDNEW
« no previous file with comments | « net/base/cert_database_nss.cc ('k') | net/base/x509_certificate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698