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