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/der/input.h" | 15 #include "net/der/input.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 namespace der { | 20 namespace der { |
20 | 21 |
21 // This function is used by GTest to support EXPECT_EQ() for der::Input. | 22 // This function is used by GTest to support EXPECT_EQ() for der::Input. |
22 void PrintTo(const Input& data, ::std::ostream* os); | 23 void PrintTo(const Input& data, ::std::ostream* os); |
23 | 24 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // This is the same as the variant above, however it uses template magic so an | 68 // This is the same as the variant above, however it uses template magic so an |
68 // mappings array can be passed in directly (and the correct length is | 69 // mappings array can be passed in directly (and the correct length is |
69 // inferred). | 70 // inferred). |
70 template <size_t N> | 71 template <size_t N> |
71 ::testing::AssertionResult ReadTestDataFromPemFile( | 72 ::testing::AssertionResult ReadTestDataFromPemFile( |
72 const std::string& file_path_ascii, | 73 const std::string& file_path_ascii, |
73 const PemBlockMapping(&mappings)[N]) { | 74 const PemBlockMapping(&mappings)[N]) { |
74 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); | 75 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); |
75 } | 76 } |
76 | 77 |
| 78 // Reads a test case from |file_name|. Test cases are comprised of a |
| 79 // certificate chain, trust store, a timestamp to validate at, and the |
| 80 // expected result of verification. |
| 81 void ReadCertChainTestFromFile(const std::string& file_path_ascii, |
| 82 ParsedCertificateList* chain, |
| 83 ParsedCertificateList* roots, |
| 84 der::GeneralizedTime* time, |
| 85 bool* verify_result); |
| 86 |
77 } // namespace net | 87 } // namespace net |
78 | 88 |
79 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ | 89 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ |
OLD | NEW |