| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 675 |
| 676 // Verify it has all the intermediates: | 676 // Verify it has all the intermediates: |
| 677 const X509Certificate::OSCertHandles& cert2_intermediates = | 677 const X509Certificate::OSCertHandles& cert2_intermediates = |
| 678 cert2->GetIntermediateCertificates(); | 678 cert2->GetIntermediateCertificates(); |
| 679 ASSERT_EQ(2u, cert2_intermediates.size()); | 679 ASSERT_EQ(2u, cert2_intermediates.size()); |
| 680 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_intermediates[0], | 680 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_intermediates[0], |
| 681 webkit_cert->os_cert_handle())); | 681 webkit_cert->os_cert_handle())); |
| 682 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_intermediates[1], | 682 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_intermediates[1], |
| 683 thawte_cert->os_cert_handle())); | 683 thawte_cert->os_cert_handle())); |
| 684 | 684 |
| 685 // Verify GetCertificateChain has the cert and all the intermediates: |
| 686 X509Certificate::OSCertHandles cert2_chain; |
| 687 cert2->GetCertificateChain(&cert2_chain); |
| 688 ASSERT_EQ(3u, cert2_chain.size()); |
| 689 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_chain[0], |
| 690 cert2->os_cert_handle())); |
| 691 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_chain[1], |
| 692 webkit_cert->os_cert_handle())); |
| 693 EXPECT_TRUE(X509Certificate::IsSameOSCert(cert2_chain[2], |
| 694 thawte_cert->os_cert_handle())); |
| 695 |
| 685 // Cleanup | 696 // Cleanup |
| 686 X509Certificate::FreeOSCertHandle(google_handle); | 697 X509Certificate::FreeOSCertHandle(google_handle); |
| 687 } | 698 } |
| 688 | 699 |
| 689 TEST(X509CertificateTest, IsIssuedByEncoded) { | 700 TEST(X509CertificateTest, IsIssuedByEncoded) { |
| 690 base::FilePath certs_dir = GetTestCertsDirectory(); | 701 base::FilePath certs_dir = GetTestCertsDirectory(); |
| 691 | 702 |
| 692 // Test a client certificate from MIT. | 703 // Test a client certificate from MIT. |
| 693 scoped_refptr<X509Certificate> mit_davidben_cert( | 704 scoped_refptr<X509Certificate> mit_davidben_cert( |
| 694 ImportCertFromFile(certs_dir, "mit.davidben.der")); | 705 ImportCertFromFile(certs_dir, "mit.davidben.der")); |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 &actual_type); | 1204 &actual_type); |
| 1194 | 1205 |
| 1195 EXPECT_EQ(data.expected_bits, actual_bits); | 1206 EXPECT_EQ(data.expected_bits, actual_bits); |
| 1196 EXPECT_EQ(data.expected_type, actual_type); | 1207 EXPECT_EQ(data.expected_type, actual_type); |
| 1197 } | 1208 } |
| 1198 | 1209 |
| 1199 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest, | 1210 INSTANTIATE_TEST_CASE_P(, X509CertificatePublicKeyInfoTest, |
| 1200 testing::ValuesIn(kPublicKeyInfoTestData)); | 1211 testing::ValuesIn(kPublicKeyInfoTestData)); |
| 1201 | 1212 |
| 1202 } // namespace net | 1213 } // namespace net |
| OLD | NEW |