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

Side by Side Diff: chromeos/network/onc/onc_certificate_importer_impl_unittest.cc

Issue 1082123003: Rename USE_NSS to USE_NSS_CERTS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-nss-certs
Patch Set: rebase Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_impl.h" 5 #include "chromeos/network/onc/onc_certificate_importer_impl.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 12 matching lines...) Expand all
23 #include "net/cert/cert_type.h" 23 #include "net/cert/cert_type.h"
24 #include "net/cert/nss_cert_database_chromeos.h" 24 #include "net/cert/nss_cert_database_chromeos.h"
25 #include "net/cert/x509_certificate.h" 25 #include "net/cert/x509_certificate.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 namespace chromeos { 28 namespace chromeos {
29 namespace onc { 29 namespace onc {
30 30
31 namespace { 31 namespace {
32 32
33 #if defined(USE_NSS) 33 #if defined(USE_NSS_CERTS)
34 // In NSS 3.13, CERTDB_VALID_PEER was renamed CERTDB_TERMINAL_RECORD. So we use 34 // In NSS 3.13, CERTDB_VALID_PEER was renamed CERTDB_TERMINAL_RECORD. So we use
35 // the new name of the macro. 35 // the new name of the macro.
36 #if !defined(CERTDB_TERMINAL_RECORD) 36 #if !defined(CERTDB_TERMINAL_RECORD)
37 #define CERTDB_TERMINAL_RECORD CERTDB_VALID_PEER 37 #define CERTDB_TERMINAL_RECORD CERTDB_VALID_PEER
38 #endif 38 #endif
39 39
40 net::CertType GetCertType(net::X509Certificate::OSCertHandle cert) { 40 net::CertType GetCertType(net::X509Certificate::OSCertHandle cert) {
41 CERTCertTrust trust = {0}; 41 CERTCertTrust trust = {0};
42 CERT_GetCertTrust(cert, &trust); 42 CERT_GetCertTrust(cert, &trust);
43 43
44 unsigned all_flags = trust.sslFlags | trust.emailFlags | 44 unsigned all_flags = trust.sslFlags | trust.emailFlags |
45 trust.objectSigningFlags; 45 trust.objectSigningFlags;
46 46
47 if (cert->nickname && (all_flags & CERTDB_USER)) 47 if (cert->nickname && (all_flags & CERTDB_USER))
48 return net::USER_CERT; 48 return net::USER_CERT;
49 if ((all_flags & CERTDB_VALID_CA) || CERT_IsCACert(cert, NULL)) 49 if ((all_flags & CERTDB_VALID_CA) || CERT_IsCACert(cert, NULL))
50 return net::CA_CERT; 50 return net::CA_CERT;
51 // TODO(mattm): http://crbug.com/128633. 51 // TODO(mattm): http://crbug.com/128633.
52 if (trust.sslFlags & CERTDB_TERMINAL_RECORD) 52 if (trust.sslFlags & CERTDB_TERMINAL_RECORD)
53 return net::SERVER_CERT; 53 return net::SERVER_CERT;
54 return net::OTHER_CERT; 54 return net::OTHER_CERT;
55 } 55 }
56 #else 56 #else
57 net::CertType GetCertType(net::X509Certificate::OSCertHandle cert) { 57 net::CertType GetCertType(net::X509Certificate::OSCertHandle cert) {
58 NOTIMPLEMENTED(); 58 NOTIMPLEMENTED();
59 return net::OTHER_CERT; 59 return net::OTHER_CERT;
60 } 60 }
61 #endif // USE_NSS 61 #endif // USE_NSS_CERTS
62 62
63 } // namespace 63 } // namespace
64 64
65 class ONCCertificateImporterImplTest : public testing::Test { 65 class ONCCertificateImporterImplTest : public testing::Test {
66 public: 66 public:
67 ONCCertificateImporterImplTest() {} 67 ONCCertificateImporterImplTest() {}
68 ~ONCCertificateImporterImplTest() override {} 68 ~ONCCertificateImporterImplTest() override {}
69 69
70 void SetUp() override { 70 void SetUp() override {
71 ASSERT_TRUE(public_nssdb_.is_open()); 71 ASSERT_TRUE(public_nssdb_.is_open());
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 "certificate-client-update.onc"), 341 "certificate-client-update.onc"),
342 CertParam(net::SERVER_CERT, 342 CertParam(net::SERVER_CERT,
343 "certificate-server.onc", 343 "certificate-server.onc",
344 "certificate-server-update.onc"), 344 "certificate-server-update.onc"),
345 CertParam(net::CA_CERT, 345 CertParam(net::CA_CERT,
346 "certificate-web-authority.onc", 346 "certificate-web-authority.onc",
347 "certificate-web-authority-update.onc"))); 347 "certificate-web-authority-update.onc")));
348 348
349 } // namespace onc 349 } // namespace onc
350 } // namespace chromeos 350 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromecast/renderer/cast_content_renderer_client.cc ('k') | components/nacl/loader/nacl_helper_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698