| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/internal/verify_certificate_chain.h" | 5 #include "net/cert/internal/verify_certificate_chain.h" |
| 6 | 6 |
| 7 #include "net/cert/internal/signature_policy.h" | 7 #include "net/cert/internal/signature_policy.h" |
| 8 #include "net/cert/internal/trust_store.h" | 8 #include "net/cert/internal/trust_store.h" |
| 9 #include "net/cert/internal/verify_certificate_chain_typed_unittest.h" | 9 #include "net/cert/internal/verify_certificate_chain_typed_unittest.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class VerifyCertificateChainDelegate { | 15 class VerifyCertificateChainDelegate { |
| 16 public: | 16 public: |
| 17 static void Verify(const VerifyCertChainTest& test, | 17 static void Verify(const VerifyCertChainTest& test, |
| 18 const std::string& test_file_path) { | 18 const std::string& test_file_path) { |
| 19 ASSERT_TRUE(test.trust_anchor); | 19 ASSERT_TRUE(test.trust_anchor); |
| 20 | 20 |
| 21 SimpleSignaturePolicy signature_policy(1024); | 21 SimpleSignaturePolicy signature_policy(1024); |
| 22 | 22 |
| 23 CertPathErrors errors; | 23 CertPathErrors errors; |
| 24 bool result = VerifyCertificateChain(test.chain, test.trust_anchor.get(), | 24 bool result = VerifyCertificateChain(test.chain, test.trust_anchor.get(), |
| 25 &signature_policy, test.time, &errors); | 25 &signature_policy, test.time, |
| 26 test.key_purpose, &errors); |
| 26 EXPECT_EQ(test.expected_result, result); | 27 EXPECT_EQ(test.expected_result, result); |
| 27 EXPECT_EQ(test.expected_errors, errors.ToDebugString(test.chain)) | 28 EXPECT_EQ(test.expected_errors, errors.ToDebugString(test.chain)) |
| 28 << "Test file: " << test_file_path; | 29 << "Test file: " << test_file_path; |
| 29 EXPECT_EQ(result, !errors.ContainsHighSeverityErrors()); | 30 EXPECT_EQ(result, !errors.ContainsHighSeverityErrors()); |
| 30 } | 31 } |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 } // namespace | 34 } // namespace |
| 34 | 35 |
| 35 INSTANTIATE_TYPED_TEST_CASE_P(VerifyCertificateChain, | 36 INSTANTIATE_TYPED_TEST_CASE_P(VerifyCertificateChain, |
| 36 VerifyCertificateChainSingleRootTest, | 37 VerifyCertificateChainSingleRootTest, |
| 37 VerifyCertificateChainDelegate); | 38 VerifyCertificateChainDelegate); |
| 38 | 39 |
| 39 } // namespace net | 40 } // namespace net |
| OLD | NEW |