| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 11 #include "net/http/http_auth_cache.h" | 12 #include "net/http/http_auth_cache.h" |
| 12 #include "net/http/http_auth_handler.h" | 13 #include "net/http/http_auth_handler.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 namespace net { | 16 namespace net { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 | 19 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 EXPECT_FALSE(update_failure); | 373 EXPECT_FALSE(update_failure); |
| 373 } | 374 } |
| 374 | 375 |
| 375 // Test fixture class for eviction tests (contains helpers for bulk | 376 // Test fixture class for eviction tests (contains helpers for bulk |
| 376 // insertion and existence testing). | 377 // insertion and existence testing). |
| 377 class HttpAuthCacheEvictionTest : public testing::Test { | 378 class HttpAuthCacheEvictionTest : public testing::Test { |
| 378 protected: | 379 protected: |
| 379 HttpAuthCacheEvictionTest() : origin_("http://www.google.com") { } | 380 HttpAuthCacheEvictionTest() : origin_("http://www.google.com") { } |
| 380 | 381 |
| 381 std::string GenerateRealm(int realm_i) { | 382 std::string GenerateRealm(int realm_i) { |
| 382 return StringPrintf("Realm %d", realm_i); | 383 return base::StringPrintf("Realm %d", realm_i); |
| 383 } | 384 } |
| 384 | 385 |
| 385 std::string GeneratePath(int realm_i, int path_i) { | 386 std::string GeneratePath(int realm_i, int path_i) { |
| 386 return StringPrintf("/%d/%d/x/y", realm_i, path_i); | 387 return base::StringPrintf("/%d/%d/x/y", realm_i, path_i); |
| 387 } | 388 } |
| 388 | 389 |
| 389 void AddRealm(int realm_i) { | 390 void AddRealm(int realm_i) { |
| 390 AddPathToRealm(realm_i, 0); | 391 AddPathToRealm(realm_i, 0); |
| 391 } | 392 } |
| 392 | 393 |
| 393 void AddPathToRealm(int realm_i, int path_i) { | 394 void AddPathToRealm(int realm_i, int path_i) { |
| 394 cache_.Add(origin_, GenerateRealm(realm_i), kBasic, "", | 395 cache_.Add(origin_, GenerateRealm(realm_i), kBasic, "", |
| 395 kUsername, kPassword, GeneratePath(realm_i, path_i)); | 396 kUsername, kPassword, GeneratePath(realm_i, path_i)); |
| 396 } | 397 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 CheckPathExistence(0, i, false); | 462 CheckPathExistence(0, i, false); |
| 462 | 463 |
| 463 for (int i = 0; i < kMaxPaths; ++i) | 464 for (int i = 0; i < kMaxPaths; ++i) |
| 464 CheckPathExistence(0, i + 3, true); | 465 CheckPathExistence(0, i + 3, true); |
| 465 | 466 |
| 466 for (int i = 0; i < kMaxRealms; ++i) | 467 for (int i = 0; i < kMaxRealms; ++i) |
| 467 CheckRealmExistence(i, true); | 468 CheckRealmExistence(i, true); |
| 468 } | 469 } |
| 469 | 470 |
| 470 } // namespace net | 471 } // namespace net |
| OLD | NEW |