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

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

Issue 340070: Allow trailing dots on hostnames.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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/net_util.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "net/base/escape.h" 10 #include "net/base/escape.h"
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 814 }
815 } 815 }
816 } 816 }
817 817
818 TEST(NetUtilTest, CompliantHost) { 818 TEST(NetUtilTest, CompliantHost) {
819 const CompliantHostCase compliant_host_cases[] = { 819 const CompliantHostCase compliant_host_cases[] = {
820 {"", false}, 820 {"", false},
821 {"a", true}, 821 {"a", true},
822 {"-", false}, 822 {"-", false},
823 {".", false}, 823 {".", false},
824 {"a.", false}, 824 {"a.", true},
825 {"a.a", true}, 825 {"a.a", true},
826 {"9.a", true}, 826 {"9.a", true},
827 {"a.9", false}, 827 {"a.9", false},
828 {"_9a", false}, 828 {"_9a", false},
829 {"a.a9", true}, 829 {"a.a9", true},
830 {"a.9a", false}, 830 {"a.9a", false},
831 {"a+9a", false}, 831 {"a+9a", false},
832 {"1-.a-b", false}, 832 {"1-.a-b", false},
833 {"1-2.a_b", true}, 833 {"1-2.a_b", true},
834 {"a.b.c.d.e", true}, 834 {"a.b.c.d.e", true},
835 {"1.2.3.4.e", true}, 835 {"1.2.3.4.e", true},
836 {"a.b.c.d.5", false}, 836 {"a.b.c.d.5", false},
837 {"1.2.3.4.e.", true},
838 {"a.b.c.d.5.", false},
837 }; 839 };
838 840
839 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(compliant_host_cases); ++i) { 841 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(compliant_host_cases); ++i) {
840 EXPECT_EQ(compliant_host_cases[i].expected_output, 842 EXPECT_EQ(compliant_host_cases[i].expected_output,
841 net::IsCanonicalizedHostCompliant(compliant_host_cases[i].host)); 843 net::IsCanonicalizedHostCompliant(compliant_host_cases[i].host));
842 } 844 }
843 } 845 }
844 846
845 TEST(NetUtilTest, StripWWW) { 847 TEST(NetUtilTest, StripWWW) {
846 EXPECT_EQ(L"", net::StripWWW(L"")); 848 EXPECT_EQ(L"", net::StripWWW(L""));
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 net::SetExplicitlyAllowedPorts(invalid[i]); 1442 net::SetExplicitlyAllowedPorts(invalid[i]);
1441 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size())); 1443 EXPECT_EQ(0, static_cast<int>(net::explicitly_allowed_ports.size()));
1442 } 1444 }
1443 1445
1444 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) { 1446 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(valid); ++i) {
1445 net::SetExplicitlyAllowedPorts(valid[i]); 1447 net::SetExplicitlyAllowedPorts(valid[i]);
1446 EXPECT_EQ(i, net::explicitly_allowed_ports.size()); 1448 EXPECT_EQ(i, net::explicitly_allowed_ports.size());
1447 } 1449 }
1448 } 1450 }
1449 1451
OLDNEW
« no previous file with comments | « net/base/net_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698