| 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/test_helpers.h" |
| 8 #include "net/cert/internal/trust_store.h" | 9 #include "net/cert/internal/trust_store.h" |
| 9 #include "net/cert/internal/verify_certificate_chain_typed_unittest.h" | 10 #include "net/cert/internal/verify_certificate_chain_typed_unittest.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 namespace { | 14 namespace { |
| 14 | 15 |
| 15 class VerifyCertificateChainDelegate { | 16 class VerifyCertificateChainDelegate { |
| 16 public: | 17 public: |
| 17 static void Verify(const VerifyCertChainTest& test, | 18 static void Verify(const VerifyCertChainTest& test, |
| 18 const std::string& test_file_path) { | 19 const std::string& test_file_path) { |
| 19 SimpleSignaturePolicy signature_policy(1024); | 20 SimpleSignaturePolicy signature_policy(1024); |
| 20 | 21 |
| 21 CertPathErrors errors; | 22 CertPathErrors errors; |
| 22 // TODO(eroman): Check user_constrained_policy_set. | 23 // TODO(eroman): Check user_constrained_policy_set. |
| 23 VerifyCertificateChain( | 24 VerifyCertificateChain( |
| 24 test.chain, test.last_cert_trust, &signature_policy, test.time, | 25 test.chain, test.last_cert_trust, &signature_policy, test.time, |
| 25 test.key_purpose, test.initial_explicit_policy, | 26 test.key_purpose, test.initial_explicit_policy, |
| 26 test.user_initial_policy_set, test.initial_policy_mapping_inhibit, | 27 test.user_initial_policy_set, test.initial_policy_mapping_inhibit, |
| 27 test.initial_any_policy_inhibit, | 28 test.initial_any_policy_inhibit, |
| 28 nullptr /*user_constrained_policy_set*/, &errors); | 29 nullptr /*user_constrained_policy_set*/, &errors); |
| 29 EXPECT_EQ(test.expected_errors, errors.ToDebugString(test.chain)) | 30 VerifyCertPathErrors(test.expected_errors, errors, test.chain, |
| 30 << "Test file: " << test_file_path; | 31 test_file_path); |
| 31 } | 32 } |
| 32 }; | 33 }; |
| 33 | 34 |
| 34 } // namespace | 35 } // namespace |
| 35 | 36 |
| 36 INSTANTIATE_TYPED_TEST_CASE_P(VerifyCertificateChain, | 37 INSTANTIATE_TYPED_TEST_CASE_P(VerifyCertificateChain, |
| 37 VerifyCertificateChainSingleRootTest, | 38 VerifyCertificateChainSingleRootTest, |
| 38 VerifyCertificateChainDelegate); | 39 VerifyCertificateChainDelegate); |
| 39 | 40 |
| 40 } // namespace net | 41 } // namespace net |
| OLD | NEW |