| 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 "base/files/file_path.h" |
| 14 #include "net/cert/internal/parsed_certificate.h" | 15 #include "net/cert/internal/parsed_certificate.h" |
| 15 #include "net/cert/internal/trust_store.h" | 16 #include "net/cert/internal/trust_store.h" |
| 16 #include "net/cert/internal/verify_certificate_chain.h" | 17 #include "net/cert/internal/verify_certificate_chain.h" |
| 17 #include "net/der/input.h" | 18 #include "net/der/input.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 | 22 |
| 22 namespace der { | 23 namespace der { |
| 23 | 24 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 89 |
| 89 // Details on the trustedness of the last certificate. | 90 // Details on the trustedness of the last certificate. |
| 90 CertificateTrust last_cert_trust; | 91 CertificateTrust last_cert_trust; |
| 91 | 92 |
| 92 // The time to use when verifying the chain. | 93 // The time to use when verifying the chain. |
| 93 der::GeneralizedTime time; | 94 der::GeneralizedTime time; |
| 94 | 95 |
| 95 // The Key Purpose to use when verifying the chain. | 96 // The Key Purpose to use when verifying the chain. |
| 96 KeyPurpose key_purpose = KeyPurpose::ANY_EKU; | 97 KeyPurpose key_purpose = KeyPurpose::ANY_EKU; |
| 97 | 98 |
| 98 // The expected result from verification. | |
| 99 bool expected_result = false; | |
| 100 | |
| 101 // The expected errors from verification (as a string). | 99 // The expected errors from verification (as a string). |
| 102 std::string expected_errors; | 100 std::string expected_errors; |
| 103 }; | 101 }; |
| 104 | 102 |
| 105 // Reads a test case from |file_path_ascii| (which is relative to //src). | 103 // Reads a test case from |file_path_ascii| (which is relative to //src). |
| 106 // Generally |file_path_ascii| will start with: | 104 // Generally |file_path_ascii| will start with: |
| 107 // net/data/verify_certificate_chain_unittest/ | 105 // net/data/verify_certificate_chain_unittest/ |
| 108 void ReadVerifyCertChainTestFromFile(const std::string& file_path_ascii, | 106 bool ReadVerifyCertChainTestFromFile(const std::string& file_path_ascii, |
| 109 VerifyCertChainTest* test); | 107 VerifyCertChainTest* test); |
| 110 | 108 |
| 109 // Reads a certificate chain from |file_path_ascii| |
| 110 bool ReadCertChainFromFile(const std::string& file_path_ascii, |
| 111 ParsedCertificateList* chain); |
| 112 |
| 111 // Reads a data file relative to the src root directory. | 113 // Reads a data file relative to the src root directory. |
| 112 std::string ReadTestFileToString(const std::string& file_path_ascii); | 114 std::string ReadTestFileToString(const std::string& file_path_ascii); |
| 113 | 115 |
| 114 } // namespace net | 116 } // namespace net |
| 115 | 117 |
| 116 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ | 118 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ |
| OLD | NEW |