| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 timer2.Done(); | 277 timer2.Done(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 TEST_F(CookieMonsterTest, TestImport) { | 280 TEST_F(CookieMonsterTest, TestImport) { |
| 281 scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore); | 281 scoped_refptr<MockPersistentCookieStore> store(new MockPersistentCookieStore); |
| 282 std::vector<CanonicalCookie*> initial_cookies; | 282 std::vector<CanonicalCookie*> initial_cookies; |
| 283 GetCookiesCallback getCookiesCallback; | 283 GetCookiesCallback getCookiesCallback; |
| 284 | 284 |
| 285 // We want to setup a fairly large backing store, with 300 domains of 50 | 285 // We want to setup a fairly large backing store, with 300 domains of 50 |
| 286 // cookies each. Creation times must be unique. | 286 // cookies each. Creation times must be unique. |
| 287 int64 time_tick(base::Time::Now().ToInternalValue()); | 287 int64_t time_tick(base::Time::Now().ToInternalValue()); |
| 288 | 288 |
| 289 for (int domain_num = 0; domain_num < 300; domain_num++) { | 289 for (int domain_num = 0; domain_num < 300; domain_num++) { |
| 290 std::string domain_name(base::StringPrintf(".Domain_%d.com", domain_num)); | 290 std::string domain_name(base::StringPrintf(".Domain_%d.com", domain_num)); |
| 291 std::string gurl("www" + domain_name); | 291 std::string gurl("www" + domain_name); |
| 292 for (int cookie_num = 0; cookie_num < 50; cookie_num++) { | 292 for (int cookie_num = 0; cookie_num < 50; cookie_num++) { |
| 293 std::string cookie_line( | 293 std::string cookie_line( |
| 294 base::StringPrintf("Cookie_%d=1; Path=/", cookie_num)); | 294 base::StringPrintf("Cookie_%d=1; Path=/", cookie_num)); |
| 295 AddCookieToList(gurl, cookie_line, | 295 AddCookieToList(gurl, cookie_line, |
| 296 base::Time::FromInternalValue(time_tick++), | 296 base::Time::FromInternalValue(time_tick++), |
| 297 &initial_cookies); | 297 &initial_cookies); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); | 380 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); |
| 381 | 381 |
| 382 base::PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); | 382 base::PerfTimeLogger timer((std::string("GC_") + test_case.name).c_str()); |
| 383 for (int i = 0; i < kNumCookies; i++) | 383 for (int i = 0; i < kNumCookies; i++) |
| 384 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); | 384 setCookieCallback.SetCookie(cm.get(), gurl, cookie_line); |
| 385 timer.Done(); | 385 timer.Done(); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace net | 389 } // namespace net |
| OLD | NEW |