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 "net/extras/sqlite/sqlite_persistent_cookie_store.h" | 5 #include "net/extras/sqlite/sqlite_persistent_cookie_store.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 namespace { | 27 namespace { |
28 | 28 |
29 const base::FilePath::CharType cookie_filename[] = FILE_PATH_LITERAL("Cookies"); | 29 const base::FilePath::CharType cookie_filename[] = FILE_PATH_LITERAL("Cookies"); |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 class SQLitePersistentCookieStorePerfTest : public testing::Test { | 33 class SQLitePersistentCookieStorePerfTest : public testing::Test { |
34 public: | 34 public: |
35 SQLitePersistentCookieStorePerfTest() | 35 SQLitePersistentCookieStorePerfTest() |
36 : pool_owner_(new base::SequencedWorkerPoolOwner(1, "Background Pool")), | 36 : pool_owner_(new base::SequencedWorkerPoolOwner(1, "Background Pool")), |
37 loaded_event_(false, false), | 37 loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
38 key_loaded_event_(false, false) {} | 38 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 39 key_loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 40 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
39 | 41 |
40 void OnLoaded(const std::vector<CanonicalCookie*>& cookies) { | 42 void OnLoaded(const std::vector<CanonicalCookie*>& cookies) { |
41 cookies_ = cookies; | 43 cookies_ = cookies; |
42 loaded_event_.Signal(); | 44 loaded_event_.Signal(); |
43 } | 45 } |
44 | 46 |
45 void OnKeyLoaded(const std::vector<CanonicalCookie*>& cookies) { | 47 void OnKeyLoaded(const std::vector<CanonicalCookie*>& cookies) { |
46 cookies_ = cookies; | 48 cookies_ = cookies; |
47 key_loaded_event_.Signal(); | 49 key_loaded_event_.Signal(); |
48 } | 50 } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // Test the performance of load | 134 // Test the performance of load |
133 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { | 135 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { |
134 base::PerfTimeLogger timer("Load all cookies"); | 136 base::PerfTimeLogger timer("Load all cookies"); |
135 Load(); | 137 Load(); |
136 timer.Done(); | 138 timer.Done(); |
137 | 139 |
138 ASSERT_EQ(15000U, cookies_.size()); | 140 ASSERT_EQ(15000U, cookies_.size()); |
139 } | 141 } |
140 | 142 |
141 } // namespace net | 143 } // namespace net |
OLD | NEW |