| Index: url/url_canon_unittest.cc
 | 
| diff --git a/url/url_canon_unittest.cc b/url/url_canon_unittest.cc
 | 
| index 837bc19f0821bbae0713a8e9020b8da2a8ecb37a..caaff08de61fdf37fb8f771f08431500cee8761a 100644
 | 
| --- a/url/url_canon_unittest.cc
 | 
| +++ b/url/url_canon_unittest.cc
 | 
| @@ -887,6 +887,50 @@ TEST(URLCanonTest, IPEmpty) {
 | 
|    EXPECT_FALSE(host_info.IsIPAddress());
 | 
|  }
 | 
|  
 | 
| +// Verifies that CanonicalizeHostSubstring produces the expected output and
 | 
| +// does not "fix" IP addresses. Because this code is a subset of
 | 
| +// CanonicalizeHost, the shared functionality is not tested.
 | 
| +TEST(URLCanonTest, CanonicalizeHostSubstring) {
 | 
| +  // Basic sanity check.
 | 
| +  {
 | 
| +    std::string out_str;
 | 
| +    StdStringCanonOutput output(&out_str);
 | 
| +    EXPECT_TRUE(CanonicalizeHostSubstring("M\xc3\x9cNCHEN.com",
 | 
| +                                          Component(0, 12), &output));
 | 
| +    output.Complete();
 | 
| +    EXPECT_EQ("xn--mnchen-3ya.com", out_str);
 | 
| +  }
 | 
| +
 | 
| +  // Failure case.
 | 
| +  {
 | 
| +    std::string out_str;
 | 
| +    StdStringCanonOutput output(&out_str);
 | 
| +    EXPECT_FALSE(CanonicalizeHostSubstring(
 | 
| +        WStringToUTF16(L"\xfdd0zyx.com").c_str(), Component(0, 8), &output));
 | 
| +    output.Complete();
 | 
| +    EXPECT_EQ("%EF%BF%BDzyx.com", out_str);
 | 
| +  }
 | 
| +
 | 
| +  // Should return true for empty input strings.
 | 
| +  {
 | 
| +    std::string out_str;
 | 
| +    StdStringCanonOutput output(&out_str);
 | 
| +    EXPECT_TRUE(CanonicalizeHostSubstring("", Component(0, 0), &output));
 | 
| +    output.Complete();
 | 
| +    EXPECT_EQ(std::string(), out_str);
 | 
| +  }
 | 
| +
 | 
| +  // Numbers that look like IP addresses should not be changed.
 | 
| +  {
 | 
| +    std::string out_str;
 | 
| +    StdStringCanonOutput output(&out_str);
 | 
| +    EXPECT_TRUE(
 | 
| +        CanonicalizeHostSubstring("01.02.03.04", Component(0, 11), &output));
 | 
| +    output.Complete();
 | 
| +    EXPECT_EQ("01.02.03.04", out_str);
 | 
| +  }
 | 
| +}
 | 
| +
 | 
|  TEST(URLCanonTest, UserInfo) {
 | 
|    // Note that the canonicalizer should escape and treat empty components as
 | 
|    // not being there.
 | 
| 
 |