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

Unified Diff: content/browser/quota/quota_manager_unittest.cc

Issue 2777183010: [Quota] Lower quota for ephemeral mode (ie. session only) (Closed)
Patch Set: unit test Created 3 years, 8 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 | « no previous file | storage/browser/quota/quota_manager.cc » ('j') | storage/browser/quota/quota_settings.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/quota/quota_manager_unittest.cc
diff --git a/content/browser/quota/quota_manager_unittest.cc b/content/browser/quota/quota_manager_unittest.cc
index 9c1d7aa6ae37b75e2e8bdefb42c6735426c2477e..90c06e725728018c9dc14c8452ec3e5293f869b0 100644
--- a/content/browser/quota/quota_manager_unittest.cc
+++ b/content/browser/quota/quota_manager_unittest.cc
@@ -167,6 +167,8 @@ class QuotaManagerTest : public testing::Test {
storage::QuotaSettings settings;
settings.pool_size = pool_size;
settings.per_host_quota = per_host_quota;
+ settings.session_only_per_host_quota =
+ (per_host_quota > 0) ? (per_host_quota - 1) : INT64_C(0);
Thiemo Nagel 2017/04/10 09:41:37 Nit: What's the purpose of INT64_C() here?
michaeln 2017/04/10 23:15:35 I'll remove it if its not needed to compile withou
settings.must_remain_available = must_remain_available;
settings.refresh_interval = base::TimeDelta::Max();
quota_manager_->SetQuotaSettings(settings);
@@ -2252,4 +2254,17 @@ TEST_F(QuotaManagerTest, GetUsageAndQuota_Incognito) {
EXPECT_EQ(available_space() + usage(), quota());
}
+TEST_F(QuotaManagerTest, GetUsageAndQuota_SessionOnly) {
+ const GURL kEpheremalOrigin("http://ephemeral/");
+ mock_special_storage_policy()->AddSessionOnly(kEpheremalOrigin);
+
+ GetUsageAndQuotaForWebApps(kEpheremalOrigin, kTemp);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(quota_manager()->settings().session_only_per_host_quota, quota());
+
+ GetUsageAndQuotaForWebApps(kEpheremalOrigin, kPerm);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_EQ(0, quota());
+}
+
} // namespace content
« no previous file with comments | « no previous file | storage/browser/quota/quota_manager.cc » ('j') | storage/browser/quota/quota_settings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698