OLD | NEW |
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 "base/basictypes.h" |
5 #include "net/base/x509_cert_types.h" | 6 #include "net/base/x509_cert_types.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
7 | 8 |
8 // 0:d=0 hl=2 l= 95 cons: SEQUENCE | 9 // 0:d=0 hl=2 l= 95 cons: SEQUENCE |
9 // 2:d=1 hl=2 l= 11 cons: SET | 10 // 2:d=1 hl=2 l= 11 cons: SET |
10 // 4:d=2 hl=2 l= 9 cons: SEQUENCE | 11 // 4:d=2 hl=2 l= 9 cons: SEQUENCE |
11 // 6:d=3 hl=2 l= 3 prim: OBJECT :countryName | 12 // 6:d=3 hl=2 l= 3 prim: OBJECT :countryName |
12 // 11:d=3 hl=2 l= 2 prim: PRINTABLESTRING :US | 13 // 11:d=3 hl=2 l= 2 prim: PRINTABLESTRING :US |
13 // 15:d=1 hl=2 l= 23 cons: SET | 14 // 15:d=1 hl=2 l= 23 cons: SET |
14 // 17:d=2 hl=2 l= 21 cons: SEQUENCE | 15 // 17:d=2 hl=2 l= 21 cons: SEQUENCE |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 bogus.locality_name = "Elbosdorf"; | 243 bogus.locality_name = "Elbosdorf"; |
243 EXPECT_FALSE(bogus.Matches(spamco)); | 244 EXPECT_FALSE(bogus.Matches(spamco)); |
244 EXPECT_FALSE(spamco.Matches(bogus)); | 245 EXPECT_FALSE(spamco.Matches(bogus)); |
245 | 246 |
246 bogus.locality_name = ""; | 247 bogus.locality_name = ""; |
247 bogus.organization_unit_names.push_back("Q Division"); | 248 bogus.organization_unit_names.push_back("Q Division"); |
248 EXPECT_FALSE(bogus.Matches(spamco)); | 249 EXPECT_FALSE(bogus.Matches(spamco)); |
249 EXPECT_FALSE(spamco.Matches(bogus)); | 250 EXPECT_FALSE(spamco.Matches(bogus)); |
250 } | 251 } |
251 | 252 |
252 #if defined(OS_MACOSX) // ParseDistinguishedName not implemented for Win/Linux | |
253 | |
254 TEST(X509TypesTest, ParseDNVerisign) { | 253 TEST(X509TypesTest, ParseDNVerisign) { |
255 CertPrincipal verisign; | 254 CertPrincipal verisign; |
256 EXPECT_TRUE(verisign.ParseDistinguishedName(VerisignDN, sizeof(VerisignDN))); | 255 EXPECT_TRUE(verisign.ParseDistinguishedName(VerisignDN, sizeof(VerisignDN))); |
257 EXPECT_EQ("", verisign.common_name); | 256 EXPECT_EQ("", verisign.common_name); |
258 EXPECT_EQ("US", verisign.country_name); | 257 EXPECT_EQ("US", verisign.country_name); |
259 ASSERT_EQ(1U, verisign.organization_names.size()); | 258 ASSERT_EQ(1U, verisign.organization_names.size()); |
260 EXPECT_EQ("VeriSign, Inc.", verisign.organization_names[0]); | 259 EXPECT_EQ("VeriSign, Inc.", verisign.organization_names[0]); |
261 ASSERT_EQ(1U, verisign.organization_unit_names.size()); | 260 ASSERT_EQ(1U, verisign.organization_unit_names.size()); |
262 EXPECT_EQ("Class 1 Public Primary Certification Authority", | 261 EXPECT_EQ("Class 1 Public Primary Certification Authority", |
263 verisign.organization_unit_names[0]); | 262 verisign.organization_unit_names[0]); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 ASSERT_EQ(1U, entrust.organization_names.size()); | 331 ASSERT_EQ(1U, entrust.organization_names.size()); |
333 EXPECT_EQ("Entrust.net", | 332 EXPECT_EQ("Entrust.net", |
334 entrust.organization_names[0]); | 333 entrust.organization_names[0]); |
335 ASSERT_EQ(2U, entrust.organization_unit_names.size()); | 334 ASSERT_EQ(2U, entrust.organization_unit_names.size()); |
336 EXPECT_EQ("www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)", | 335 EXPECT_EQ("www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)", |
337 entrust.organization_unit_names[0]); | 336 entrust.organization_unit_names[0]); |
338 EXPECT_EQ("(c) 1999 Entrust.net Limited", | 337 EXPECT_EQ("(c) 1999 Entrust.net Limited", |
339 entrust.organization_unit_names[1]); | 338 entrust.organization_unit_names[1]); |
340 } | 339 } |
341 | 340 |
342 #endif | 341 } // namespace net |
343 | |
344 } | |
OLD | NEW |