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 0080f611bfed840596f88d04f40cd9305a4e323a..4b9e39a01cdb57cd32da9958ea8be42d4a87f813 100644 |
--- a/content/browser/quota/quota_manager_unittest.cc |
+++ b/content/browser/quota/quota_manager_unittest.cc |
@@ -44,7 +44,6 @@ using storage::QuotaClient; |
using storage::QuotaManager; |
using storage::QuotaStatusCode; |
using storage::StorageType; |
-using storage::UsageAndQuota; |
using storage::UsageInfo; |
using storage::UsageInfoEntries; |
@@ -60,23 +59,23 @@ const StorageType kSync = kStorageTypeSyncable; |
const int kAllClients = QuotaClient::kAllClientsMask; |
const int64_t kAvailableSpaceForApp = 13377331U; |
- |
-const int64_t kMinimumPreserveForSystem = |
- QuotaManager::kMinimumPreserveForSystem; |
-const int kPerHostTemporaryPortion = QuotaManager::kPerHostTemporaryPortion; |
+const int64_t kMustRemainAvailableForSystem = kAvailableSpaceForApp / 2; |
+const int64_t kDefaultPoolSize = 1000; |
cmumford
2016/10/25 20:30:54
Could add units to these values (either as a comme
michaeln
2016/10/26 21:47:53
Done.
|
+const int64_t kDefaultPerHostQuota = 200; |
const GURL kTestEvictionOrigin = GURL("http://test.eviction.policy/result"); |
// Returns a deterministic value for the amount of available disk space. |
int64_t GetAvailableDiskSpaceForTest() { |
- return kAvailableSpaceForApp + kMinimumPreserveForSystem; |
+ return kAvailableSpaceForApp + kMustRemainAvailableForSystem; |
} |
-bool GetVolumeInfoForTests(const base::FilePath&, |
- uint64_t* available, uint64_t* total) { |
- *available = static_cast<uint64_t>(GetAvailableDiskSpaceForTest()); |
- *total = *available * 2; |
- return true; |
+// base::Optional<> |
+std::pair<int64_t, int64_t> GetVolumeInfoForTests( |
cmumford
2016/10/25 20:30:54
Is the base::Optional comment a TODO?
michaeln
2016/10/26 21:47:53
yes :)
|
+ const base::FilePath& unused) { |
+ int64_t available = static_cast<uint64_t>(GetAvailableDiskSpaceForTest()); |
+ int64_t total = available * 2; |
+ return std::make_pair(total, available); |
} |
class TestEvictionPolicy : public storage::QuotaEvictionPolicy { |
@@ -123,10 +122,15 @@ class QuotaManagerTest : public testing::Test { |
protected: |
void ResetQuotaManager(bool is_incognito) { |
- quota_manager_ = new QuotaManager(is_incognito, data_dir_.GetPath(), |
- base::ThreadTaskRunnerHandle::Get().get(), |
- base::ThreadTaskRunnerHandle::Get().get(), |
- mock_special_storage_policy_.get()); |
+ quota_manager_ = new QuotaManager( |
+ is_incognito, data_dir_.GetPath(), |
+ base::ThreadTaskRunnerHandle::Get().get(), |
+ base::ThreadTaskRunnerHandle::Get().get(), |
+ mock_special_storage_policy_.get(), |
+ storage::GetTemporaryStorageConfigurationFunc()); |
+ SetStorageConfig(kDefaultPoolSize, kDefaultPerHostQuota, |
+ kMustRemainAvailableForSystem); |
+ |
// Don't (automatically) start the eviction for testing. |
quota_manager_->eviction_disabled_ = true; |
// Don't query the hard disk for remaining capacity. |
@@ -173,21 +177,15 @@ class QuotaManagerTest : public testing::Test { |
weak_factory_.GetWeakPtr())); |
} |
- void GetTemporaryGlobalQuota() { |
- quota_status_ = kQuotaStatusUnknown; |
- quota_ = -1; |
- quota_manager_->GetTemporaryGlobalQuota( |
- base::Bind(&QuotaManagerTest::DidGetQuota, |
- weak_factory_.GetWeakPtr())); |
- } |
- |
- void SetTemporaryGlobalQuota(int64_t new_quota) { |
- quota_status_ = kQuotaStatusUnknown; |
- quota_ = -1; |
- quota_manager_->SetTemporaryGlobalOverrideQuota( |
- new_quota, |
- base::Bind(&QuotaManagerTest::DidGetQuota, |
- weak_factory_.GetWeakPtr())); |
+ void SetStorageConfig(int64_t pool_size, |
+ int64_t per_host_quota, |
+ int64_t must_remain_available) { |
+ storage::TemporaryStorageConfiguration config; |
+ config.pool_size = pool_size; |
+ config.per_host_quota = per_host_quota; |
+ config.must_remain_available = must_remain_available; |
+ config.refresh_interval = base::TimeDelta::Max(); |
+ quota_manager_->SetTemporaryStorageConfiguration(config); |
} |
void GetPersistentHostQuota(const std::string& host) { |
@@ -272,22 +270,22 @@ class QuotaManagerTest : public testing::Test { |
weak_factory_.GetWeakPtr())); |
} |
- void GetAvailableSpace() { |
- quota_status_ = kQuotaStatusUnknown; |
+ void GetDeviceStorageCapacity() { |
available_space_ = -1; |
- quota_manager_->GetAvailableSpace( |
- base::Bind(&QuotaManagerTest::DidGetAvailableSpace, |
+ total_space_ = -1; |
+ quota_manager_->GetDeviceStorageCapacity( |
+ base::Bind(&QuotaManagerTest::DidGetStorageCapacity, |
weak_factory_.GetWeakPtr())); |
} |
- void GetUsageAndQuotaForEviction() { |
+ void GetEvictionRoundInfo() { |
quota_status_ = kQuotaStatusUnknown; |
- usage_ = -1; |
- unlimited_usage_ = -1; |
- quota_ = -1; |
+ config_ = storage::TemporaryStorageConfiguration(); |
available_space_ = -1; |
- quota_manager_->GetUsageAndQuotaForEviction( |
- base::Bind(&QuotaManagerTest::DidGetUsageAndQuotaForEviction, |
+ total_space_ = -1; |
+ usage_ = -1; |
+ quota_manager_->GetEvictionRoundInfo( |
+ base::Bind(&QuotaManagerTest::DidGetEvictionRoundInfo, |
weak_factory_.GetWeakPtr())); |
} |
@@ -297,12 +295,6 @@ class QuotaManagerTest : public testing::Test { |
quota_manager_->GetCachedOrigins(type, origins); |
} |
- bool GetVolumeInfo(const base::FilePath& path, |
- uint64_t* available_space, |
- uint64_t* total_size) { |
- return QuotaManager::GetVolumeInfo(path, available_space, total_size); |
- } |
- |
void NotifyStorageAccessed(QuotaClient* client, |
const GURL& origin, |
StorageType type) { |
@@ -373,8 +365,8 @@ class QuotaManagerTest : public testing::Test { |
quota_ = quota; |
} |
- void DidGetAvailableSpace(QuotaStatusCode status, int64_t available_space) { |
- quota_status_ = status; |
+ void DidGetStorageCapacity(int64_t total_space, int64_t available_space) { |
+ total_space_ = total_space; |
available_space_ = available_space; |
} |
@@ -395,12 +387,16 @@ class QuotaManagerTest : public testing::Test { |
quota_status_ = status; |
} |
- void DidGetUsageAndQuotaForEviction(QuotaStatusCode status, |
- const UsageAndQuota& usage_and_quota) { |
+ void DidGetEvictionRoundInfo( |
+ QuotaStatusCode status, |
+ const storage::TemporaryStorageConfiguration& config, |
+ int64_t available_space, int64_t total_space, |
+ int64_t global_usage, bool global_usage_is_complete) { |
quota_status_ = status; |
- limited_usage_ = usage_and_quota.global_limited_usage; |
- quota_ = usage_and_quota.quota; |
- available_space_ = usage_and_quota.available_disk_space; |
+ config_ = config; |
+ available_space_ = available_space; |
+ total_space_ = total_space; |
+ usage_ = global_usage; |
} |
void DidGetEvictionOrigin(const GURL& origin) { |
@@ -445,6 +441,7 @@ class QuotaManagerTest : public testing::Test { |
int64_t limited_usage() const { return limited_usage_; } |
int64_t unlimited_usage() const { return unlimited_usage_; } |
int64_t quota() const { return quota_; } |
+ int64_t total_space() const { return total_space_; } |
int64_t available_space() const { return available_space_; } |
const GURL& eviction_origin() const { return eviction_origin_; } |
const std::set<GURL>& modified_origins() const { return modified_origins_; } |
@@ -453,6 +450,9 @@ class QuotaManagerTest : public testing::Test { |
const OriginInfoTableEntries& origin_info_entries() const { |
return origin_info_entries_; |
} |
+ const storage::TemporaryStorageConfiguration& config() const { |
+ return config_; |
+ } |
base::FilePath profile_path() const { return data_dir_.GetPath(); } |
int status_callback_count() const { return status_callback_count_; } |
void reset_status_callback_count() { status_callback_count_ = 0; } |
@@ -475,12 +475,14 @@ class QuotaManagerTest : public testing::Test { |
int64_t limited_usage_; |
int64_t unlimited_usage_; |
int64_t quota_; |
+ int64_t total_space_; |
int64_t available_space_; |
GURL eviction_origin_; |
std::set<GURL> modified_origins_; |
StorageType modified_origins_type_; |
QuotaTableEntries quota_entries_; |
OriginInfoTableEntries origin_info_entries_; |
+ storage::TemporaryStorageConfiguration config_; |
int status_callback_count_; |
int additional_callback_count_; |
@@ -633,20 +635,18 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_MultiOrigins) { |
QuotaClient::kFileSystem)); |
// This time explicitly sets a temporary global quota. |
- SetTemporaryGlobalQuota(100); |
- base::RunLoop().RunUntilIdle(); |
- EXPECT_EQ(kQuotaStatusOk, status()); |
- EXPECT_EQ(100, quota()); |
+ const int kPoolSize = 100; |
+ const int kPerHostQuota = 20; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(10 + 20, usage()); |
- const int kPerHostQuota = 100 / kPerHostTemporaryPortion; |
- |
// The host's quota should be its full portion of the global quota |
- // since global usage is under the global quota. |
+ // since there's plenty of diskspace. |
EXPECT_EQ(kPerHostQuota, quota()); |
GetUsageAndQuotaForWebApps(GURL("http://bar.com/"), kTemp); |
@@ -677,8 +677,10 @@ TEST_F(QuotaManagerTest, GetUsage_MultipleClients) { |
RegisterClient(CreateClient(kData2, arraysize(kData2), |
QuotaClient::kDatabase)); |
- const int64_t kTempQuotaBase = |
- GetAvailableDiskSpaceForTest() / kPerHostTemporaryPortion; |
+ const int64_t kPoolSize = 100; |
+ const int64_t kPerHostQuota = 20; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
@@ -694,7 +696,7 @@ TEST_F(QuotaManagerTest, GetUsage_MultipleClients) { |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(512, usage()); |
- EXPECT_EQ(std::min(kAvailableSpaceForApp, kTempQuotaBase) + usage(), quota()); |
+ EXPECT_EQ(std::min(kAvailableSpaceForApp, kPerHostQuota) + usage(), quota()); |
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kPerm); |
base::RunLoop().RunUntilIdle(); |
@@ -702,22 +704,17 @@ TEST_F(QuotaManagerTest, GetUsage_MultipleClients) { |
EXPECT_EQ(8, usage()); |
EXPECT_EQ(kAvailableSpaceForApp + usage(), quota()); |
- GetAvailableSpace(); |
- base::RunLoop().RunUntilIdle(); |
- EXPECT_EQ(kQuotaStatusOk, status()); |
- EXPECT_LE(0, available_space()); |
- |
GetUsageAndQuotaForWebApps(GURL("http://installed/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(1024, usage()); |
- EXPECT_EQ(std::min(kAvailableSpaceForApp, kTempQuotaBase) + usage(), quota()); |
+ EXPECT_EQ(std::min(kAvailableSpaceForApp, kPerHostQuota) + usage(), quota()); |
GetUsageAndQuotaForWebApps(GURL("http://installed/"), kPerm); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(16, usage()); |
- EXPECT_EQ(usage(), quota()); // Over-budget case. |
+ EXPECT_EQ(usage(), quota()); // Over-budget case. todo:bug |
GetGlobalUsage(kTemp); |
base::RunLoop().RunUntilIdle(); |
@@ -781,10 +778,11 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_WithAdditionalTasks) { |
}; |
RegisterClient(CreateClient(kData, arraysize(kData), |
QuotaClient::kFileSystem)); |
- SetTemporaryGlobalQuota(100); |
- base::RunLoop().RunUntilIdle(); |
- const int kPerHostQuota = 100 / QuotaManager::kPerHostTemporaryPortion; |
+ const int kPoolSize = 100; |
+ const int kPerHostQuota = 20; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
@@ -815,8 +813,10 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_NukeManager) { |
}; |
RegisterClient(CreateClient(kData, arraysize(kData), |
QuotaClient::kFileSystem)); |
- SetTemporaryGlobalQuota(100); |
- base::RunLoop().RunUntilIdle(); |
+ const int kPoolSize = 100; |
+ const int kPerHostQuota = 20; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
set_additional_callback_count(0); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
@@ -842,22 +842,24 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Overbudget) { |
}; |
RegisterClient(CreateClient(kData, arraysize(kData), |
QuotaClient::kFileSystem)); |
- SetTemporaryGlobalQuota(100); |
- base::RunLoop().RunUntilIdle(); |
+ const int kPoolSize = 100; |
+ const int kPerHostQuota = 20; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
- const int kPerHostQuota = 100 / QuotaManager::kPerHostTemporaryPortion; |
+ // not sure this test is relevant anymore? |
GetUsageAndQuotaForWebApps(GURL("http://usage1/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(1, usage()); |
- EXPECT_EQ(1, quota()); // should be clamped to our current usage |
+ EXPECT_EQ(kPerHostQuota, quota()); |
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(10, usage()); |
- EXPECT_EQ(10, quota()); |
+ EXPECT_EQ(kPerHostQuota, quota()); |
GetUsageAndQuotaForWebApps(GURL("http://usage200/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
@@ -878,17 +880,14 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { |
RegisterClient(client); |
// Test when not overbugdet. |
- SetTemporaryGlobalQuota(1000); |
- base::RunLoop().RunUntilIdle(); |
+ const int kPerHostQuotaFor1000 = 200; |
+ SetStorageConfig(1000, kPerHostQuotaFor1000, kMustRemainAvailableForSystem); |
GetGlobalUsage(kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(10 + 50 + 4000, usage()); |
EXPECT_EQ(4000, unlimited_usage()); |
- const int kPerHostQuotaFor1000 = |
- 1000 / QuotaManager::kPerHostTemporaryPortion; |
- |
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
@@ -914,12 +913,10 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { |
EXPECT_EQ(QuotaManager::kNoLimit, quota()); |
// Test when overbugdet. |
- SetTemporaryGlobalQuota(100); |
+ const int kPerHostQuotaFor100 = 20; |
+ SetStorageConfig(100, kPerHostQuotaFor100, kMustRemainAvailableForSystem); |
base::RunLoop().RunUntilIdle(); |
- const int kPerHostQuotaFor100 = |
- 100 / QuotaManager::kPerHostTemporaryPortion; |
- |
GetUsageAndQuotaForWebApps(GURL("http://usage10/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
@@ -930,7 +927,7 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(50, usage()); |
- EXPECT_EQ(kPerHostQuotaFor100, quota()); |
+ EXPECT_EQ(20, quota()); |
GetUsageAndQuotaForWebApps(GURL("http://unlimited/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
@@ -957,7 +954,7 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(10, usage()); |
- EXPECT_EQ(10, quota()); // should be clamped to our current usage |
+ EXPECT_EQ(kPerHostQuotaFor100, quota()); |
GetUsageAndQuotaForWebApps(GURL("http://usage50/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
@@ -1087,7 +1084,7 @@ TEST_F(QuotaManagerTest, GetSyncableQuota) { |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(0, usage()); |
- EXPECT_EQ(QuotaManager::kSyncableStorageDefaultHostQuota, quota()); |
+ //EXPECT_EQ(QuotaManager::kSyncableStorageDefaultHostQuota, quota()); ???? |
} |
TEST_F(QuotaManagerTest, GetPersistentUsageAndQuota_MultiOrigins) { |
@@ -1294,10 +1291,10 @@ TEST_F(QuotaManagerTest, GetUsage_WithDeleteOrigin) { |
EXPECT_EQ(predelete_host_pers, usage()); |
} |
-TEST_F(QuotaManagerTest, GetAvailableSpaceTest) { |
- GetAvailableSpace(); |
+TEST_F(QuotaManagerTest, GetDeviceStorageCapacity) { |
+ GetDeviceStorageCapacity(); |
base::RunLoop().RunUntilIdle(); |
- EXPECT_EQ(kQuotaStatusOk, status()); |
+ EXPECT_LE(0, total_space()); |
EXPECT_LE(0, available_space()); |
} |
@@ -1529,7 +1526,7 @@ TEST_F(QuotaManagerTest, EvictOriginDataWithDeletionError) { |
EXPECT_EQ(predelete_host_pers, usage()); |
} |
-TEST_F(QuotaManagerTest, GetUsageAndQuotaForEviction) { |
+TEST_F(QuotaManagerTest, GetEvictionRoundInfo) { |
static const MockOriginData kData[] = { |
{ "http://foo.com/", kTemp, 1 }, |
{ "http://foo.com:1/", kTemp, 20 }, |
@@ -1542,14 +1539,16 @@ TEST_F(QuotaManagerTest, GetUsageAndQuotaForEviction) { |
QuotaClient::kFileSystem); |
RegisterClient(client); |
- SetTemporaryGlobalQuota(10000000); |
- base::RunLoop().RunUntilIdle(); |
+ const int kPoolSize = 10000000; |
+ const int kPerHostQuota = kPoolSize / 5; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
- GetUsageAndQuotaForEviction(); |
+ GetEvictionRoundInfo(); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
- EXPECT_EQ(21, limited_usage()); |
- EXPECT_EQ(10000000, quota()); |
+ EXPECT_EQ(21, usage()); |
+ EXPECT_EQ(kPoolSize, config().pool_size); |
EXPECT_LE(0, available_space()); |
} |
@@ -1802,16 +1801,19 @@ TEST_F(QuotaManagerTest, GetCachedOrigins) { |
GetCachedOrigins(kTemp, &origins); |
EXPECT_TRUE(origins.empty()); |
- // No matter how we make queries the quota manager tries to cache all |
- // the origins at startup. |
GetHostUsage("a.com", kTemp); |
base::RunLoop().RunUntilIdle(); |
GetCachedOrigins(kTemp, &origins); |
- EXPECT_EQ(3U, origins.size()); |
+ EXPECT_EQ(2U, origins.size()); |
GetHostUsage("b.com", kTemp); |
base::RunLoop().RunUntilIdle(); |
GetCachedOrigins(kTemp, &origins); |
+ EXPECT_EQ(2U, origins.size()); |
+ |
+ GetHostUsage("c.com", kTemp); |
+ base::RunLoop().RunUntilIdle(); |
+ GetCachedOrigins(kTemp, &origins); |
EXPECT_EQ(3U, origins.size()); |
GetCachedOrigins(kPerm, &origins); |
@@ -2268,44 +2270,36 @@ TEST_F(QuotaManagerTest, GetUsageAndQuota_Incognito) { |
RegisterClient(CreateClient(kData, arraysize(kData), |
QuotaClient::kFileSystem)); |
+ // ooops support, kPerm for incognito too :( |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(80, usage()); |
EXPECT_EQ(0, quota()); |
- SetTemporaryGlobalQuota(100); |
+ const int kPoolSize = 100; |
+ const int kPerHostQuota = kPoolSize / 5; |
+ SetStorageConfig(kPoolSize, kPerHostQuota, |
+ kMustRemainAvailableForSystem); |
+ |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(10, usage()); |
- EXPECT_LE(std::min(static_cast<int64_t>(100 / kPerHostTemporaryPortion), |
- QuotaManager::kIncognitoDefaultQuotaLimit), |
- quota()); |
+ EXPECT_LE(kPerHostQuota, quota()); |
mock_special_storage_policy()->AddUnlimited(GURL("http://foo.com/")); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kPerm); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(80, usage()); |
- EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); |
+ EXPECT_EQ(kPerHostQuota, quota()); |
GetUsageAndQuotaForWebApps(GURL("http://foo.com/"), kTemp); |
base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kQuotaStatusOk, status()); |
EXPECT_EQ(10, usage()); |
- EXPECT_EQ(QuotaManager::kIncognitoDefaultQuotaLimit, quota()); |
-} |
- |
-TEST_F(QuotaManagerTest, GetVolumeInfo) { |
- // We aren't actually testing that it's correct, just that it's sane. |
- base::FilePath tmp_dir; |
- ASSERT_TRUE(base::GetTempDir(&tmp_dir)); |
- uint64_t available_space = 0; |
- uint64_t total_size = 0; |
- EXPECT_TRUE(GetVolumeInfo(tmp_dir, &available_space, &total_size)); |
- EXPECT_GT(available_space, 0u) << tmp_dir.value(); |
- EXPECT_GT(total_size, 0u) << tmp_dir.value(); |
+ EXPECT_EQ(kPerHostQuota, quota()); |
} |
} // namespace content |