diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 00:28:39 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-16 00:28:39 +0000 |
commit | daf05f5e8239e890828020241524faf96732fa7d (patch) | |
tree | 7bb9ba1991bbc33fcd5df06724824da2f66beacb /net/ftp | |
parent | cc2aa4193b5dbf3d4edeb4d3c33c94733c0b81d9 (diff) | |
download | chromium_src-daf05f5e8239e890828020241524faf96732fa7d.zip chromium_src-daf05f5e8239e890828020241524faf96732fa7d.tar.gz chromium_src-daf05f5e8239e890828020241524faf96732fa7d.tar.bz2 |
Add another test case.
Review URL: http://codereview.chromium.org/18111
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8144 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r-- | net/ftp/ftp_auth_cache_unittest.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ftp/ftp_auth_cache_unittest.cc b/net/ftp/ftp_auth_cache_unittest.cc index 1164540..7f66a60 100644 --- a/net/ftp/ftp_auth_cache_unittest.cc +++ b/net/ftp/ftp_auth_cache_unittest.cc @@ -67,4 +67,29 @@ TEST(FtpAuthCacheTest, LookupWithPort) { EXPECT_EQ(data2.get(), cache.Lookup(origin2)); } +TEST(FtpAuthCacheTest, NormalizedKey) { + // GURL is automatically canonicalized. Hence the following variations in + // url format should all map to the same entry (case insensitive host, + // default port of 21). + FtpAuthCache cache; + + scoped_refptr<AuthData> data1(new AuthData()); + scoped_refptr<AuthData> data2(new AuthData()); + + // Add. + cache.Add(GURL("ftp://HoSt:21"), data1.get()); + + // Lookup. + EXPECT_EQ(data1.get(), cache.Lookup(GURL("ftp://HoSt:21"))); + EXPECT_EQ(data1.get(), cache.Lookup(GURL("ftp://host:21"))); + EXPECT_EQ(data1.get(), cache.Lookup(GURL("ftp://host"))); + + // Overwrite. + cache.Add(GURL("ftp://host"), data2.get()); + EXPECT_EQ(data2.get(), cache.Lookup(GURL("ftp://HoSt:21"))); + + // Remove + cache.Remove(GURL("ftp://HOsT")); + EXPECT_EQ(NULL, cache.Lookup(GURL("ftp://host"))); +} |