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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 // returned before marking this test a success. | 936 // returned before marking this test a success. |
937 EXPECT_EQ(i, certs.size()); | 937 EXPECT_EQ(i, certs.size()); |
938 break; | 938 break; |
939 } | 939 } |
940 | 940 |
941 // A cert is expected - make sure that one was parsed. | 941 // A cert is expected - make sure that one was parsed. |
942 ASSERT_LT(i, certs.size()); | 942 ASSERT_LT(i, certs.size()); |
943 | 943 |
944 // Compare the parsed certificate with the expected certificate, by | 944 // Compare the parsed certificate with the expected certificate, by |
945 // comparing fingerprints. | 945 // comparing fingerprints. |
946 const X509Certificate* cert = certs[i]; | 946 const X509Certificate* cert = certs[i].get(); |
947 const SHA1HashValue& actual_fingerprint = cert->fingerprint(); | 947 const SHA1HashValue& actual_fingerprint = cert->fingerprint(); |
948 uint8* expected_fingerprint = test_data_.chain_fingerprints[i]; | 948 uint8* expected_fingerprint = test_data_.chain_fingerprints[i]; |
949 | 949 |
950 for (size_t j = 0; j < 20; ++j) | 950 for (size_t j = 0; j < 20; ++j) |
951 EXPECT_EQ(expected_fingerprint[j], actual_fingerprint.data[j]); | 951 EXPECT_EQ(expected_fingerprint[j], actual_fingerprint.data[j]); |
952 } | 952 } |
953 } | 953 } |
954 | 954 |
955 INSTANTIATE_TEST_CASE_P(, X509CertificateParseTest, | 955 INSTANTIATE_TEST_CASE_P(, X509CertificateParseTest, |
956 testing::ValuesIn(FormatTestData)); | 956 testing::ValuesIn(FormatTestData)); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 } | 1176 } |
1177 | 1177 |
1178 EXPECT_EQ(test_data.expected, X509Certificate::VerifyHostname( | 1178 EXPECT_EQ(test_data.expected, X509Certificate::VerifyHostname( |
1179 test_data.hostname, common_name, dns_names, ip_addressses)); | 1179 test_data.hostname, common_name, dns_names, ip_addressses)); |
1180 } | 1180 } |
1181 | 1181 |
1182 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, | 1182 INSTANTIATE_TEST_CASE_P(, X509CertificateNameVerifyTest, |
1183 testing::ValuesIn(kNameVerifyTestData)); | 1183 testing::ValuesIn(kNameVerifyTestData)); |
1184 | 1184 |
1185 } // namespace net | 1185 } // namespace net |
OLD | NEW |