OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |