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 <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "net/der/input.h" | 12 #include "net/der/input.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
| 17 namespace der { |
| 18 |
| 19 // These functions are used by GTest to support EXPECT_EQ() for |
| 20 // der::Input. |
| 21 void PrintTo(const Input& data, ::std::ostream* os); |
| 22 bool operator==(const Input& a, const Input& b); |
| 23 |
| 24 } // namespace der |
| 25 |
16 // 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 |
17 // when using this function: | 27 // when using this function: |
18 // | 28 // |
19 // 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 |
20 // and is not mutated. | 30 // and is not mutated. |
21 // | 31 // |
22 // 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 |
23 // from accidentally passing an r-value. | 33 // from accidentally passing an r-value. |
24 der::Input InputFromString(const std::string* s); | 34 der::Input InputFromString(const std::string* s); |
25 | 35 |
(...skipping 29 matching lines...) Expand all Loading... |
55 template <size_t N> | 65 template <size_t N> |
56 ::testing::AssertionResult ReadTestDataFromPemFile( | 66 ::testing::AssertionResult ReadTestDataFromPemFile( |
57 const std::string& file_path_ascii, | 67 const std::string& file_path_ascii, |
58 const PemBlockMapping(&mappings)[N]) { | 68 const PemBlockMapping(&mappings)[N]) { |
59 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); | 69 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); |
60 } | 70 } |
61 | 71 |
62 } // namespace net | 72 } // namespace net |
63 | 73 |
64 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ | 74 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ |
OLD | NEW |