summaryrefslogtreecommitdiffstats
path: root/net/base/net_util_unittest.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 20:05:59 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 20:05:59 +0000
commit7e563816b35dcc102eb69849295b5f6f9d048a63 (patch)
treeb6a833b3b32b58ed8453f1d63682c77d6b158d08 /net/base/net_util_unittest.cc
parent1679e8667e258a9903a18792894e13a17639e122 (diff)
downloadchromium_src-7e563816b35dcc102eb69849295b5f6f9d048a63.zip
chromium_src-7e563816b35dcc102eb69849295b5f6f9d048a63.tar.gz
chromium_src-7e563816b35dcc102eb69849295b5f6f9d048a63.tar.bz2
Make various types of input work better with ctrl-enter. If we detected that the hostname without adding the TLD was illegal, we'd sometimes fail to allow the TLD to be added.
BUG=38605 TEST=Should be able to hit ctrl-enter on "401k" and "999999999999" to open them with www. and .com attached. Review URL: http://codereview.chromium.org/1088004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42246 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util_unittest.cc')
-rw-r--r--net/base/net_util_unittest.cc46
1 files changed, 26 insertions, 20 deletions
diff --git a/net/base/net_util_unittest.cc b/net/base/net_util_unittest.cc
index e9fda58..09573b1 100644
--- a/net/base/net_util_unittest.cc
+++ b/net/base/net_util_unittest.cc
@@ -348,6 +348,7 @@ struct AdjustOffsetCase {
struct CompliantHostCase {
const char* host;
+ const char* desired_tld;
bool expected_output;
};
@@ -838,30 +839,35 @@ TEST(NetUtilTest, IDNToUnicodeAdjustOffset) {
TEST(NetUtilTest, CompliantHost) {
const CompliantHostCase compliant_host_cases[] = {
- {"", false},
- {"a", true},
- {"-", false},
- {".", false},
- {"a.", true},
- {"a.a", true},
- {"9.a", true},
- {"a.9", false},
- {"_9a", false},
- {"a.a9", true},
- {"a.9a", false},
- {"a+9a", false},
- {"1-.a-b", false},
- {"1-2.a_b", true},
- {"a.b.c.d.e", true},
- {"1.2.3.4.e", true},
- {"a.b.c.d.5", false},
- {"1.2.3.4.e.", true},
- {"a.b.c.d.5.", false},
+ {"", "", false},
+ {"a", "", true},
+ {"-", "", false},
+ {".", "", false},
+ {"9", "", false},
+ {"9", "a", true},
+ {"9a", "", false},
+ {"9a", "a", true},
+ {"a.", "", true},
+ {"a.a", "", true},
+ {"9.a", "", true},
+ {"a.9", "", false},
+ {"_9a", "", false},
+ {"a.a9", "", true},
+ {"a.9a", "", false},
+ {"a+9a", "", false},
+ {"1-.a-b", "", false},
+ {"1-2.a_b", "", true},
+ {"a.b.c.d.e", "", true},
+ {"1.2.3.4.e", "", true},
+ {"a.b.c.d.5", "", false},
+ {"1.2.3.4.e.", "", true},
+ {"a.b.c.d.5.", "", false},
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(compliant_host_cases); ++i) {
EXPECT_EQ(compliant_host_cases[i].expected_output,
- net::IsCanonicalizedHostCompliant(compliant_host_cases[i].host));
+ net::IsCanonicalizedHostCompliant(compliant_host_cases[i].host,
+ compliant_host_cases[i].desired_tld));
}
}