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

Unified Diff: webkit/quota/quota_manager_unittest.cc

Issue 7618025: Send notifications on the IO thread when changes are made to the special storage policy. Listen f... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/quota/mock_special_storage_policy.h ('k') | webkit/quota/special_storage_policy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/quota/quota_manager_unittest.cc
===================================================================
--- webkit/quota/quota_manager_unittest.cc (revision 96595)
+++ webkit/quota/quota_manager_unittest.cc (working copy)
@@ -710,6 +710,11 @@
SetTemporaryGlobalQuota(1000);
MessageLoop::current()->RunAllPending();
+ GetGlobalUsage(kTemp);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(10 + 50 + 4000, usage());
+ EXPECT_EQ(4000, unlimited_usage());
+
const int kPerHostQuotaFor1000 =
1000 / QuotaManager::kPerHostTemporaryPortion;
@@ -755,6 +760,33 @@
EXPECT_EQ(kQuotaStatusOk, status());
EXPECT_EQ(4000, usage());
EXPECT_EQ(kint64max, quota());
+
+ // Revoke the unlimited rights and make sure the change is noticed.
+ mock_special_storage_policy()->Reset();
+ mock_special_storage_policy()->NotifyChanged();
+
+ GetGlobalUsage(kTemp);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(10 + 50 + 4000, usage());
+ EXPECT_EQ(0, unlimited_usage());
+
+ GetUsageAndQuota(GURL("http://usage10/"), kTemp);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(10, usage());
+ EXPECT_EQ(10, quota()); // should be clamped to our current usage
+
+ GetUsageAndQuota(GURL("http://usage50/"), kTemp);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(50, usage());
+ EXPECT_EQ(kPerHostQuotaFor100, quota());
+
+ GetUsageAndQuota(GURL("http://unlimited/"), kTemp);
+ MessageLoop::current()->RunAllPending();
+ EXPECT_EQ(kQuotaStatusOk, status());
+ EXPECT_EQ(4000, usage());
+ EXPECT_EQ(kPerHostQuotaFor100, quota());
}
TEST_F(QuotaManagerTest, OriginInUse) {
« no previous file with comments | « webkit/quota/mock_special_storage_policy.h ('k') | webkit/quota/special_storage_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698