OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, | 166 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, |
167 NULL, &origin)); | 167 NULL, &origin)); |
168 EXPECT_EQ(kOrigin1.spec(), origin.spec()); | 168 EXPECT_EQ(kOrigin1.spec(), origin.spec()); |
169 | 169 |
170 // Test that unlimited origins are exluded from eviction, but | 170 // Test that unlimited origins are exluded from eviction, but |
171 // protected origins are not excluded. | 171 // protected origins are not excluded. |
172 scoped_refptr<MockSpecialStoragePolicy> policy( | 172 scoped_refptr<MockSpecialStoragePolicy> policy( |
173 new MockSpecialStoragePolicy); | 173 new MockSpecialStoragePolicy); |
174 policy->AddUnlimited(kOrigin1); | 174 policy->AddUnlimited(kOrigin1); |
175 policy->AddProtected(kOrigin2); | 175 policy->AddProtected(kOrigin2); |
176 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, | 176 EXPECT_TRUE(db.GetLRUOrigin( |
177 policy, &origin)); | 177 kStorageTypeTemporary, exceptions, policy.get(), &origin)); |
178 EXPECT_EQ(kOrigin2.spec(), origin.spec()); | 178 EXPECT_EQ(kOrigin2.spec(), origin.spec()); |
179 | 179 |
180 exceptions.insert(kOrigin1); | 180 exceptions.insert(kOrigin1); |
181 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, | 181 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, |
182 NULL, &origin)); | 182 NULL, &origin)); |
183 EXPECT_EQ(kOrigin2.spec(), origin.spec()); | 183 EXPECT_EQ(kOrigin2.spec(), origin.spec()); |
184 | 184 |
185 exceptions.insert(kOrigin2); | 185 exceptions.insert(kOrigin2); |
186 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, | 186 EXPECT_TRUE(db.GetLRUOrigin(kStorageTypeTemporary, exceptions, |
187 NULL, &origin)); | 187 NULL, &origin)); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 } | 570 } |
571 | 571 |
572 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { | 572 TEST_F(QuotaDatabaseTest, DumpOriginInfoTable) { |
573 base::ScopedTempDir data_dir; | 573 base::ScopedTempDir data_dir; |
574 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); | 574 ASSERT_TRUE(data_dir.CreateUniqueTempDir()); |
575 const base::FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db")
; | 575 const base::FilePath kDbFile = data_dir.path().AppendASCII("quota_manager.db")
; |
576 DumpOriginInfoTable(kDbFile); | 576 DumpOriginInfoTable(kDbFile); |
577 DumpOriginInfoTable(base::FilePath()); | 577 DumpOriginInfoTable(base::FilePath()); |
578 } | 578 } |
579 } // namespace quota | 579 } // namespace quota |
OLD | NEW |