| 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 #include "net/cert/internal/test_helpers.h" | 5 #include "net/cert/internal/test_helpers.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 *os << "[" << b64 << "]"; | 26 *os << "[" << b64 << "]"; |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool operator==(const Input& a, const Input& b) { | 29 bool operator==(const Input& a, const Input& b) { |
| 30 return a.Equals(b); | 30 return a.Equals(b); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace der | 33 } // namespace der |
| 34 | 34 |
| 35 der::Input InputFromString(const std::string* s) { | |
| 36 return der::Input(reinterpret_cast<const uint8_t*>(s->data()), s->size()); | |
| 37 } | |
| 38 | |
| 39 der::Input SequenceValueFromString(const std::string* s) { | 35 der::Input SequenceValueFromString(const std::string* s) { |
| 40 der::Parser parser(InputFromString(s)); | 36 der::Parser parser((der::Input(s))); |
| 41 der::Input data; | 37 der::Input data; |
| 42 if (!parser.ReadTag(der::kSequence, &data)) { | 38 if (!parser.ReadTag(der::kSequence, &data)) { |
| 43 ADD_FAILURE(); | 39 ADD_FAILURE(); |
| 44 return der::Input(); | 40 return der::Input(); |
| 45 } | 41 } |
| 46 if (parser.HasMore()) { | 42 if (parser.HasMore()) { |
| 47 ADD_FAILURE(); | 43 ADD_FAILURE(); |
| 48 return der::Input(); | 44 return der::Input(); |
| 49 } | 45 } |
| 50 return data; | 46 return data; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (mapping.value && !mapping.optional) { | 98 if (mapping.value && !mapping.optional) { |
| 103 return ::testing::AssertionFailure() << "PEM block missing: " | 99 return ::testing::AssertionFailure() << "PEM block missing: " |
| 104 << mapping.block_name; | 100 << mapping.block_name; |
| 105 } | 101 } |
| 106 } | 102 } |
| 107 | 103 |
| 108 return ::testing::AssertionSuccess(); | 104 return ::testing::AssertionSuccess(); |
| 109 } | 105 } |
| 110 | 106 |
| 111 } // namespace net | 107 } // namespace net |
| OLD | NEW |