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

Side by Side Diff: net/base/dns_util_unittest.cc

Issue 54623005: net: allow invalid TransportSecurityState to process invalid DNS names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix browser tests. Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/base/dns_util.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/base/dns_util.h" 5 #include "net/base/dns_util.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace net { 8 namespace net {
9 9
10 class DNSUtilTest : public testing::Test { 10 class DNSUtilTest : public testing::Test {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DNSDomainToString(IncludeNUL("\003foo\003bar\002uk"))); 63 DNSDomainToString(IncludeNUL("\003foo\003bar\002uk")));
64 64
65 // It should cope with a lack of root label. 65 // It should cope with a lack of root label.
66 EXPECT_EQ("foo.bar", DNSDomainToString("\003foo\003bar")); 66 EXPECT_EQ("foo.bar", DNSDomainToString("\003foo\003bar"));
67 67
68 // Invalid inputs should return an empty string. 68 // Invalid inputs should return an empty string.
69 EXPECT_EQ("", DNSDomainToString(IncludeNUL("\x80"))); 69 EXPECT_EQ("", DNSDomainToString(IncludeNUL("\x80")));
70 EXPECT_EQ("", DNSDomainToString("\x06")); 70 EXPECT_EQ("", DNSDomainToString("\x06"));
71 } 71 }
72 72
73 TEST_F(DNSUtilTest, STD3ASCII) {
74 EXPECT_TRUE(IsSTD3ASCIIValidCharacter('a'));
75 EXPECT_TRUE(IsSTD3ASCIIValidCharacter('b'));
76 EXPECT_TRUE(IsSTD3ASCIIValidCharacter('c'));
77 EXPECT_TRUE(IsSTD3ASCIIValidCharacter('1'));
78 EXPECT_TRUE(IsSTD3ASCIIValidCharacter('2'));
79 EXPECT_TRUE(IsSTD3ASCIIValidCharacter('3'));
80
81 EXPECT_FALSE(IsSTD3ASCIIValidCharacter('.'));
82 EXPECT_FALSE(IsSTD3ASCIIValidCharacter('/'));
83 EXPECT_FALSE(IsSTD3ASCIIValidCharacter('\x00'));
84 }
85
86 } // namespace net 73 } // namespace net
OLDNEW
« no previous file with comments | « net/base/dns_util.cc ('k') | net/http/transport_security_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698