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

Side by Side Diff: net/cert/ev_root_ca_metadata_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
« no previous file with comments | « net/cert/ev_root_ca_metadata.cc ('k') | net/cert/multi_threaded_cert_verifier.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) 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/ev_root_ca_metadata.h" 5 #include "net/cert/ev_root_ca_metadata.h"
6 6
7 #include "net/cert/x509_cert_types.h" 7 #include "net/cert/x509_cert_types.h"
8 #include "net/test/cert_test_util.h" 8 #include "net/test/cert_test_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 #if defined(USE_NSS) 11 #if defined(USE_NSS_CERTS)
12 #include "crypto/scoped_nss_types.h" 12 #include "crypto/scoped_nss_types.h"
13 #endif 13 #endif
14 14
15 namespace net { 15 namespace net {
16 16
17 namespace { 17 namespace {
18 18
19 #if defined(USE_NSS) || defined(OS_WIN) 19 #if defined(USE_NSS_CERTS) || defined(OS_WIN)
20 const char kVerisignPolicy[] = "2.16.840.1.113733.1.7.23.6"; 20 const char kVerisignPolicy[] = "2.16.840.1.113733.1.7.23.6";
21 const char kThawtePolicy[] = "2.16.840.1.113733.1.7.48.1"; 21 const char kThawtePolicy[] = "2.16.840.1.113733.1.7.48.1";
22 const char kFakePolicy[] = "2.16.840.1.42"; 22 const char kFakePolicy[] = "2.16.840.1.42";
23 const SHA1HashValue kVerisignFingerprint = 23 const SHA1HashValue kVerisignFingerprint =
24 { { 0x74, 0x2c, 0x31, 0x92, 0xe6, 0x07, 0xe4, 0x24, 0xeb, 0x45, 24 { { 0x74, 0x2c, 0x31, 0x92, 0xe6, 0x07, 0xe4, 0x24, 0xeb, 0x45,
25 0x49, 0x54, 0x2b, 0xe1, 0xbb, 0xc5, 0x3e, 0x61, 0x74, 0xe2 } }; 25 0x49, 0x54, 0x2b, 0xe1, 0xbb, 0xc5, 0x3e, 0x61, 0x74, 0xe2 } };
26 const SHA1HashValue kFakeFingerprint = 26 const SHA1HashValue kFakeFingerprint =
27 { { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 27 { { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99,
28 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 } }; 28 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99 } };
29 29
30 class EVOidData { 30 class EVOidData {
31 public: 31 public:
32 EVOidData(); 32 EVOidData();
33 bool Init(); 33 bool Init();
34 34
35 EVRootCAMetadata::PolicyOID verisign_policy; 35 EVRootCAMetadata::PolicyOID verisign_policy;
36 EVRootCAMetadata::PolicyOID thawte_policy; 36 EVRootCAMetadata::PolicyOID thawte_policy;
37 EVRootCAMetadata::PolicyOID fake_policy; 37 EVRootCAMetadata::PolicyOID fake_policy;
38 }; 38 };
39 39
40 #endif // defined(USE_NSS) || defined(OS_WIN) 40 #endif // defined(USE_NSS_CERTS) || defined(OS_WIN)
41 41
42 #if defined(USE_NSS) 42 #if defined(USE_NSS_CERTS)
43 43
44 SECOidTag RegisterOID(PLArenaPool* arena, const char* oid_string) { 44 SECOidTag RegisterOID(PLArenaPool* arena, const char* oid_string) {
45 SECOidData oid_data; 45 SECOidData oid_data;
46 memset(&oid_data, 0, sizeof(oid_data)); 46 memset(&oid_data, 0, sizeof(oid_data));
47 oid_data.offset = SEC_OID_UNKNOWN; 47 oid_data.offset = SEC_OID_UNKNOWN;
48 oid_data.desc = oid_string; 48 oid_data.desc = oid_string;
49 oid_data.mechanism = CKM_INVALID_MECHANISM; 49 oid_data.mechanism = CKM_INVALID_MECHANISM;
50 oid_data.supportedExtension = INVALID_CERT_EXTENSION; 50 oid_data.supportedExtension = INVALID_CERT_EXTENSION;
51 51
52 SECStatus rv = SEC_StringToOID(arena, &oid_data.oid, oid_string, 0); 52 SECStatus rv = SEC_StringToOID(arena, &oid_data.oid, oid_string, 0);
(...skipping 30 matching lines...) Expand all
83 thawte_policy(kThawtePolicy), 83 thawte_policy(kThawtePolicy),
84 fake_policy(kFakePolicy) { 84 fake_policy(kFakePolicy) {
85 } 85 }
86 86
87 bool EVOidData::Init() { 87 bool EVOidData::Init() {
88 return true; 88 return true;
89 } 89 }
90 90
91 #endif 91 #endif
92 92
93 #if defined(USE_NSS) || defined(OS_WIN) 93 #if defined(USE_NSS_CERTS) || defined(OS_WIN)
94 94
95 class EVRootCAMetadataTest : public testing::Test { 95 class EVRootCAMetadataTest : public testing::Test {
96 protected: 96 protected:
97 void SetUp() override { ASSERT_TRUE(ev_oid_data.Init()); } 97 void SetUp() override { ASSERT_TRUE(ev_oid_data.Init()); }
98 98
99 EVOidData ev_oid_data; 99 EVOidData ev_oid_data;
100 }; 100 };
101 101
102 TEST_F(EVRootCAMetadataTest, Basic) { 102 TEST_F(EVRootCAMetadataTest, Basic) {
103 EVRootCAMetadata* ev_metadata(EVRootCAMetadata::GetInstance()); 103 EVRootCAMetadata* ev_metadata(EVRootCAMetadata::GetInstance());
(...skipping 24 matching lines...) Expand all
128 EXPECT_TRUE(ev_metadata->IsEVPolicyOID(ev_oid_data.fake_policy)); 128 EXPECT_TRUE(ev_metadata->IsEVPolicyOID(ev_oid_data.fake_policy));
129 EXPECT_TRUE(ev_metadata->HasEVPolicyOID(kFakeFingerprint, 129 EXPECT_TRUE(ev_metadata->HasEVPolicyOID(kFakeFingerprint,
130 ev_oid_data.fake_policy)); 130 ev_oid_data.fake_policy));
131 } 131 }
132 132
133 EXPECT_FALSE(ev_metadata->IsEVPolicyOID(ev_oid_data.fake_policy)); 133 EXPECT_FALSE(ev_metadata->IsEVPolicyOID(ev_oid_data.fake_policy));
134 EXPECT_FALSE(ev_metadata->HasEVPolicyOID(kFakeFingerprint, 134 EXPECT_FALSE(ev_metadata->HasEVPolicyOID(kFakeFingerprint,
135 ev_oid_data.fake_policy)); 135 ev_oid_data.fake_policy));
136 } 136 }
137 137
138 #endif // defined(USE_NSS) || defined(OS_WIN) 138 #endif // defined(USE_NSS_CERTS) || defined(OS_WIN)
139 139
140 } // namespace 140 } // namespace
141 141
142 } // namespace net 142 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ev_root_ca_metadata.cc ('k') | net/cert/multi_threaded_cert_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698