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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ASSERT_EQ(0u, cookies_.size()); | 75 ASSERT_EQ(0u, cookies_.size()); |
76 // Creates 15000 cookies from 300 eTLD+1s. | 76 // Creates 15000 cookies from 300 eTLD+1s. |
77 base::Time t = base::Time::Now(); | 77 base::Time t = base::Time::Now(); |
78 for (int domain_num = 0; domain_num < 300; domain_num++) { | 78 for (int domain_num = 0; domain_num < 300; domain_num++) { |
79 std::string domain_name(base::StringPrintf(".domain_%d.com", domain_num)); | 79 std::string domain_name(base::StringPrintf(".domain_%d.com", domain_num)); |
80 GURL gurl("http://www" + domain_name); | 80 GURL gurl("http://www" + domain_name); |
81 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { | 81 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { |
82 t += base::TimeDelta::FromInternalValue(10); | 82 t += base::TimeDelta::FromInternalValue(10); |
83 store_->AddCookie(*CanonicalCookie::Create( | 83 store_->AddCookie(*CanonicalCookie::Create( |
84 gurl, base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, | 84 gurl, base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, |
85 "/", t, t, false, false, CookieSameSite::DEFAULT_MODE, false, | 85 "/", t, t, false, false, CookieSameSite::DEFAULT_MODE, |
86 COOKIE_PRIORITY_DEFAULT)); | 86 COOKIE_PRIORITY_DEFAULT)); |
87 } | 87 } |
88 } | 88 } |
89 // Replace the store effectively destroying the current one and forcing it | 89 // Replace the store effectively destroying the current one and forcing it |
90 // to write its data to disk. | 90 // to write its data to disk. |
91 store_ = NULL; | 91 store_ = NULL; |
92 | 92 |
93 // Shut down the pool, causing deferred (no-op) commits to be discarded. | 93 // Shut down the pool, causing deferred (no-op) commits to be discarded. |
94 pool_owner_->pool()->Shutdown(); | 94 pool_owner_->pool()->Shutdown(); |
95 // ~SequencedWorkerPoolOwner blocks on pool shutdown. | 95 // ~SequencedWorkerPoolOwner blocks on pool shutdown. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // Test the performance of load | 134 // Test the performance of load |
135 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { | 135 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { |
136 base::PerfTimeLogger timer("Load all cookies"); | 136 base::PerfTimeLogger timer("Load all cookies"); |
137 Load(); | 137 Load(); |
138 timer.Done(); | 138 timer.Done(); |
139 | 139 |
140 ASSERT_EQ(15000U, cookies_.size()); | 140 ASSERT_EQ(15000U, cookies_.size()); |
141 } | 141 } |
142 | 142 |
143 } // namespace net | 143 } // namespace net |
OLD | NEW |