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.h" | 8 #include "base/message_loop.h" |
9 #include "base/perftimer.h" | 9 #include "base/perftimer.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // if GC runs twice in a row without any change to the store, the second | 370 // if GC runs twice in a row without any change to the store, the second |
371 // GC run will not do anything the first one didn't. That's why this is | 371 // GC run will not do anything the first one didn't. That's why this is |
372 // a performance test. The test should be considered to pass if all the | 372 // a performance test. The test should be considered to pass if all the |
373 // times reported are approximately the same--this indicates that no GC | 373 // times reported are approximately the same--this indicates that no GC |
374 // happened repeatedly for any case. | 374 // happened repeatedly for any case. |
375 TEST_F(CookieMonsterTest, TestGCTimes) { | 375 TEST_F(CookieMonsterTest, TestGCTimes) { |
376 SetCookieCallback setCookieCallback; | 376 SetCookieCallback setCookieCallback; |
377 | 377 |
378 const struct TestCase { | 378 const struct TestCase { |
379 const char* name; | 379 const char* name; |
380 int num_cookies; | 380 size_t num_cookies; |
381 int num_old_cookies; | 381 size_t num_old_cookies; |
382 } test_cases[] = { | 382 } test_cases[] = { |
383 { | 383 { |
384 // A whole lot of recent cookies; gc shouldn't happen. | 384 // A whole lot of recent cookies; gc shouldn't happen. |
385 "all_recent", | 385 "all_recent", |
386 CookieMonster::kMaxCookies * 2, | 386 CookieMonster::kMaxCookies * 2, |
387 0, | 387 0, |
388 }, { | 388 }, { |
389 // Some old cookies, but still overflowing max. | 389 // Some old cookies, but still overflowing max. |
390 "mostly_recent", | 390 "mostly_recent", |
391 CookieMonster::kMaxCookies * 2, | 391 CookieMonster::kMaxCookies * 2, |
(...skipping 29 matching lines...) Expand all Loading... |
421 setCookieCallback.SetCookie(cm, gurl, cookie_line); | 421 setCookieCallback.SetCookie(cm, gurl, cookie_line); |
422 | 422 |
423 PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); | 423 PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); |
424 for (int i = 0; i < kNumCookies; i++) | 424 for (int i = 0; i < kNumCookies; i++) |
425 setCookieCallback.SetCookie(cm, gurl, cookie_line); | 425 setCookieCallback.SetCookie(cm, gurl, cookie_line); |
426 timer.Done(); | 426 timer.Done(); |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 } // namespace net | 430 } // namespace net |
OLD | NEW |