| 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 #ifndef NET_CERT_INTERNAL_TEST_HELPERS_H_ | 5 #ifndef NET_CERT_INTERNAL_TEST_HELPERS_H_ |
| 6 #define NET_CERT_INTERNAL_TEST_HELPERS_H_ | 6 #define NET_CERT_INTERNAL_TEST_HELPERS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <ostream> | 10 #include <ostream> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "net/cert/internal/parsed_certificate.h" | 14 #include "net/cert/internal/parsed_certificate.h" |
| 15 #include "net/cert/internal/trust_store.h" | 15 #include "net/cert/internal/trust_store.h" |
| 16 #include "net/cert/internal/verify_certificate_chain.h" |
| 16 #include "net/der/input.h" | 17 #include "net/der/input.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 namespace der { | 22 namespace der { |
| 22 | 23 |
| 23 // This function is used by GTest to support EXPECT_EQ() for der::Input. | 24 // This function is used by GTest to support EXPECT_EQ() for der::Input. |
| 24 void PrintTo(const Input& data, ::std::ostream* os); | 25 void PrintTo(const Input& data, ::std::ostream* os); |
| 25 | 26 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 85 |
| 85 // The chain of certificates (with the zero-th being the target). | 86 // The chain of certificates (with the zero-th being the target). |
| 86 ParsedCertificateList chain; | 87 ParsedCertificateList chain; |
| 87 | 88 |
| 88 // The trust anchor to use when verifying the chain. | 89 // The trust anchor to use when verifying the chain. |
| 89 scoped_refptr<TrustAnchor> trust_anchor; | 90 scoped_refptr<TrustAnchor> trust_anchor; |
| 90 | 91 |
| 91 // The time to use when verifying the chain. | 92 // The time to use when verifying the chain. |
| 92 der::GeneralizedTime time; | 93 der::GeneralizedTime time; |
| 93 | 94 |
| 95 // The Key Purpose to use when verifying the chain. |
| 96 KeyPurpose key_purpose = KeyPurpose::ANY_EKU; |
| 97 |
| 94 // The expected result from verification. | 98 // The expected result from verification. |
| 95 bool expected_result = false; | 99 bool expected_result = false; |
| 96 | 100 |
| 97 // The expected errors from verification (as a string). | 101 // The expected errors from verification (as a string). |
| 98 std::string expected_errors; | 102 std::string expected_errors; |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 // Reads a test case from |file_path_ascii| (which is relative to //src). | 105 // Reads a test case from |file_path_ascii| (which is relative to //src). |
| 102 // Generally |file_path_ascii| will start with: | 106 // Generally |file_path_ascii| will start with: |
| 103 // net/data/verify_certificate_chain_unittest/ | 107 // net/data/verify_certificate_chain_unittest/ |
| 104 void ReadVerifyCertChainTestFromFile(const std::string& file_path_ascii, | 108 void ReadVerifyCertChainTestFromFile(const std::string& file_path_ascii, |
| 105 VerifyCertChainTest* test); | 109 VerifyCertChainTest* test); |
| 106 | 110 |
| 107 // Reads a data file relative to the src root directory. | 111 // Reads a data file relative to the src root directory. |
| 108 std::string ReadTestFileToString(const std::string& file_path_ascii); | 112 std::string ReadTestFileToString(const std::string& file_path_ascii); |
| 109 | 113 |
| 110 } // namespace net | 114 } // namespace net |
| 111 | 115 |
| 112 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ | 116 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ |
| OLD | NEW |