OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { | 61 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { |
62 t += base::TimeDelta::FromInternalValue(10); | 62 t += base::TimeDelta::FromInternalValue(10); |
63 store_->AddCookie( | 63 store_->AddCookie( |
64 net::CookieMonster::CanonicalCookie(gurl, | 64 net::CookieMonster::CanonicalCookie(gurl, |
65 base::StringPrintf("Cookie_%d", cookie_num), "1", | 65 base::StringPrintf("Cookie_%d", cookie_num), "1", |
66 domain_name, "/", std::string(), std::string(), | 66 domain_name, "/", std::string(), std::string(), |
67 t, t, t, false, false, true)); | 67 t, t, t, false, false, true)); |
68 } | 68 } |
69 } | 69 } |
70 // Replace the store effectively destroying the current one and forcing it | 70 // Replace the store effectively destroying the current one and forcing it |
71 // to write it's data to disk. | 71 // to write its data to disk. |
72 store_ = NULL; | 72 store_ = NULL; |
73 scoped_refptr<base::ThreadTestHelper> helper( | 73 scoped_refptr<base::ThreadTestHelper> helper( |
74 new base::ThreadTestHelper( | 74 new base::ThreadTestHelper( |
75 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 75 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
76 // Make sure we wait until the destructor has run. | 76 // Make sure we wait until the destructor has run. |
77 ASSERT_TRUE(helper->Run()); | 77 ASSERT_TRUE(helper->Run()); |
78 | 78 |
79 store_ = new SQLitePersistentCookieStore( | 79 store_ = new SQLitePersistentCookieStore( |
80 temp_dir_.path().Append(chrome::kCookieFilename)); | 80 temp_dir_.path().Append(chrome::kCookieFilename)); |
81 } | 81 } |
(...skipping 25 matching lines...) Expand all Loading... |
107 } | 107 } |
108 | 108 |
109 // Test the performance of load | 109 // Test the performance of load |
110 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { | 110 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { |
111 PerfTimeLogger timer("Load all cookies"); | 111 PerfTimeLogger timer("Load all cookies"); |
112 Load(); | 112 Load(); |
113 timer.Done(); | 113 timer.Done(); |
114 | 114 |
115 ASSERT_EQ(15000U, cookies_.size()); | 115 ASSERT_EQ(15000U, cookies_.size()); |
116 } | 116 } |
OLD | NEW |