Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(878)

Side by Side Diff: net/cert/internal/verify_name_match_unittest.cc

Issue 1160643002: Remove dangerous std::string constructor for der::Input (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix null-terminated strings bug, and use a static factory method instead of another constructor Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/der/input.h » ('j') | net/der/input.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 EXPECT_TRUE(VerifyNameMatch(der::Input::FromCString("hello"),
15 EXPECT_FALSE(VerifyNameMatch(der::Input("aello"), der::Input("hello"))); 15 der::Input::FromCString("hello")));
16 EXPECT_FALSE(VerifyNameMatch(der::Input("hello"), der::Input("hello1"))); 16 EXPECT_FALSE(VerifyNameMatch(der::Input::FromCString("aello"),
17 EXPECT_FALSE(VerifyNameMatch(der::Input("hello1"), der::Input("hello"))); 17 der::Input::FromCString("hello")));
18 EXPECT_FALSE(VerifyNameMatch(der::Input::FromCString("hello"),
19 der::Input::FromCString("hello1")));
20 EXPECT_FALSE(VerifyNameMatch(der::Input::FromCString("hello1"),
21 der::Input::FromCString("hello")));
18 } 22 }
19 23
20 } // namespace net 24 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/der/input.h » ('j') | net/der/input.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698