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

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

Issue 10533102: Allow the omnibox to recognize as URLs inputs that have a host component that ends with a hyphen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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 | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/net_util.h" 5 #include "net/base/net_util.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 {"a.", "", true}, 767 {"a.", "", true},
768 {"a.a", "", true}, 768 {"a.a", "", true},
769 {"9.a", "", true}, 769 {"9.a", "", true},
770 {"a.9", "", false}, 770 {"a.9", "", false},
771 {"_9a", "", false}, 771 {"_9a", "", false},
772 {"-9a", "", false}, 772 {"-9a", "", false},
773 {"a.a9", "", true}, 773 {"a.a9", "", true},
774 {"a.9a", "", false}, 774 {"a.9a", "", false},
775 {"a+9a", "", false}, 775 {"a+9a", "", false},
776 {"-a.a9", "", true}, 776 {"-a.a9", "", true},
777 {"1-.a-b", "", false}, 777 {"1-.a-b", "", true},
778 {"1_.a-b", "", false},
778 {"1-2.a_b", "", true}, 779 {"1-2.a_b", "", true},
779 {"a.b.c.d.e", "", true}, 780 {"a.b.c.d.e", "", true},
780 {"1.2.3.4.e", "", true}, 781 {"1.2.3.4.e", "", true},
781 {"a.b.c.d.5", "", false}, 782 {"a.b.c.d.5", "", false},
782 {"1.2.3.4.e.", "", true}, 783 {"1.2.3.4.e.", "", true},
783 {"a.b.c.d.5.", "", false}, 784 {"a.b.c.d.5.", "", false},
784 }; 785 };
785 786
786 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(compliant_host_cases); ++i) { 787 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(compliant_host_cases); ++i) {
787 EXPECT_EQ(compliant_host_cases[i].expected_output, 788 EXPECT_EQ(compliant_host_cases[i].expected_output,
788 IsCanonicalizedHostCompliant(compliant_host_cases[i].host, 789 IsCanonicalizedHostCompliant(compliant_host_cases[i].host,
789 compliant_host_cases[i].desired_tld)); 790 compliant_host_cases[i].desired_tld));
790 } 791 }
791 } 792 }
792 793
793 TEST(NetUtilTest, StripWWW) { 794 TEST(NetUtilTest, StripWWW) {
794 EXPECT_EQ(string16(), StripWWW(string16())); 795 EXPECT_EQ(string16(), StripWWW(string16()));
795 EXPECT_EQ(string16(), StripWWW(ASCIIToUTF16("www."))); 796 EXPECT_EQ(string16(), StripWWW(ASCIIToUTF16("www.")));
796 EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("www.blah"))); 797 EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("www.blah")));
797 EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("blah"))); 798 EXPECT_EQ(ASCIIToUTF16("blah"), StripWWW(ASCIIToUTF16("blah")));
798 } 799 }
799 800
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 if (it->address[i] != 0) { 3218 if (it->address[i] != 0) {
3218 all_zeroes = false; 3219 all_zeroes = false;
3219 break; 3220 break;
3220 } 3221 }
3221 } 3222 }
3222 EXPECT_FALSE(all_zeroes); 3223 EXPECT_FALSE(all_zeroes);
3223 } 3224 }
3224 } 3225 }
3225 3226
3226 } // namespace net 3227 } // namespace net
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