Index: net/base/sdch_dictionary_unittest.cc |
diff --git a/net/base/sdch_dictionary_unittest.cc b/net/base/sdch_dictionary_unittest.cc |
index d9fd92e7db41ba8e77791f8ed1287607cd219702..46696bc31ced75406e53f3025382bfe393238bcf 100644 |
--- a/net/base/sdch_dictionary_unittest.cc |
+++ b/net/base/sdch_dictionary_unittest.cc |
@@ -116,6 +116,23 @@ TEST(SdchDictionaryTest, PathMatch) { |
EXPECT_FALSE(PathMatch("/abc", "/ABC")); |
} |
+TEST(SdchDictionaryTest, DomainMatch) { |
+ bool (*DomainMatch)(const GURL& url, const std::string& restriction) = |
+ SdchDictionary::DomainMatch; |
+ EXPECT_TRUE(DomainMatch(GURL("http://example.com"), "example.com")); |
+ EXPECT_TRUE(DomainMatch(GURL("http://www.example.com"), ".example.com")); |
+ |
+ // Trailing dot handling |
+ EXPECT_TRUE(DomainMatch(GURL("http://example.com./"), "example.com")); |
+ EXPECT_TRUE(DomainMatch(GURL("http://example.com/"), "example.com.")); |
+ |
+ EXPECT_FALSE(DomainMatch(GURL("http://www.example.com"), "example.com")); |
+ EXPECT_FALSE(DomainMatch(GURL("http://badexample.com"), "example.com")); |
+ EXPECT_FALSE(DomainMatch(GURL("http://badexample.com"), ".example.com")); |
+ EXPECT_FALSE(DomainMatch(GURL("http://example.com.tld"), "example.com")); |
+ EXPECT_FALSE(DomainMatch(GURL("http://example.com.tld"), ".example.com")); |
+} |
+ |
TEST(SdchDictionaryTest, Expired) { |
EXPECT_TRUE( |
SdchDictionary("xyzzy", 0u, "ch", "sh", GURL("http://www.example.com"), |