| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 // shouldn't do). | 356 // shouldn't do). |
| 357 CookieMonster::kMaxCookies * 2, | 357 CookieMonster::kMaxCookies * 2, |
| 358 CookieMonster::kMaxCookies * 3 / 4, | 358 CookieMonster::kMaxCookies * 3 / 4, |
| 359 }, { | 359 }, { |
| 360 "less_than_gc_thresh", | 360 "less_than_gc_thresh", |
| 361 // Few enough cookies that gc shouldn't happen at all. | 361 // Few enough cookies that gc shouldn't happen at all. |
| 362 CookieMonster::kMaxCookies - 5, | 362 CookieMonster::kMaxCookies - 5, |
| 363 0, | 363 0, |
| 364 }, | 364 }, |
| 365 }; | 365 }; |
| 366 for (int ci = 0; ci < static_cast<int>(ARRAYSIZE_UNSAFE(test_cases)); ++ci) { | 366 for (int ci = 0; ci < static_cast<int>(arraysize(test_cases)); ++ci) { |
| 367 const TestCase& test_case(test_cases[ci]); | 367 const TestCase& test_case(test_cases[ci]); |
| 368 scoped_refptr<CookieMonster> cm( | 368 scoped_refptr<CookieMonster> cm( |
| 369 CreateMonsterFromStoreForGC( | 369 CreateMonsterFromStoreForGC( |
| 370 test_case.num_cookies, test_case.num_old_cookies, | 370 test_case.num_cookies, test_case.num_old_cookies, |
| 371 CookieMonster::kSafeFromGlobalPurgeDays * 2)); | 371 CookieMonster::kSafeFromGlobalPurgeDays * 2)); |
| 372 | 372 |
| 373 GURL gurl("http://google.com"); | 373 GURL gurl("http://google.com"); |
| 374 std::string cookie_line("z=3"); | 374 std::string cookie_line("z=3"); |
| 375 // Trigger the Garbage collection we're allowed. | 375 // Trigger the Garbage collection we're allowed. |
| 376 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); | 376 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); |
| 377 | 377 |
| 378 base::PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); | 378 base::PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); |
| 379 for (int i = 0; i < kNumCookies; i++) | 379 for (int i = 0; i < kNumCookies; i++) |
| 380 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); | 380 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); |
| 381 timer.Done(); | 381 timer.Done(); |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 } // namespace net | 385 } // namespace net |
| OLD | NEW |