| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |