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

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

Issue 1343273003: Integrate SiteEngagementEvictionPolicy with QuotaManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_eviction_policy
Patch Set: address comments Created 5 years, 2 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 <set> 6 #include <set>
7 #include <sstream> 7 #include <sstream>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 const int64 kAvailableSpaceForApp = 13377331U; 56 const int64 kAvailableSpaceForApp = 13377331U;
57 57
58 const int64 kMinimumPreserveForSystem = QuotaManager::kMinimumPreserveForSystem; 58 const int64 kMinimumPreserveForSystem = QuotaManager::kMinimumPreserveForSystem;
59 const int kPerHostTemporaryPortion = QuotaManager::kPerHostTemporaryPortion; 59 const int kPerHostTemporaryPortion = QuotaManager::kPerHostTemporaryPortion;
60 60
61 // Returns a deterministic value for the amount of available disk space. 61 // Returns a deterministic value for the amount of available disk space.
62 int64 GetAvailableDiskSpaceForTest(const base::FilePath&) { 62 int64 GetAvailableDiskSpaceForTest(const base::FilePath&) {
63 return kAvailableSpaceForApp + kMinimumPreserveForSystem; 63 return kAvailableSpaceForApp + kMinimumPreserveForSystem;
64 } 64 }
65 65
66 class TestEvictionPolicy : public storage::QuotaEvictionPolicy {
67 public:
68 TestEvictionPolicy() {}
69 ~TestEvictionPolicy() override {}
70
71 // Overridden from storage::QuotaEvictionPolicy:
72 void GetEvictionOrigin(const scoped_refptr<storage::SpecialStoragePolicy>&
73 special_storage_policy,
74 const std::map<GURL, int64>& usage_map,
75 int64 global_quota,
76 const storage::GetOriginCallback& callback) override {
77 callback.Run(GURL("http://bar.com/"));
michaeln 2015/10/13 20:13:39 maybe make the test check for an explicit value re
calamity 2015/10/14 04:49:15 Done.
78 }
79 };
80
66 } // namespace 81 } // namespace
67 82
68 class QuotaManagerTest : public testing::Test { 83 class QuotaManagerTest : public testing::Test {
69 protected: 84 protected:
70 typedef QuotaManager::QuotaTableEntry QuotaTableEntry; 85 typedef QuotaManager::QuotaTableEntry QuotaTableEntry;
71 typedef QuotaManager::QuotaTableEntries QuotaTableEntries; 86 typedef QuotaManager::QuotaTableEntries QuotaTableEntries;
72 typedef QuotaManager::OriginInfoTableEntries OriginInfoTableEntries; 87 typedef QuotaManager::OriginInfoTableEntries OriginInfoTableEntries;
73 88
74 public: 89 public:
75 QuotaManagerTest() 90 QuotaManagerTest()
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 StorageType type) { 285 StorageType type) {
271 DCHECK(client); 286 DCHECK(client);
272 quota_manager_->NotifyStorageAccessedInternal( 287 quota_manager_->NotifyStorageAccessedInternal(
273 client->id(), origin, type, IncrementMockTime()); 288 client->id(), origin, type, IncrementMockTime());
274 } 289 }
275 290
276 void DeleteOriginFromDatabase(const GURL& origin, StorageType type) { 291 void DeleteOriginFromDatabase(const GURL& origin, StorageType type) {
277 quota_manager_->DeleteOriginFromDatabase(origin, type); 292 quota_manager_->DeleteOriginFromDatabase(origin, type);
278 } 293 }
279 294
280 void GetLRUOrigin(StorageType type) { 295 void GetEvictionOrigin(StorageType type) {
281 lru_origin_ = GURL(); 296 eviction_origin_ = GURL();
282 quota_manager_->GetLRUOrigin( 297 // The quota manager's default eviction policy is to use an LRU eviction
283 type, 298 // policy.
284 base::Bind(&QuotaManagerTest::DidGetLRUOrigin, 299 quota_manager_->GetEvictionOrigin(
285 weak_factory_.GetWeakPtr())); 300 type, 0, base::Bind(&QuotaManagerTest::DidGetEvictionOrigin,
301 weak_factory_.GetWeakPtr()));
286 } 302 }
287 303
288 void NotifyOriginInUse(const GURL& origin) { 304 void NotifyOriginInUse(const GURL& origin) {
289 quota_manager_->NotifyOriginInUse(origin); 305 quota_manager_->NotifyOriginInUse(origin);
290 } 306 }
291 307
292 void NotifyOriginNoLongerInUse(const GURL& origin) { 308 void NotifyOriginNoLongerInUse(const GURL& origin) {
293 quota_manager_->NotifyOriginNoLongerInUse(origin); 309 quota_manager_->NotifyOriginNoLongerInUse(origin);
294 } 310 }
295 311
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 375 }
360 376
361 void DidGetUsageAndQuotaForEviction(QuotaStatusCode status, 377 void DidGetUsageAndQuotaForEviction(QuotaStatusCode status,
362 const UsageAndQuota& usage_and_quota) { 378 const UsageAndQuota& usage_and_quota) {
363 quota_status_ = status; 379 quota_status_ = status;
364 limited_usage_ = usage_and_quota.global_limited_usage; 380 limited_usage_ = usage_and_quota.global_limited_usage;
365 quota_ = usage_and_quota.quota; 381 quota_ = usage_and_quota.quota;
366 available_space_ = usage_and_quota.available_disk_space; 382 available_space_ = usage_and_quota.available_disk_space;
367 } 383 }
368 384
369 void DidGetLRUOrigin(const GURL& origin) { 385 void DidGetEvictionOrigin(const GURL& origin) {
370 lru_origin_ = origin; 386 eviction_origin_ = origin;
371 } 387 }
372 388
373 void DidGetModifiedOrigins(const std::set<GURL>& origins, StorageType type) { 389 void DidGetModifiedOrigins(const std::set<GURL>& origins, StorageType type) {
374 modified_origins_ = origins; 390 modified_origins_ = origins;
375 modified_origins_type_ = type; 391 modified_origins_type_ = type;
376 } 392 }
377 393
378 void DidDumpQuotaTable(const QuotaTableEntries& entries) { 394 void DidDumpQuotaTable(const QuotaTableEntries& entries) {
379 quota_entries_ = entries; 395 quota_entries_ = entries;
380 } 396 }
(...skipping 20 matching lines...) Expand all
401 return mock_special_storage_policy_.get(); 417 return mock_special_storage_policy_.get();
402 } 418 }
403 419
404 QuotaStatusCode status() const { return quota_status_; } 420 QuotaStatusCode status() const { return quota_status_; }
405 const UsageInfoEntries& usage_info() const { return usage_info_; } 421 const UsageInfoEntries& usage_info() const { return usage_info_; }
406 int64 usage() const { return usage_; } 422 int64 usage() const { return usage_; }
407 int64 limited_usage() const { return limited_usage_; } 423 int64 limited_usage() const { return limited_usage_; }
408 int64 unlimited_usage() const { return unlimited_usage_; } 424 int64 unlimited_usage() const { return unlimited_usage_; }
409 int64 quota() const { return quota_; } 425 int64 quota() const { return quota_; }
410 int64 available_space() const { return available_space_; } 426 int64 available_space() const { return available_space_; }
411 const GURL& lru_origin() const { return lru_origin_; } 427 const GURL& eviction_origin() const { return eviction_origin_; }
412 const std::set<GURL>& modified_origins() const { return modified_origins_; } 428 const std::set<GURL>& modified_origins() const { return modified_origins_; }
413 StorageType modified_origins_type() const { return modified_origins_type_; } 429 StorageType modified_origins_type() const { return modified_origins_type_; }
414 const QuotaTableEntries& quota_entries() const { return quota_entries_; } 430 const QuotaTableEntries& quota_entries() const { return quota_entries_; }
415 const OriginInfoTableEntries& origin_info_entries() const { 431 const OriginInfoTableEntries& origin_info_entries() const {
416 return origin_info_entries_; 432 return origin_info_entries_;
417 } 433 }
418 base::FilePath profile_path() const { return data_dir_.path(); } 434 base::FilePath profile_path() const { return data_dir_.path(); }
419 int status_callback_count() const { return status_callback_count_; } 435 int status_callback_count() const { return status_callback_count_; }
420 void reset_status_callback_count() { status_callback_count_ = 0; } 436 void reset_status_callback_count() { status_callback_count_ = 0; }
421 437
422 private: 438 private:
423 base::Time IncrementMockTime() { 439 base::Time IncrementMockTime() {
424 ++mock_time_counter_; 440 ++mock_time_counter_;
425 return base::Time::FromDoubleT(mock_time_counter_ * 10.0); 441 return base::Time::FromDoubleT(mock_time_counter_ * 10.0);
426 } 442 }
427 443
428 base::MessageLoop message_loop_; 444 base::MessageLoop message_loop_;
429 base::ScopedTempDir data_dir_; 445 base::ScopedTempDir data_dir_;
430 446
431 scoped_refptr<QuotaManager> quota_manager_; 447 scoped_refptr<QuotaManager> quota_manager_;
432 scoped_refptr<MockSpecialStoragePolicy> mock_special_storage_policy_; 448 scoped_refptr<MockSpecialStoragePolicy> mock_special_storage_policy_;
433 449
434 QuotaStatusCode quota_status_; 450 QuotaStatusCode quota_status_;
435 UsageInfoEntries usage_info_; 451 UsageInfoEntries usage_info_;
436 int64 usage_; 452 int64 usage_;
437 int64 limited_usage_; 453 int64 limited_usage_;
438 int64 unlimited_usage_; 454 int64 unlimited_usage_;
439 int64 quota_; 455 int64 quota_;
440 int64 available_space_; 456 int64 available_space_;
441 GURL lru_origin_; 457 GURL eviction_origin_;
442 std::set<GURL> modified_origins_; 458 std::set<GURL> modified_origins_;
443 StorageType modified_origins_type_; 459 StorageType modified_origins_type_;
444 QuotaTableEntries quota_entries_; 460 QuotaTableEntries quota_entries_;
445 OriginInfoTableEntries origin_info_entries_; 461 OriginInfoTableEntries origin_info_entries_;
446 int status_callback_count_; 462 int status_callback_count_;
447 463
448 int additional_callback_count_; 464 int additional_callback_count_;
449 465
450 int mock_time_counter_; 466 int mock_time_counter_;
451 467
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 EXPECT_EQ(predelete_host_pers, usage()); 1272 EXPECT_EQ(predelete_host_pers, usage());
1257 } 1273 }
1258 1274
1259 TEST_F(QuotaManagerTest, GetAvailableSpaceTest) { 1275 TEST_F(QuotaManagerTest, GetAvailableSpaceTest) {
1260 GetAvailableSpace(); 1276 GetAvailableSpace();
1261 base::RunLoop().RunUntilIdle(); 1277 base::RunLoop().RunUntilIdle();
1262 EXPECT_EQ(kQuotaStatusOk, status()); 1278 EXPECT_EQ(kQuotaStatusOk, status());
1263 EXPECT_LE(0, available_space()); 1279 EXPECT_LE(0, available_space());
1264 } 1280 }
1265 1281
1282 TEST_F(QuotaManagerTest, SetTemporaryStorageEvictionPolicy) {
1283 GetEvictionOrigin(kTemp);
1284 base::RunLoop().RunUntilIdle();
1285 EXPECT_TRUE(eviction_origin().is_empty());
michaeln 2015/10/13 20:13:39 maybe no need to test this case if the unambiguous
calamity 2015/10/14 04:49:15 Done.
1286
1287 quota_manager()->SetTemporaryStorageEvictionPolicy(
1288 make_scoped_ptr(new TestEvictionPolicy));
1289
1290 GetEvictionOrigin(kTemp);
1291 base::RunLoop().RunUntilIdle();
1292 EXPECT_FALSE(eviction_origin().is_empty());
1293 }
1294
1266 TEST_F(QuotaManagerTest, EvictOriginData) { 1295 TEST_F(QuotaManagerTest, EvictOriginData) {
1267 static const MockOriginData kData1[] = { 1296 static const MockOriginData kData1[] = {
1268 { "http://foo.com/", kTemp, 1 }, 1297 { "http://foo.com/", kTemp, 1 },
1269 { "http://foo.com:1/", kTemp, 20 }, 1298 { "http://foo.com:1/", kTemp, 20 },
1270 { "http://foo.com/", kPerm, 300 }, 1299 { "http://foo.com/", kPerm, 300 },
1271 { "http://bar.com/", kTemp, 4000 }, 1300 { "http://bar.com/", kTemp, 4000 },
1272 }; 1301 };
1273 static const MockOriginData kData2[] = { 1302 static const MockOriginData kData2[] = {
1274 { "http://foo.com/", kTemp, 50000 }, 1303 { "http://foo.com/", kTemp, 50000 },
1275 { "http://foo.com:1/", kTemp, 6000 }, 1304 { "http://foo.com:1/", kTemp, 6000 },
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 if (itr->type == kTemp && 1409 if (itr->type == kTemp &&
1381 GURL("http://foo.com/") == itr->origin) { 1410 GURL("http://foo.com/") == itr->origin) {
1382 found_origin_in_database = true; 1411 found_origin_in_database = true;
1383 break; 1412 break;
1384 } 1413 }
1385 } 1414 }
1386 // The origin "http://foo.com/" should be in the database. 1415 // The origin "http://foo.com/" should be in the database.
1387 EXPECT_TRUE(found_origin_in_database); 1416 EXPECT_TRUE(found_origin_in_database);
1388 1417
1389 for (size_t i = 0; i < kNumberOfTemporaryOrigins - 1; ++i) { 1418 for (size_t i = 0; i < kNumberOfTemporaryOrigins - 1; ++i) {
1390 GetLRUOrigin(kTemp); 1419 GetEvictionOrigin(kTemp);
1391 base::RunLoop().RunUntilIdle(); 1420 base::RunLoop().RunUntilIdle();
1392 EXPECT_FALSE(lru_origin().is_empty()); 1421 EXPECT_FALSE(eviction_origin().is_empty());
1393 // The origin "http://foo.com/" should not be in the LRU list. 1422 // The origin "http://foo.com/" should not be in the LRU list.
1394 EXPECT_NE(std::string("http://foo.com/"), lru_origin().spec()); 1423 EXPECT_NE(std::string("http://foo.com/"), eviction_origin().spec());
1395 DeleteOriginFromDatabase(lru_origin(), kTemp); 1424 DeleteOriginFromDatabase(eviction_origin(), kTemp);
1396 base::RunLoop().RunUntilIdle(); 1425 base::RunLoop().RunUntilIdle();
1397 } 1426 }
1398 1427
1399 // Now the LRU list must be empty. 1428 // Now the LRU list must be empty.
1400 GetLRUOrigin(kTemp); 1429 GetEvictionOrigin(kTemp);
1401 base::RunLoop().RunUntilIdle(); 1430 base::RunLoop().RunUntilIdle();
1402 EXPECT_TRUE(lru_origin().is_empty()); 1431 EXPECT_TRUE(eviction_origin().is_empty());
1403 1432
1404 // Deleting origins from the database should not affect the results of the 1433 // Deleting origins from the database should not affect the results of the
1405 // following checks. 1434 // following checks.
1406 GetGlobalUsage(kTemp); 1435 GetGlobalUsage(kTemp);
1407 base::RunLoop().RunUntilIdle(); 1436 base::RunLoop().RunUntilIdle();
1408 EXPECT_EQ(predelete_global_tmp, usage()); 1437 EXPECT_EQ(predelete_global_tmp, usage());
1409 1438
1410 GetHostUsage("foo.com", kTemp); 1439 GetHostUsage("foo.com", kTemp);
1411 base::RunLoop().RunUntilIdle(); 1440 base::RunLoop().RunUntilIdle();
1412 EXPECT_EQ(predelete_host_tmp, usage()); 1441 EXPECT_EQ(predelete_host_tmp, usage());
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1721 { "http://a.com:1/", kTemp, 0 }, 1750 { "http://a.com:1/", kTemp, 0 },
1722 { "https://a.com/", kTemp, 0 }, 1751 { "https://a.com/", kTemp, 0 },
1723 { "http://b.com/", kPerm, 0 }, // persistent 1752 { "http://b.com/", kPerm, 0 }, // persistent
1724 { "http://c.com/", kTemp, 0 }, 1753 { "http://c.com/", kTemp, 0 },
1725 }; 1754 };
1726 MockStorageClient* client = CreateClient(kData, arraysize(kData), 1755 MockStorageClient* client = CreateClient(kData, arraysize(kData),
1727 QuotaClient::kFileSystem); 1756 QuotaClient::kFileSystem);
1728 RegisterClient(client); 1757 RegisterClient(client);
1729 1758
1730 GURL origin; 1759 GURL origin;
1731 GetLRUOrigin(kTemp); 1760 GetEvictionOrigin(kTemp);
1732 base::RunLoop().RunUntilIdle(); 1761 base::RunLoop().RunUntilIdle();
1733 EXPECT_TRUE(lru_origin().is_empty()); 1762 EXPECT_TRUE(eviction_origin().is_empty());
1734 1763
1735 NotifyStorageAccessed(client, GURL("http://a.com/"), kTemp); 1764 NotifyStorageAccessed(client, GURL("http://a.com/"), kTemp);
1736 GetLRUOrigin(kTemp); 1765 GetEvictionOrigin(kTemp);
1737 base::RunLoop().RunUntilIdle(); 1766 base::RunLoop().RunUntilIdle();
1738 EXPECT_EQ("http://a.com/", lru_origin().spec()); 1767 EXPECT_EQ("http://a.com/", eviction_origin().spec());
1739 1768
1740 NotifyStorageAccessed(client, GURL("http://b.com/"), kPerm); 1769 NotifyStorageAccessed(client, GURL("http://b.com/"), kPerm);
1741 NotifyStorageAccessed(client, GURL("https://a.com/"), kTemp); 1770 NotifyStorageAccessed(client, GURL("https://a.com/"), kTemp);
1742 NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp); 1771 NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp);
1743 GetLRUOrigin(kTemp); 1772 GetEvictionOrigin(kTemp);
1744 base::RunLoop().RunUntilIdle(); 1773 base::RunLoop().RunUntilIdle();
1745 EXPECT_EQ("http://a.com/", lru_origin().spec()); 1774 EXPECT_EQ("http://a.com/", eviction_origin().spec());
1746 1775
1747 DeleteOriginFromDatabase(lru_origin(), kTemp); 1776 DeleteOriginFromDatabase(eviction_origin(), kTemp);
1748 GetLRUOrigin(kTemp); 1777 GetEvictionOrigin(kTemp);
1749 base::RunLoop().RunUntilIdle(); 1778 base::RunLoop().RunUntilIdle();
1750 EXPECT_EQ("https://a.com/", lru_origin().spec()); 1779 EXPECT_EQ("https://a.com/", eviction_origin().spec());
1751 1780
1752 DeleteOriginFromDatabase(lru_origin(), kTemp); 1781 DeleteOriginFromDatabase(eviction_origin(), kTemp);
1753 GetLRUOrigin(kTemp); 1782 GetEvictionOrigin(kTemp);
1754 base::RunLoop().RunUntilIdle(); 1783 base::RunLoop().RunUntilIdle();
1755 EXPECT_EQ("http://c.com/", lru_origin().spec()); 1784 EXPECT_EQ("http://c.com/", eviction_origin().spec());
1756 } 1785 }
1757 1786
1758 TEST_F(QuotaManagerTest, GetLRUOriginWithOriginInUse) { 1787 TEST_F(QuotaManagerTest, GetLRUOriginWithOriginInUse) {
1759 static const MockOriginData kData[] = { 1788 static const MockOriginData kData[] = {
1760 { "http://a.com/", kTemp, 0 }, 1789 { "http://a.com/", kTemp, 0 },
1761 { "http://a.com:1/", kTemp, 0 }, 1790 { "http://a.com:1/", kTemp, 0 },
1762 { "https://a.com/", kTemp, 0 }, 1791 { "https://a.com/", kTemp, 0 },
1763 { "http://b.com/", kPerm, 0 }, // persistent 1792 { "http://b.com/", kPerm, 0 }, // persistent
1764 { "http://c.com/", kTemp, 0 }, 1793 { "http://c.com/", kTemp, 0 },
1765 }; 1794 };
1766 MockStorageClient* client = CreateClient(kData, arraysize(kData), 1795 MockStorageClient* client = CreateClient(kData, arraysize(kData),
1767 QuotaClient::kFileSystem); 1796 QuotaClient::kFileSystem);
1768 RegisterClient(client); 1797 RegisterClient(client);
1769 1798
1770 GURL origin; 1799 GURL origin;
1771 GetLRUOrigin(kTemp); 1800 GetEvictionOrigin(kTemp);
1772 base::RunLoop().RunUntilIdle(); 1801 base::RunLoop().RunUntilIdle();
1773 EXPECT_TRUE(lru_origin().is_empty()); 1802 EXPECT_TRUE(eviction_origin().is_empty());
1774 1803
1775 NotifyStorageAccessed(client, GURL("http://a.com/"), kTemp); 1804 NotifyStorageAccessed(client, GURL("http://a.com/"), kTemp);
1776 NotifyStorageAccessed(client, GURL("http://b.com/"), kPerm); 1805 NotifyStorageAccessed(client, GURL("http://b.com/"), kPerm);
1777 NotifyStorageAccessed(client, GURL("https://a.com/"), kTemp); 1806 NotifyStorageAccessed(client, GURL("https://a.com/"), kTemp);
1778 NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp); 1807 NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp);
1779 1808
1780 GetLRUOrigin(kTemp); 1809 GetEvictionOrigin(kTemp);
1781 base::RunLoop().RunUntilIdle(); 1810 base::RunLoop().RunUntilIdle();
1782 EXPECT_EQ("http://a.com/", lru_origin().spec()); 1811 EXPECT_EQ("http://a.com/", eviction_origin().spec());
1783 1812
1784 // Notify origin http://a.com is in use. 1813 // Notify origin http://a.com is in use.
1785 NotifyOriginInUse(GURL("http://a.com/")); 1814 NotifyOriginInUse(GURL("http://a.com/"));
1786 GetLRUOrigin(kTemp); 1815 GetEvictionOrigin(kTemp);
1787 base::RunLoop().RunUntilIdle(); 1816 base::RunLoop().RunUntilIdle();
1788 EXPECT_EQ("https://a.com/", lru_origin().spec()); 1817 EXPECT_EQ("https://a.com/", eviction_origin().spec());
1789 1818
1790 // Notify origin https://a.com is in use while GetLRUOrigin is running. 1819 // Notify origin https://a.com is in use while GetEvictionOrigin is running.
1791 GetLRUOrigin(kTemp); 1820 GetEvictionOrigin(kTemp);
1792 NotifyOriginInUse(GURL("https://a.com/")); 1821 NotifyOriginInUse(GURL("https://a.com/"));
1793 base::RunLoop().RunUntilIdle(); 1822 base::RunLoop().RunUntilIdle();
1794 // Post-filtering must have excluded the returned origin, so we will 1823 // Post-filtering must have excluded the returned origin, so we will
1795 // see empty result here. 1824 // see empty result here.
1796 EXPECT_TRUE(lru_origin().is_empty()); 1825 EXPECT_TRUE(eviction_origin().is_empty());
1797 1826
1798 // Notify access for http://c.com while GetLRUOrigin is running. 1827 // Notify access for http://c.com while GetEvictionOrigin is running.
1799 GetLRUOrigin(kTemp); 1828 GetEvictionOrigin(kTemp);
1800 NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp); 1829 NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp);
1801 base::RunLoop().RunUntilIdle(); 1830 base::RunLoop().RunUntilIdle();
1802 // Post-filtering must have excluded the returned origin, so we will 1831 // Post-filtering must have excluded the returned origin, so we will
1803 // see empty result here. 1832 // see empty result here.
1804 EXPECT_TRUE(lru_origin().is_empty()); 1833 EXPECT_TRUE(eviction_origin().is_empty());
1805 1834
1806 NotifyOriginNoLongerInUse(GURL("http://a.com/")); 1835 NotifyOriginNoLongerInUse(GURL("http://a.com/"));
1807 NotifyOriginNoLongerInUse(GURL("https://a.com/")); 1836 NotifyOriginNoLongerInUse(GURL("https://a.com/"));
1808 GetLRUOrigin(kTemp); 1837 GetEvictionOrigin(kTemp);
1809 base::RunLoop().RunUntilIdle(); 1838 base::RunLoop().RunUntilIdle();
1810 EXPECT_EQ("http://a.com/", lru_origin().spec()); 1839 EXPECT_EQ("http://a.com/", eviction_origin().spec());
1811 } 1840 }
1812 1841
1813 TEST_F(QuotaManagerTest, GetOriginsModifiedSince) { 1842 TEST_F(QuotaManagerTest, GetOriginsModifiedSince) {
1814 static const MockOriginData kData[] = { 1843 static const MockOriginData kData[] = {
1815 { "http://a.com/", kTemp, 0 }, 1844 { "http://a.com/", kTemp, 0 },
1816 { "http://a.com:1/", kTemp, 0 }, 1845 { "http://a.com:1/", kTemp, 0 },
1817 { "https://a.com/", kTemp, 0 }, 1846 { "https://a.com/", kTemp, 0 },
1818 { "http://b.com/", kPerm, 0 }, // persistent 1847 { "http://b.com/", kPerm, 0 }, // persistent
1819 { "http://c.com/", kTemp, 0 }, 1848 { "http://c.com/", kTemp, 0 },
1820 }; 1849 };
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); 2206 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota());
2178 2207
2179 GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); 2208 GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp);
2180 base::RunLoop().RunUntilIdle(); 2209 base::RunLoop().RunUntilIdle();
2181 EXPECT_EQ(kQuotaStatusOk, status()); 2210 EXPECT_EQ(kQuotaStatusOk, status());
2182 EXPECT_EQ(10, usage()); 2211 EXPECT_EQ(10, usage());
2183 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); 2212 EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota());
2184 } 2213 }
2185 2214
2186 } // namespace content 2215 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698