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

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 to trunk after splitting out 4645001 Created 9 years, 11 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/crypto/scoped_nss_types.h" 10 #include "base/crypto/scoped_nss_types.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 certs_dir = certs_dir.AppendASCII("certificates"); 43 certs_dir = certs_dir.AppendASCII("certificates");
44 return certs_dir; 44 return certs_dir;
45 } 45 }
46 46
47 CertificateList ListCertsInSlot(PK11SlotInfo* slot) { 47 CertificateList ListCertsInSlot(PK11SlotInfo* slot) {
48 CertificateList result; 48 CertificateList result;
49 CERTCertList* cert_list = PK11_ListCertsInSlot(slot); 49 CERTCertList* cert_list = PK11_ListCertsInSlot(slot);
50 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list); 50 for (CERTCertListNode* node = CERT_LIST_HEAD(cert_list);
51 !CERT_LIST_END(node, cert_list); 51 !CERT_LIST_END(node, cert_list);
52 node = CERT_LIST_NEXT(node)) { 52 node = CERT_LIST_NEXT(node)) {
53 result.push_back( 53 result.push_back(X509Certificate::CreateFromHandle(
54 X509Certificate::CreateFromHandle( 54 node->cert, X509Certificate::OSCertHandles()));
55 node->cert,
56 X509Certificate::SOURCE_LONE_CERT_IMPORT,
57 X509Certificate::OSCertHandles()));
58 } 55 }
59 CERT_DestroyCertList(cert_list); 56 CERT_DestroyCertList(cert_list);
60 57
61 // Sort the result so that test comparisons can be deterministic. 58 // Sort the result so that test comparisons can be deterministic.
62 std::sort(result.begin(), result.end(), X509Certificate::LessThan()); 59 std::sort(result.begin(), result.end(), X509Certificate::LessThan());
63 return result; 60 return result;
64 } 61 }
65 62
66 bool CleanupSlotContents(PK11SlotInfo* slot) { 63 bool CleanupSlotContents(PK11SlotInfo* slot) {
67 CertDatabase cert_db; 64 CertDatabase cert_db;
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 puny_cert.get(), CA_CERT, 479 puny_cert.get(), CA_CERT,
483 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL)); 480 CertDatabase::TRUSTED_SSL | CertDatabase::TRUSTED_EMAIL));
484 481
485 verify_result.Reset(); 482 verify_result.Reset();
486 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result); 483 error = puny_cert->Verify("xn--wgv71a119e.com", flags, &verify_result);
487 EXPECT_EQ(OK, error); 484 EXPECT_EQ(OK, error);
488 EXPECT_EQ(0, verify_result.cert_status); 485 EXPECT_EQ(0, verify_result.cert_status);
489 } 486 }
490 487
491 } // namespace net 488 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698