| 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" | |
| 9 #include "net/cert/internal/verify_certificate_chain_typed_unittest.h" | 8 #include "net/cert/internal/verify_certificate_chain_typed_unittest.h" |
| 10 | 9 |
| 11 namespace net { | 10 namespace net { |
| 12 | 11 |
| 13 namespace { | 12 namespace { |
| 14 | 13 |
| 15 class VerifyCertificateChainAssumingTrustedRootDelegate { | 14 class VerifyCertificateChainAssumingTrustedRootDelegate { |
| 16 public: | 15 public: |
| 17 static void Verify(const ParsedCertificateList& chain, | 16 static void Verify(const ParsedCertificateList& chain, |
| 18 const ParsedCertificateList& roots, | 17 const ParsedCertificateList& roots, |
| 19 const der::GeneralizedTime& time, | 18 const der::GeneralizedTime& time, |
| 20 bool expected_result) { | 19 bool expected_result) { |
| 21 TrustStore trust_store; | |
| 22 ASSERT_EQ(1U, roots.size()); | 20 ASSERT_EQ(1U, roots.size()); |
| 23 trust_store.AddTrustedCertificate(roots[0]); | |
| 24 | 21 |
| 25 ParsedCertificateList full_chain(chain); | 22 ParsedCertificateList full_chain(chain); |
| 26 full_chain.push_back(roots[0]); | 23 full_chain.push_back(roots[0]); |
| 27 | 24 |
| 28 SimpleSignaturePolicy signature_policy(1024); | 25 SimpleSignaturePolicy signature_policy(1024); |
| 29 | 26 |
| 30 bool result = VerifyCertificateChainAssumingTrustedRoot( | 27 bool result = VerifyCertificateChainAssumingTrustedRoot( |
| 31 full_chain, trust_store, &signature_policy, time); | 28 full_chain, &signature_policy, time); |
| 32 | 29 |
| 33 ASSERT_EQ(expected_result, result); | 30 ASSERT_EQ(expected_result, result); |
| 34 } | 31 } |
| 35 }; | 32 }; |
| 36 | 33 |
| 37 } // namespace | 34 } // namespace |
| 38 | 35 |
| 39 INSTANTIATE_TYPED_TEST_CASE_P( | 36 INSTANTIATE_TYPED_TEST_CASE_P( |
| 40 VerifyCertificateChainAssumingTrustedRoot, | 37 VerifyCertificateChainAssumingTrustedRoot, |
| 41 VerifyCertificateChainSingleRootTest, | 38 VerifyCertificateChainSingleRootTest, |
| 42 VerifyCertificateChainAssumingTrustedRootDelegate); | 39 VerifyCertificateChainAssumingTrustedRootDelegate); |
| 43 | 40 |
| 44 } // namespace net | 41 } // namespace net |
| OLD | NEW |