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

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

Issue 876973003: Implement the "first-party-only" cookie flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: FirstPartyOnly. Created 5 years, 10 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/sequenced_task_runner.h" 10 #include "base/sequenced_task_runner.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 std::vector<net::CanonicalCookie*> cookies; 71 std::vector<net::CanonicalCookie*> cookies;
72 Load(); 72 Load();
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( 81 store_->AddCookie(net::CanonicalCookie(
82 net::CanonicalCookie(gurl, 82 gurl, base::StringPrintf("Cookie_%d", cookie_num), "1", domain_name,
83 base::StringPrintf("Cookie_%d", cookie_num), "1", 83 "/", t, t, t, false, false, false, net::COOKIE_PRIORITY_DEFAULT));
84 domain_name, "/", t, t, t, false, false,
85 net::COOKIE_PRIORITY_DEFAULT));
86 } 84 }
87 } 85 }
88 // Replace the store effectively destroying the current one and forcing it 86 // Replace the store effectively destroying the current one and forcing it
89 // to write its data to disk. 87 // to write its data to disk.
90 store_ = NULL; 88 store_ = NULL;
91 89
92 // Shut down the pool, causing deferred (no-op) commits to be discarded. 90 // Shut down the pool, causing deferred (no-op) commits to be discarded.
93 pool_owner_->pool()->Shutdown(); 91 pool_owner_->pool()->Shutdown();
94 // ~SequencedWorkerPoolOwner blocks on pool shutdown. 92 // ~SequencedWorkerPoolOwner blocks on pool shutdown.
95 pool_owner_.reset(new base::SequencedWorkerPoolOwner(1, "pool")); 93 pool_owner_.reset(new base::SequencedWorkerPoolOwner(1, "pool"));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 // Test the performance of load 132 // Test the performance of load
135 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) { 133 TEST_F(SQLitePersistentCookieStorePerfTest, TestLoadPerformance) {
136 base::PerfTimeLogger timer("Load all cookies"); 134 base::PerfTimeLogger timer("Load all cookies");
137 Load(); 135 Load();
138 timer.Done(); 136 timer.Done();
139 137
140 ASSERT_EQ(15000U, cookies_.size()); 138 ASSERT_EQ(15000U, cookies_.size());
141 } 139 }
142 140
143 } // namespace content 141 } // 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