Chromium Code Reviews| Index: net/cert/internal/test_helpers.cc |
| diff --git a/net/cert/internal/test_helpers.cc b/net/cert/internal/test_helpers.cc |
| index 0b5363d8acc7da720b37c2698226f91a189a9c0a..18e1f6ca74e72fd1744dcd19560293b16206d665 100644 |
| --- a/net/cert/internal/test_helpers.cc |
| +++ b/net/cert/internal/test_helpers.cc |
| @@ -9,6 +9,8 @@ |
| #include "base/files/file_util.h" |
| #include "base/path_service.h" |
| #include "net/cert/pem_tokenizer.h" |
| +#include "net/der/parser.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| namespace net { |
| @@ -34,6 +36,20 @@ der::Input InputFromString(const std::string* s) { |
| return der::Input(reinterpret_cast<const uint8_t*>(s->data()), s->size()); |
| } |
| +der::Input SequenceValueFromString(const std::string* s) { |
| + der::Parser parser(InputFromString(s)); |
| + der::Input data; |
| + if (!parser.ReadTag(der::kSequence, &data)) { |
| + ADD_FAILURE(); |
| + return der::Input(); |
| + } |
| + if (parser.HasMore()) { |
|
Ryan Sleevi
2015/09/24 22:06:20
This surprises me; it doesn't seem part of the doc
mattm
2015/09/30 04:52:32
Well, the contract is input is a "DER SEQUENCE tlv
|
| + ADD_FAILURE(); |
| + return der::Input(); |
| + } |
| + return data; |
| +} |
| + |
| ::testing::AssertionResult ReadTestDataFromPemFile( |
| const std::string& file_path_ascii, |
| const PemBlockMapping* mappings, |