Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: content/browser/net/sqlite_persistent_cookie_store_perftest.cc

Issue 14113014: Adding Priority field to cookies. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed enums PRIORITY_* to COOKIE_PRIORITY_*. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/net/sqlite_persistent_cookie_store.h" 5 #include "content/browser/net/sqlite_persistent_cookie_store.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/perftimer.h" 10 #include "base/perftimer.h"
11 #include "base/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/test/sequenced_worker_pool_owner.h" 14 #include "base/test/sequenced_worker_pool_owner.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
17 #include "net/cookies/canonical_cookie.h" 17 #include "net/cookies/canonical_cookie.h"
18 #include "net/cookies/cookie_constants.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 namespace { 23 namespace {
23 24
24 const base::FilePath::CharType cookie_filename[] = FILE_PATH_LITERAL("Cookies"); 25 const base::FilePath::CharType cookie_filename[] = FILE_PATH_LITERAL("Cookies");
25 26
26 } // namespace 27 } // namespace
27 28
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // Creates 15000 cookies from 300 eTLD+1s. 73 // Creates 15000 cookies from 300 eTLD+1s.
73 base::Time t = base::Time::Now(); 74 base::Time t = base::Time::Now();
74 for (int domain_num = 0; domain_num < 300; domain_num++) { 75 for (int domain_num = 0; domain_num < 300; domain_num++) {
75 std::string domain_name(base::StringPrintf(".domain_%d.com", domain_num)); 76 std::string domain_name(base::StringPrintf(".domain_%d.com", domain_num));
76 GURL gurl("www" + domain_name); 77 GURL gurl("www" + domain_name);
77 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { 78 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) {
78 t += base::TimeDelta::FromInternalValue(10); 79 t += base::TimeDelta::FromInternalValue(10);
79 store_->AddCookie( 80 store_->AddCookie(
80 net::CanonicalCookie(gurl, 81 net::CanonicalCookie(gurl,
81 base::StringPrintf("Cookie_%d", cookie_num), "1", 82 base::StringPrintf("Cookie_%d", cookie_num), "1",
82 domain_name, "/", t, t, t, false, false)); 83 domain_name, "/", t, t, t, false, false,
84 net::COOKIE_PRIORITY_DEFAULT));
83 } 85 }
84 } 86 }
85 // Replace the store effectively destroying the current one and forcing it 87 // Replace the store effectively destroying the current one and forcing it
86 // to write its data to disk. 88 // to write its data to disk.
87 store_ = NULL; 89 store_ = NULL;
88 90
89 // 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.
90 pool_owner_->pool()->Shutdown(); 92 pool_owner_->pool()->Shutdown();
91 // ~SequencedWorkerPoolOwner blocks on pool shutdown. 93 // ~SequencedWorkerPoolOwner blocks on pool shutdown.
92 pool_owner_.reset(new base::SequencedWorkerPoolOwner(1, "pool")); 94 pool_owner_.reset(new base::SequencedWorkerPoolOwner(1, "pool"));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Test the performance of load 133 // Test the performance of load
132 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { 134 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) {
133 PerfTimeLogger timer("Load all cookies"); 135 PerfTimeLogger timer("Load all cookies");
134 Load(); 136 Load();
135 timer.Done(); 137 timer.Done();
136 138
137 ASSERT_EQ(15000U, cookies_.size()); 139 ASSERT_EQ(15000U, cookies_.size());
138 } 140 }
139 141
140 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/net/sqlite_persistent_cookie_store.cc ('k') | content/browser/net/sqlite_persistent_cookie_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698