| 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 "net/cert/test_root_certs.h" | 5 #include "net/cert/test_root_certs.h" | 
| 6 | 6 | 
| 7 #include <stdint.h> | 7 #include <stdint.h> | 
| 8 | 8 | 
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 141   // Ensure that the default CryptoAPI functionality has been intercepted. | 141   // Ensure that the default CryptoAPI functionality has been intercepted. | 
| 142   // If a test certificate is never added, then no interception should | 142   // If a test certificate is never added, then no interception should | 
| 143   // happen. | 143   // happen. | 
| 144   g_capi_injector.Get(); | 144   g_capi_injector.Get(); | 
| 145 | 145 | 
| 146   BOOL ok = CertAddCertificateContextToStore( | 146   BOOL ok = CertAddCertificateContextToStore( | 
| 147       temporary_roots_, certificate->os_cert_handle(), | 147       temporary_roots_, certificate->os_cert_handle(), | 
| 148       CERT_STORE_ADD_NEW, NULL); | 148       CERT_STORE_ADD_NEW, NULL); | 
| 149   if (!ok) { | 149   if (!ok) { | 
| 150     // If the certificate is already added, return successfully. | 150     // If the certificate is already added, return successfully. | 
| 151     return GetLastError() == CRYPT_E_EXISTS; | 151     return GetLastError() == static_cast<DWORD>(CRYPT_E_EXISTS); | 
| 152   } | 152   } | 
| 153 | 153 | 
| 154   empty_ = false; | 154   empty_ = false; | 
| 155   return true; | 155   return true; | 
| 156 } | 156 } | 
| 157 | 157 | 
| 158 void TestRootCerts::Clear() { | 158 void TestRootCerts::Clear() { | 
| 159   empty_ = true; | 159   empty_ = true; | 
| 160 | 160 | 
| 161   for (PCCERT_CONTEXT prev_cert = | 161   for (PCCERT_CONTEXT prev_cert = | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 204 | 204 | 
| 205 void TestRootCerts::Init() { | 205 void TestRootCerts::Init() { | 
| 206   empty_ = true; | 206   empty_ = true; | 
| 207   temporary_roots_ = CertOpenStore( | 207   temporary_roots_ = CertOpenStore( | 
| 208       CERT_STORE_PROV_MEMORY, 0, NULL, | 208       CERT_STORE_PROV_MEMORY, 0, NULL, | 
| 209       CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); | 209       CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG, NULL); | 
| 210   DCHECK(temporary_roots_); | 210   DCHECK(temporary_roots_); | 
| 211 } | 211 } | 
| 212 | 212 | 
| 213 }  // namespace net | 213 }  // namespace net | 
| OLD | NEW | 
|---|