| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/ftp/ftp_auth_cache.h" | 5 #include "net/ftp/ftp_auth_cache.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" |
| 9 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 12 |
| 12 using net::FtpAuthCache; | 13 using net::FtpAuthCache; |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 const string16 kBogus(ASCIIToUTF16("bogus")); | 17 const string16 kBogus(ASCIIToUTF16("bogus")); |
| 17 const string16 kOthername(ASCIIToUTF16("othername")); | 18 const string16 kOthername(ASCIIToUTF16("othername")); |
| 18 const string16 kOtherword(ASCIIToUTF16("otherword")); | 19 const string16 kOtherword(ASCIIToUTF16("otherword")); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Adding one entry should cause eviction of the first entry. | 147 // Adding one entry should cause eviction of the first entry. |
| 147 cache.Add(GURL("ftp://last_host"), kUsername, kPassword); | 148 cache.Add(GURL("ftp://last_host"), kUsername, kPassword); |
| 148 EXPECT_TRUE(cache.Lookup(GURL("ftp://host0")) == NULL); | 149 EXPECT_TRUE(cache.Lookup(GURL("ftp://host0")) == NULL); |
| 149 | 150 |
| 150 // Remaining entries should not get evicted. | 151 // Remaining entries should not get evicted. |
| 151 for (size_t i = 1; i < FtpAuthCache::kMaxEntries; i++) { | 152 for (size_t i = 1; i < FtpAuthCache::kMaxEntries; i++) { |
| 152 EXPECT_TRUE(cache.Lookup(GURL("ftp://host" + base::IntToString(i)))); | 153 EXPECT_TRUE(cache.Lookup(GURL("ftp://host" + base::IntToString(i)))); |
| 153 } | 154 } |
| 154 EXPECT_TRUE(cache.Lookup(GURL("ftp://last_host"))); | 155 EXPECT_TRUE(cache.Lookup(GURL("ftp://last_host"))); |
| 155 } | 156 } |
| OLD | NEW |