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

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

Issue 2861063003: Remove dangerous CanonicalCookie::Create method. (Closed)
Patch Set: Use creation_time for last_access_time as per Elly's suggestion. Created 3 years, 7 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 "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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 store_ = new SQLitePersistentCookieStore( 70 store_ = new SQLitePersistentCookieStore(
71 temp_dir_.GetPath().Append(cookie_filename), client_task_runner(), 71 temp_dir_.GetPath().Append(cookie_filename), client_task_runner(),
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 GURL gurl("http://www" + domain_name);
81 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) { 80 for (int cookie_num = 0; cookie_num < 50; ++cookie_num) {
82 t += base::TimeDelta::FromInternalValue(10); 81 t += base::TimeDelta::FromInternalValue(10);
83 store_->AddCookie(*CanonicalCookie::Create( 82 store_->AddCookie(*CanonicalCookie::Create(
84 gurl, base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, 83 base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name, "/",
85 "/", t, t, false, false, CookieSameSite::DEFAULT_MODE, 84 t, t, t, false, false, CookieSameSite::DEFAULT_MODE,
86 COOKIE_PRIORITY_DEFAULT)); 85 COOKIE_PRIORITY_DEFAULT));
87 } 86 }
88 } 87 }
89 // Replace the store effectively destroying the current one and forcing it 88 // Replace the store effectively destroying the current one and forcing it
90 // to write its data to disk. 89 // to write its data to disk.
91 store_ = NULL; 90 store_ = NULL;
92 91
93 // 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.
94 pool_owner_->pool()->Shutdown(); 93 pool_owner_->pool()->Shutdown();
95 // ~SequencedWorkerPoolOwner blocks on pool shutdown. 94 // ~SequencedWorkerPoolOwner blocks on pool shutdown.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Test the performance of load 133 // Test the performance of load
135 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { 134 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) {
136 base::PerfTimeLogger timer("Load all cookies"); 135 base::PerfTimeLogger timer("Load all cookies");
137 Load(); 136 Load();
138 timer.Done(); 137 timer.Done();
139 138
140 ASSERT_EQ(15000U, cookies_.size()); 139 ASSERT_EQ(15000U, cookies_.size());
141 } 140 }
142 141
143 } // namespace net 142 } // namespace net
OLDNEW
« no previous file with comments | « net/cookies/cookie_store_unittest.h ('k') | net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698