| 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/der/input.h" | 14 #include "net/der/input.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 namespace der { | 19 namespace der { |
| 20 | 20 |
| 21 // These functions are used by GTest to support EXPECT_EQ() for | 21 // This function is used by GTest to support EXPECT_EQ() for der::Input. |
| 22 // der::Input. | |
| 23 void PrintTo(const Input& data, ::std::ostream* os); | 22 void PrintTo(const Input& data, ::std::ostream* os); |
| 24 bool operator==(const Input& a, const Input& b); | |
| 25 | 23 |
| 26 } // namespace der | 24 } // namespace der |
| 27 | 25 |
| 28 // Parses |s| as a DER SEQUENCE TLV and returns a der::Input corresponding to | 26 // Parses |s| as a DER SEQUENCE TLV and returns a der::Input corresponding to |
| 29 // the value portion. On error returns an empty der::Input and adds a gtest | 27 // the value portion. On error returns an empty der::Input and adds a gtest |
| 30 // failure. | 28 // failure. |
| 31 // | 29 // |
| 32 // The returned der::Input() is only valid so long as the input string is alive | 30 // The returned der::Input() is only valid so long as the input string is alive |
| 33 // and is not mutated. | 31 // and is not mutated. |
| 34 der::Input SequenceValueFromString(const std::string* s); | 32 der::Input SequenceValueFromString(const std::string* s); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 template <size_t N> | 70 template <size_t N> |
| 73 ::testing::AssertionResult ReadTestDataFromPemFile( | 71 ::testing::AssertionResult ReadTestDataFromPemFile( |
| 74 const std::string& file_path_ascii, | 72 const std::string& file_path_ascii, |
| 75 const PemBlockMapping(&mappings)[N]) { | 73 const PemBlockMapping(&mappings)[N]) { |
| 76 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); | 74 return ReadTestDataFromPemFile(file_path_ascii, mappings, N); |
| 77 } | 75 } |
| 78 | 76 |
| 79 } // namespace net | 77 } // namespace net |
| 80 | 78 |
| 81 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ | 79 #endif // NET_CERT_INTERNAL_TEST_HELPERS_H_ |
| OLD | NEW |