| Index: net/base/sdch_manager_unittest.cc
|
| diff --git a/net/base/sdch_manager_unittest.cc b/net/base/sdch_manager_unittest.cc
|
| index 83418adde7dc782bef8702fb9744fcbeb6bd2abd..e3d39780f59b544c0efacee42db39475a5cba0b1 100644
|
| --- a/net/base/sdch_manager_unittest.cc
|
| +++ b/net/base/sdch_manager_unittest.cc
|
| @@ -278,6 +278,15 @@ TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionary) {
|
| GURL("http://w.x.y.z.google.com")));
|
| }
|
|
|
| +TEST_F(SdchManagerTest, FailToSetDotHostPrefixDomainDictionaryTrailingDot) {
|
| + std::string dictionary_domain("x.y.z.google.com");
|
| + std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
| +
|
| + // Fail the HD with D being the domain and H having a dot requirement.
|
| + EXPECT_FALSE(AddSdchDictionary(dictionary_text,
|
| + GURL("http://w.x.y.z.google.com.")));
|
| +}
|
| +
|
| TEST_F(SdchManagerTest, FailToSetRepeatPrefixWithDotDictionary) {
|
| // Make sure that a prefix that matches the domain postfix won't confuse
|
| // the validation checks.
|
| @@ -300,6 +309,41 @@ TEST_F(SdchManagerTest, CanSetLeadingDotDomainDictionary) {
|
| EXPECT_TRUE(AddSdchDictionary(dictionary_text, GURL("http://www.google.com")));
|
| }
|
|
|
| +TEST_F(SdchManagerTest, CanSetLeadingDotDomainDictionaryFQDN) {
|
| + // Make sure that a prefix that matches the domain postfix won't confuse
|
| + // the validation checks.
|
| + std::string dictionary_domain(".google.com");
|
| + std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
| +
|
| + // Verify that a leading dot in the domain is acceptable, as long as the host
|
| + // name does not contain any dots preceding the matched domain name.
|
| + EXPECT_TRUE(AddSdchDictionary(dictionary_text,
|
| + GURL("http://www.google.com.")));
|
| +}
|
| +
|
| +TEST_F(SdchManagerTest, CannotSetLeadingDotDomainDictionary) {
|
| + // Make sure that a prefix that matches the domain postfix won't confuse
|
| + // the validation checks.
|
| + std::string dictionary_domain(".google.com");
|
| + std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
| +
|
| + // Verify that a leading dot in the domain does not affect the name containing
|
| + // dots failure.
|
| + EXPECT_FALSE(AddSdchDictionary(dictionary_text,
|
| + GURL("http://www.subdomain.google.com")));
|
| +}
|
| +
|
| +TEST_F(SdchManagerTest, CannotSetLeadingDotDomainDictionaryFQDN) {
|
| + // Make sure that a prefix that matches the domain postfix won't confuse
|
| + // the validation checks.
|
| + std::string dictionary_domain(".google.com");
|
| + std::string dictionary_text(NewSdchDictionary(dictionary_domain));
|
| +
|
| + // Verify that a FQDN doesn't affect . in hostname checking.
|
| + EXPECT_FALSE(AddSdchDictionary(dictionary_text,
|
| + GURL("http://www.subdomain.google.com.")));
|
| +}
|
| +
|
| // Make sure the order of the tests is not helping us or confusing things.
|
| // See test CanSetExactMatchDictionary above for first try.
|
| TEST_F(SdchManagerTest, CanStillSetExactMatchDictionary) {
|
|
|