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

Unified Diff: net/base/net_util_unittest.cc

Issue 271116: Classify more types of input as queries.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« chrome/browser/autocomplete/autocomplete.cc ('K') | « net/base/net_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/net_util_unittest.cc
===================================================================
--- net/base/net_util_unittest.cc (revision 29226)
+++ net/base/net_util_unittest.cc (working copy)
@@ -344,6 +344,11 @@
#endif
};
+struct RFC1738Case {
+ const char* host;
+ bool expected_output;
+};
+
struct SuggestedFilenameCase {
const char* url;
const char* content_disp_header;
@@ -810,6 +815,32 @@
}
}
+TEST(NetUtilTest, RFC1738) {
+ const RFC1738Case rfc1738_cases[] = {
+ {"", false},
+ {"a", true},
+ {"-", false},
+ {".", false},
+ {"a.", false},
+ {"a.a", true},
+ {"9.a", true},
+ {"a.9", 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},
+ };
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(rfc1738_cases); ++i) {
+ EXPECT_EQ(rfc1738_cases[i].expected_output,
+ net::IsCanonicalizedHostRFC1738Compliant(rfc1738_cases[i].host));
+ }
+}
+
TEST(NetUtilTest, StripWWW) {
EXPECT_EQ(L"", net::StripWWW(L""));
EXPECT_EQ(L"", net::StripWWW(L"www."));
« chrome/browser/autocomplete/autocomplete.cc ('K') | « net/base/net_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698