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 <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... | |
26 // Creates a der::Input from an std::string. The lifetimes are a bit subtle | 26 // Creates a der::Input from an std::string. The lifetimes are a bit subtle |
27 // when using this function: | 27 // when using this function: |
28 // | 28 // |
29 // The returned der::Input() is only valid so long as the input string is alive | 29 // The returned der::Input() is only valid so long as the input string is alive |
30 // and is not mutated. | 30 // and is not mutated. |
31 // | 31 // |
32 // Note that the input parameter has been made a pointer to prevent callers | 32 // Note that the input parameter has been made a pointer to prevent callers |
33 // from accidentally passing an r-value. | 33 // from accidentally passing an r-value. |
34 der::Input InputFromString(const std::string* s); | 34 der::Input InputFromString(const std::string* s); |
35 | 35 |
36 // Parses |s| as a DER Sequence TLV and returns a der::Input corresponding to | |
Ryan Sleevi
2015/09/24 22:06:20
s/Sequence/SEQUENCE/
mattm
2015/09/30 04:52:32
Done.
| |
37 // the value portion. On error returns an empty der::Input and adds a gtest | |
38 // failure. | |
39 // | |
40 // Returned value's lifetime validity is the same as for InputFromString. | |
Ryan Sleevi
2015/09/24 22:06:20
Rather than back-reference to another function, it
mattm
2015/09/30 04:52:32
Done.
| |
41 der::Input SequenceValueFromString(const std::string* s); | |
Ryan Sleevi
2015/09/24 22:06:20
It's not entirely clear to me why this is needed;
mattm
2015/09/30 04:52:32
Depending on the context, Names can be implicitly
| |
42 | |
36 // Helper structure that maps a PEM block header (for instance "CERTIFICATE") to | 43 // Helper structure that maps a PEM block header (for instance "CERTIFICATE") to |
37 // the destination where the value for that block should be written. | 44 // the destination where the value for that block should be written. |
38 struct PemBlockMapping { | 45 struct PemBlockMapping { |
39 // The name of the PEM header. Example "CERTIFICATE". | 46 // The name of the PEM header. Example "CERTIFICATE". |
40 const char* block_name; | 47 const char* block_name; |
41 | 48 |
42 // The destination where the read value should be written to. | 49 // The destination where the read value should be written to. |
43 std::string* value; | 50 std::string* value; |
44 | 51 |
45 // True to indicate that the block is not required to be present. If the | 52 // True to indicate that the block is not required to be present. If the |
(...skipping 26 matching lines...) Expand all Loading... | |
72 template <size_t N> | 79 template <size_t N> |
73 ::testing::AssertionResult ReadTestDataFromPemFile( | 80 ::testing::AssertionResult ReadTestDataFromPemFile( |
74 const std::string& file_path_ascii, | 81 const std::string& file_path_ascii, |
75 const PemBlockMapping(&mappings)[N]) { | 82 const PemBlockMapping(&mappings)[N]) { |
76 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); | 83 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); |
77 } | 84 } |
78 | 85 |
79 } // namespace net | 86 } // namespace net |
80 | 87 |
81 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ | 88 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ |
OLD | NEW |