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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/perftimer.h" | 7 #include "base/perftimer.h" |
8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 base::Time t = base::Time::Now(); | 58 base::Time t = base::Time::Now(); |
59 for (int domain_num = 0; domain_num < 300; domain_num++) { | 59 for (int domain_num = 0; domain_num < 300; domain_num++) { |
60 std::string domain_name(base::StringPrintf(".domain_%d.com", domain_num)); | 60 std::string domain_name(base::StringPrintf(".domain_%d.com", domain_num)); |
61 GURL gurl("www" + domain_name); | 61 GURL gurl("www" + domain_name); |
62 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { | 62 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { |
63 t += base::TimeDelta::FromInternalValue(10); | 63 t += base::TimeDelta::FromInternalValue(10); |
64 store_->AddCookie( | 64 store_->AddCookie( |
65 net::CookieMonster::CanonicalCookie(gurl, | 65 net::CookieMonster::CanonicalCookie(gurl, |
66 base::StringPrintf("Cookie_%d", cookie_num), "1", | 66 base::StringPrintf("Cookie_%d", cookie_num), "1", |
67 domain_name, "/", std::string(), std::string(), | 67 domain_name, "/", std::string(), std::string(), |
68 t, t, t, false, false, true, true)); | 68 t, t, t, false, false)); |
69 } | 69 } |
70 } | 70 } |
71 // Replace the store effectively destroying the current one and forcing it | 71 // Replace the store effectively destroying the current one and forcing it |
72 // to write its data to disk. | 72 // to write its data to disk. |
73 store_ = NULL; | 73 store_ = NULL; |
74 scoped_refptr<base::ThreadTestHelper> helper( | 74 scoped_refptr<base::ThreadTestHelper> helper( |
75 new base::ThreadTestHelper( | 75 new base::ThreadTestHelper( |
76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
77 // Make sure we wait until the destructor has run. | 77 // Make sure we wait until the destructor has run. |
78 ASSERT_TRUE(helper->Run()); | 78 ASSERT_TRUE(helper->Run()); |
(...skipping 29 matching lines...) Expand all Loading... |
108 } | 108 } |
109 | 109 |
110 // Test the performance of load | 110 // Test the performance of load |
111 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { | 111 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { |
112 PerfTimeLogger timer("Load all cookies"); | 112 PerfTimeLogger timer("Load all cookies"); |
113 Load(); | 113 Load(); |
114 timer.Done(); | 114 timer.Done(); |
115 | 115 |
116 ASSERT_EQ(15000U, cookies_.size()); | 116 ASSERT_EQ(15000U, cookies_.size()); |
117 } | 117 } |
OLD | NEW |