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

Side by Side Diff: net/cert/test_root_certs_nss.cc

Issue 2229393003: net: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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/cert/multi_threaded_cert_verifier.cc ('k') | net/cert_net/cert_net_fetcher_impl.cc » ('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 "net/cert/test_root_certs.h" 5 #include "net/cert/test_root_certs.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 it != trust_cache_.rend(); ++it) { 101 it != trust_cache_.rend(); ++it) {
102 CERTCertTrust original_trust = (*it)->trust(); 102 CERTCertTrust original_trust = (*it)->trust();
103 SECStatus rv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), 103 SECStatus rv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(),
104 (*it)->certificate(), 104 (*it)->certificate(),
105 &original_trust); 105 &original_trust);
106 // DCHECK(), rather than LOG(), as a failure to restore the original 106 // DCHECK(), rather than LOG(), as a failure to restore the original
107 // trust can cause flake or hard-to-trace errors in any unit tests that 107 // trust can cause flake or hard-to-trace errors in any unit tests that
108 // occur after Clear() has been called. 108 // occur after Clear() has been called.
109 DCHECK_EQ(SECSuccess, rv) << "Cannot restore certificate trust."; 109 DCHECK_EQ(SECSuccess, rv) << "Cannot restore certificate trust.";
110 } 110 }
111 STLDeleteElements(&trust_cache_); 111 base::STLDeleteElements(&trust_cache_);
112 } 112 }
113 113
114 bool TestRootCerts::IsEmpty() const { 114 bool TestRootCerts::IsEmpty() const {
115 return trust_cache_.empty(); 115 return trust_cache_.empty();
116 } 116 }
117 117
118 #if defined(USE_NSS_CERTS) 118 #if defined(USE_NSS_CERTS)
119 bool TestRootCerts::Contains(CERTCertificate* cert) const { 119 bool TestRootCerts::Contains(CERTCertificate* cert) const {
120 for (std::list<TrustEntry*>::const_iterator it = trust_cache_.begin(); 120 for (std::list<TrustEntry*>::const_iterator it = trust_cache_.begin();
121 it != trust_cache_.end(); ++it) { 121 it != trust_cache_.end(); ++it) {
122 if (X509Certificate::IsSameOSCert(cert, (*it)->certificate())) 122 if (X509Certificate::IsSameOSCert(cert, (*it)->certificate()))
123 return true; 123 return true;
124 } 124 }
125 return false; 125 return false;
126 } 126 }
127 #endif 127 #endif
128 128
129 TestRootCerts::~TestRootCerts() { 129 TestRootCerts::~TestRootCerts() {
130 Clear(); 130 Clear();
131 } 131 }
132 132
133 void TestRootCerts::Init() { 133 void TestRootCerts::Init() {
134 crypto::EnsureNSSInit(); 134 crypto::EnsureNSSInit();
135 } 135 }
136 136
137 } // namespace net 137 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/multi_threaded_cert_verifier.cc ('k') | net/cert_net/cert_net_fetcher_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698