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" |
11 #include "base/test/thread_test_helper.h" | 11 #include "base/test/thread_test_helper.h" |
12 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" | 12 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "content/test/test_browser_thread.h" | 14 #include "content/test/test_browser_thread.h" |
15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
| 18 using content::BrowserThread; |
| 19 |
18 class SQLitePersistentCookieStorePerfTest : public testing::Test { | 20 class SQLitePersistentCookieStorePerfTest : public testing::Test { |
19 public: | 21 public: |
20 SQLitePersistentCookieStorePerfTest() | 22 SQLitePersistentCookieStorePerfTest() |
21 : db_thread_(BrowserThread::DB), | 23 : db_thread_(BrowserThread::DB), |
22 io_thread_(BrowserThread::IO), | 24 io_thread_(BrowserThread::IO), |
23 loaded_event_(false, false), | 25 loaded_event_(false, false), |
24 key_loaded_event_(false, false) { | 26 key_loaded_event_(false, false) { |
25 } | 27 } |
26 | 28 |
27 void OnLoaded( | 29 void OnLoaded( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 107 } |
106 | 108 |
107 // Test the performance of load | 109 // Test the performance of load |
108 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { | 110 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { |
109 PerfTimeLogger timer("Load all cookies"); | 111 PerfTimeLogger timer("Load all cookies"); |
110 Load(); | 112 Load(); |
111 timer.Done(); | 113 timer.Done(); |
112 | 114 |
113 ASSERT_EQ(15000U, cookies_.size()); | 115 ASSERT_EQ(15000U, cookies_.size()); |
114 } | 116 } |
OLD | NEW |