Chromium Code Reviews

Side by Side Diff: net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc

Issue 2874843002: Shifted creation of unvalidated CanonicalCookies over to a constructor. (Closed)
Patch Set: Merged to top of dependent CL. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 "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 61 matching lines...)
72 background_task_runner(), false, NULL); 72 background_task_runner(), false, NULL);
73 std::vector<CanonicalCookie*> cookies; 73 std::vector<CanonicalCookie*> cookies;
74 Load(); 74 Load();
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 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { 80 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) {
81 t += base::TimeDelta::FromInternalValue(10); 81 t += base::TimeDelta::FromInternalValue(10);
82 store_->AddCookie(*CanonicalCookie::Create( 82 store_->AddCookie(CanonicalCookie(
83 base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, "/", 83 base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, "/",
84 t, t, t, false, false, CookieSameSite::DEFAULT_MODE, 84 t, t, t, false, false, CookieSameSite::DEFAULT_MODE,
85 COOKIE_PRIORITY_DEFAULT)); 85 COOKIE_PRIORITY_DEFAULT));
86 } 86 }
87 } 87 }
88 // Replace the store effectively destroying the current one and forcing it 88 // Replace the store effectively destroying the current one and forcing it
89 // to write its data to disk. 89 // to write its data to disk.
90 store_ = NULL; 90 store_ = NULL;
91 91
92 // Shut down the pool, causing deferred (no-op) commits to be discarded. 92 // Shut down the pool, causing deferred (no-op) commits to be discarded.
(...skipping 40 matching lines...)
133 // Test the performance of load 133 // Test the performance of load
134 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { 134 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) {
135 base::PerfTimeLogger timer("Load all cookies"); 135 base::PerfTimeLogger timer("Load all cookies");
136 Load(); 136 Load();
137 timer.Done(); 137 timer.Done();
138 138
139 ASSERT_EQ(15000U, cookies_.size()); 139 ASSERT_EQ(15000U, cookies_.size());
140 } 140 }
141 141
142 } // namespace net 142 } // namespace net
OLDNEW
« no previous file with comments | « net/extras/sqlite/sqlite_persistent_cookie_store.cc ('k') | net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine