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

Unified Diff: net/base/url_util_unittest.cc

Issue 1876683002: Implement SDCH Dictionary domain matching as per RFC 2965 Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Factor out IsDomainMatch from CanonicalCookie and use it in SdchDictionary. Created 4 years, 8 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
« no previous file with comments | « net/base/url_util.cc ('k') | net/cookies/canonical_cookie.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/url_util_unittest.cc
diff --git a/net/base/url_util_unittest.cc b/net/base/url_util_unittest.cc
index 3a7a1b4240c5fee75b542e9320f7aaa4485fd7b6..2d3cca5313a9b9b09868bc9f66cba2866d1f56db 100644
--- a/net/base/url_util_unittest.cc
+++ b/net/base/url_util_unittest.cc
@@ -582,5 +582,22 @@ TEST(UrlUtilTest, GoogleHost) {
}
}
+TEST(UrlUtilTest, IsDomainMatch) {
+ GURL url("http://www.example.com/test/foo.html");
+
+ std::string domain = "www.example.com";
+ EXPECT_TRUE(IsDomainMatch(domain, "www.example.com"));
+ EXPECT_FALSE(IsDomainMatch(domain, "foo.www.example.com"));
+ EXPECT_FALSE(IsDomainMatch(domain, "www0.example.com"));
+ EXPECT_FALSE(IsDomainMatch(domain, "example.com"));
+
+ domain = ".www.example.com";
+ EXPECT_TRUE(IsDomainMatch(domain, "www.example.com"));
+ EXPECT_TRUE(IsDomainMatch(domain, "www.example.com"));
+ EXPECT_TRUE(IsDomainMatch(domain, "foo.www.example.com"));
+ EXPECT_FALSE(IsDomainMatch(domain, "www0.example.com"));
+ EXPECT_FALSE(IsDomainMatch(domain, "example.com"));
+}
+
} // namespace
} // namespace net
« no previous file with comments | « net/base/url_util.cc ('k') | net/cookies/canonical_cookie.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698