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

Side by Side Diff: content/browser/quota/quota_database_unittest.cc

Issue 1229933007: Make quota logic obey durable storage permission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_top_durable
Patch Set: fix extensions_browsertests compile Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <algorithm> 5 #include <algorithm>
6 #include <iterator> 6 #include <iterator>
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // Test that unlimited origins are exluded from eviction, but 161 // Test that unlimited origins are exluded from eviction, but
162 // protected origins are not excluded. 162 // protected origins are not excluded.
163 scoped_refptr<MockSpecialStoragePolicy> policy( 163 scoped_refptr<MockSpecialStoragePolicy> policy(
164 new MockSpecialStoragePolicy); 164 new MockSpecialStoragePolicy);
165 policy->AddUnlimited(kOrigin1); 165 policy->AddUnlimited(kOrigin1);
166 policy->AddProtected(kOrigin2); 166 policy->AddProtected(kOrigin2);
167 EXPECT_TRUE(db.GetLRUOrigin( 167 EXPECT_TRUE(db.GetLRUOrigin(
168 kStorageTypeTemporary, exceptions, policy.get(), &origin)); 168 kStorageTypeTemporary, exceptions, policy.get(), &origin));
169 EXPECT_EQ(kOrigin2.spec(), origin.spec()); 169 EXPECT_EQ(kOrigin2.spec(), origin.spec());
170 170
171 // Test that durable origins are excluded from eviction.
172 policy->AddDurable(kOrigin2);
173 EXPECT_TRUE(db.GetLRUOrigin(
174 kStorageTypeTemporary, exceptions, policy.get(), &origin));
175 EXPECT_EQ(kOrigin3.spec(), origin.spec());
176
171 exceptions.insert(kOrigin1); 177 exceptions.insert(kOrigin1);
172 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, 178 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions,
173 NULL, &origin)); 179 NULL, &origin));
174 EXPECT_EQ(kOrigin2.spec(), origin.spec()); 180 EXPECT_EQ(kOrigin2.spec(), origin.spec());
175 181
176 exceptions.insert(kOrigin2); 182 exceptions.insert(kOrigin2);
177 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, 183 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions,
178 NULL, &origin)); 184 NULL, &origin));
179 EXPECT_EQ(kOrigin3.spec(), origin.spec()); 185 EXPECT_EQ(kOrigin3.spec(), origin.spec());
180 186
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 563 }
558 564
559 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { 565 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) {
560 base::ScopedTempDir data_dir; 566 base::ScopedTempDir data_dir;
561 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); 567 ASSERT_TRUE(data_dir.CreateUniqueTempDir());
562 const base::FilePath kDbFile = data_dir.path().AppendASCII(kDBFileName); 568 const base::FilePath kDbFile = data_dir.path().AppendASCII(kDBFileName);
563 DumpOriginInfoTable(kDbFile); 569 DumpOriginInfoTable(kDbFile);
564 DumpOriginInfoTable(base::FilePath()); 570 DumpOriginInfoTable(base::FilePath());
565 } 571 }
566 } // namespace content 572 } // namespace content
OLDNEW
« no previous file with comments | « components/content_settings/core/browser/cookie_settings.cc ('k') | content/public/test/mock_special_storage_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698