Chromium Code Reviews| 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/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 static const uint8_t kIPv6Address[] = { | 497 static const uint8_t kIPv6Address[] = { |
| 498 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 498 0xFE, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 | 499 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 |
| 500 }; | 500 }; |
| 501 ASSERT_EQ(arraysize(kIPv6Address), ip_addresses[1].size()); | 501 ASSERT_EQ(arraysize(kIPv6Address), ip_addresses[1].size()); |
| 502 EXPECT_EQ(0, memcmp(ip_addresses[1].data(), kIPv6Address, | 502 EXPECT_EQ(0, memcmp(ip_addresses[1].data(), kIPv6Address, |
| 503 arraysize(kIPv6Address))); | 503 arraysize(kIPv6Address))); |
| 504 | 504 |
| 505 // Ensure the subjectAltName dirName has not influenced the handling of | 505 // Ensure the subjectAltName dirName has not influenced the handling of |
| 506 // the subject commonName. | 506 // the subject commonName. |
| 507 EXPECT_EQ("127.0.0.1", san_cert->subject().common_name); | 507 EXPECT_EQ("localhost", san_cert->subject().common_name); |
|
Ryan Hamilton
2016/01/04 18:34:06
If you look at the cert in question, it appears to
| |
| 508 } | 508 } |
| 509 | 509 |
| 510 TEST(X509CertificateTest, ExtractSPKIFromDERCert) { | 510 TEST(X509CertificateTest, ExtractSPKIFromDERCert) { |
| 511 base::FilePath certs_dir = GetTestCertsDirectory(); | 511 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 512 scoped_refptr<X509Certificate> cert = | 512 scoped_refptr<X509Certificate> cert = |
| 513 ImportCertFromFile(certs_dir, "nist.der"); | 513 ImportCertFromFile(certs_dir, "nist.der"); |
| 514 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get()); | 514 ASSERT_NE(static_cast<X509Certificate*>(NULL), cert.get()); |
| 515 | 515 |
| 516 std::string derBytes; | 516 std::string derBytes; |
| 517 EXPECT_TRUE(X509Certificate::GetDEREncoded(cert->os_cert_handle(), | 517 EXPECT_TRUE(X509Certificate::GetDEREncoded(cert->os_cert_handle(), |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1206 &actual_type); | 1206 &actual_type); |
| 1207 | 1207 |
| 1208 EXPECT_EQ(data.expected_bits, actual_bits); | 1208 EXPECT_EQ(data.expected_bits, actual_bits); |
| 1209 EXPECT_EQ(data.expected_type, actual_type); | 1209 EXPECT_EQ(data.expected_type, actual_type); |
| 1210 } | 1210 } |
| 1211 | 1211 |
| 1212 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest, | 1212 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest, |
| 1213 testing::ValuesIn(kPublicKeyInfoTestData)); | 1213 testing::ValuesIn(kPublicKeyInfoTestData)); |
| 1214 | 1214 |
| 1215 } // namespace net | 1215 } // namespace net |
| OLD | NEW |