| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/parse_name.h" | 5 #include "net/cert/internal/parse_name.h" |
| 6 | 6 |
| 7 #include "net/cert/internal/test_helpers.h" | 7 #include "net/cert/internal/test_helpers.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 std::string* result) { | 22 std::string* result) { |
| 23 std::string path = "net/data/verify_name_match_unittest/names/" + prefix + | 23 std::string path = "net/data/verify_name_match_unittest/names/" + prefix + |
| 24 "-" + value_type + "-" + suffix + ".pem"; | 24 "-" + value_type + "-" + suffix + ".pem"; |
| 25 | 25 |
| 26 const PemBlockMapping mappings[] = { | 26 const PemBlockMapping mappings[] = { |
| 27 {"NAME", result}, | 27 {"NAME", result}, |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 return ReadTestDataFromPemFile(path, mappings); | 30 return ReadTestDataFromPemFile(path, mappings); |
| 31 } | 31 } |
| 32 } | 32 |
| 33 } // anonymous namespace |
| 33 | 34 |
| 34 TEST(ParseNameTest, IA5SafeStringValue) { | 35 TEST(ParseNameTest, IA5SafeStringValue) { |
| 35 const uint8_t der[] = { | 36 const uint8_t der[] = { |
| 36 0x46, 0x6f, 0x6f, 0x20, 0x62, 0x61, 0x72, | 37 0x46, 0x6f, 0x6f, 0x20, 0x62, 0x61, 0x72, |
| 37 }; | 38 }; |
| 38 X509NameAttribute value(der::Input(), der::kIA5String, der::Input(der)); | 39 X509NameAttribute value(der::Input(), der::kIA5String, der::Input(der)); |
| 39 std::string result_unsafe; | 40 std::string result_unsafe; |
| 40 ASSERT_TRUE(value.ValueAsStringUnsafe(&result_unsafe)); | 41 ASSERT_TRUE(value.ValueAsStringUnsafe(&result_unsafe)); |
| 41 ASSERT_EQ("Foo bar", result_unsafe); | 42 ASSERT_EQ("Foo bar", result_unsafe); |
| 42 std::string result; | 43 std::string result; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 0x75, 0xc4, 0x8d, 0x69, 0xc4, 0x87}; | 325 0x75, 0xc4, 0x8d, 0x69, 0xc4, 0x87}; |
| 325 der::Input rdn_input(der); | 326 der::Input rdn_input(der); |
| 326 RDNSequence rdn; | 327 RDNSequence rdn; |
| 327 ASSERT_TRUE(ParseName(rdn_input, &rdn)); | 328 ASSERT_TRUE(ParseName(rdn_input, &rdn)); |
| 328 std::string output; | 329 std::string output; |
| 329 ASSERT_TRUE(ConvertToRFC2253(rdn, &output)); | 330 ASSERT_TRUE(ConvertToRFC2253(rdn, &output)); |
| 330 ASSERT_EQ("SN=Lu\\C4\\8Di\\C4\\87", output); | 331 ASSERT_EQ("SN=Lu\\C4\\8Di\\C4\\87", output); |
| 331 } | 332 } |
| 332 | 333 |
| 333 } // namespace net | 334 } // namespace net |
| OLD | NEW |