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/verify_name_match.h" | 5 #include "net/cert/internal/verify_name_match.h" |
6 | 6 |
7 #include "net/der/input.h" | 7 #include "net/der/input.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 { |
11 | 11 |
12 TEST(VerifyNameMatchTest, Simple) { | 12 TEST(VerifyNameMatchTest, Simple) { |
13 // TODO(mattm): Use valid Names. | 13 // TODO(mattm): Use valid Names. |
14 EXPECT_TRUE(VerifyNameMatch(der::Input("hello"), der::Input("hello"))); | 14 const uint8_t hello[] = {'h', 'e', 'l', 'l', 'o'}; |
15 EXPECT_FALSE(VerifyNameMatch(der::Input("aello"), der::Input("hello"))); | 15 const uint8_t aello[] = {'a', 'e', 'l', 'l', 'o'}; |
16 EXPECT_FALSE(VerifyNameMatch(der::Input("hello"), der::Input("hello1"))); | 16 const uint8_t hello1[] = {'h', 'e', 'l', 'l', 'o', '1'}; |
17 EXPECT_FALSE(VerifyNameMatch(der::Input("hello1"), der::Input("hello"))); | 17 EXPECT_TRUE(VerifyNameMatch(der::Input(hello), der::Input(hello))); |
| 18 EXPECT_FALSE(VerifyNameMatch(der::Input(aello), der::Input(hello))); |
| 19 EXPECT_FALSE(VerifyNameMatch(der::Input(hello), der::Input(hello1))); |
| 20 EXPECT_FALSE(VerifyNameMatch(der::Input(hello1), der::Input(hello))); |
18 } | 21 } |
19 | 22 |
20 } // namespace net | 23 } // namespace net |
OLD | NEW |