diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-16 01:06:36 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-16 01:06:36 +0000 |
commit | 4e1c7e5b8474fb2bbe8696fc27bed597cab2a784 (patch) | |
tree | 174c6dbf14d169dab1b3eadcb5e416ee637a59ee /webkit/quota | |
parent | 82c58589a5bcb4666fd235f461df23858b29462e (diff) | |
download | chromium_src-4e1c7e5b8474fb2bbe8696fc27bed597cab2a784.zip chromium_src-4e1c7e5b8474fb2bbe8696fc27bed597cab2a784.tar.gz chromium_src-4e1c7e5b8474fb2bbe8696fc27bed597cab2a784.tar.bz2 |
webkit: Update the calls from RunAllPending() to RunUntilIdle().
RunAllPending() is deprecated and we should switch to RunUntilIdle().
BUG=131220
TBR=darin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11595003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/quota')
-rw-r--r-- | webkit/quota/mock_quota_manager_unittest.cc | 14 | ||||
-rw-r--r-- | webkit/quota/quota_manager_unittest.cc | 388 | ||||
-rw-r--r-- | webkit/quota/quota_temporary_storage_evictor_unittest.cc | 20 |
3 files changed, 211 insertions, 211 deletions
diff --git a/webkit/quota/mock_quota_manager_unittest.cc b/webkit/quota/mock_quota_manager_unittest.cc index edd6642..c64138f 100644 --- a/webkit/quota/mock_quota_manager_unittest.cc +++ b/webkit/quota/mock_quota_manager_unittest.cc @@ -53,7 +53,7 @@ class MockQuotaManagerTest : public testing::Test { void TearDown() { // Make sure the quota manager cleans up correctly. manager_ = NULL; - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } void GetModifiedOrigins(StorageType type, base::Time since) { @@ -162,7 +162,7 @@ TEST_F(MockQuotaManagerTest, OriginDeletion) { base::Time::Now()); DeleteOriginData(kOrigin2, kTemporary, kClientFile); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, deletion_callback_count()); EXPECT_TRUE(manager()->OriginHasData(kOrigin1, kTemporary, kClientFile)); @@ -172,7 +172,7 @@ TEST_F(MockQuotaManagerTest, OriginDeletion) { EXPECT_TRUE(manager()->OriginHasData(kOrigin3, kTemporary, kClientDB)); DeleteOriginData(kOrigin3, kTemporary, kClientFile | kClientDB); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(2, deletion_callback_count()); EXPECT_TRUE(manager()->OriginHasData(kOrigin1, kTemporary, kClientFile)); @@ -189,13 +189,13 @@ TEST_F(MockQuotaManagerTest, ModifiedOrigins) { base::TimeDelta a_minute = base::TimeDelta::FromMilliseconds(60000); GetModifiedOrigins(kTemporary, then); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(origins().empty()); manager()->AddOrigin(kOrigin1, kTemporary, kClientFile, now - an_hour); GetModifiedOrigins(kTemporary, then); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTemporary, type()); EXPECT_EQ(1UL, origins().size()); @@ -205,7 +205,7 @@ TEST_F(MockQuotaManagerTest, ModifiedOrigins) { manager()->AddOrigin(kOrigin2, kTemporary, kClientFile, now); GetModifiedOrigins(kTemporary, then); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTemporary, type()); EXPECT_EQ(2UL, origins().size()); @@ -213,7 +213,7 @@ TEST_F(MockQuotaManagerTest, ModifiedOrigins) { EXPECT_EQ(1UL, origins().count(kOrigin2)); GetModifiedOrigins(kTemporary, now - a_minute); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTemporary, type()); EXPECT_EQ(1UL, origins().size()); diff --git a/webkit/quota/quota_manager_unittest.cc b/webkit/quota/quota_manager_unittest.cc index 4e05604..49476d0 100644 --- a/webkit/quota/quota_manager_unittest.cc +++ b/webkit/quota/quota_manager_unittest.cc @@ -70,7 +70,7 @@ class QuotaManagerTest : public testing::Test { void TearDown() { // Make sure the quota manager cleans up correctly. quota_manager_ = NULL; - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } protected: @@ -451,7 +451,7 @@ TEST_F(QuotaManagerTest, GetUsageInfo) { QuotaClient::kDatabase)); GetUsageInfo(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(4U, usage_info().size()); for (size_t i = 0; i < usage_info().size(); ++i) { @@ -480,20 +480,20 @@ TEST_F(QuotaManagerTest, GetUsageAndQuota_Simple) { QuotaClient::kFileSystem)); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(80, usage()); EXPECT_EQ(0, quota()); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10, usage()); EXPECT_LE(0, quota()); int64 quota_returned_for_foo = quota(); GetUsageAndQuota(GURL("http://bar.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(quota_returned_for_foo, quota()); @@ -501,30 +501,30 @@ TEST_F(QuotaManagerTest, GetUsageAndQuota_Simple) { TEST_F(QuotaManagerTest, GetUsage_NoClient) { GetUsageAndQuota(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); } @@ -532,30 +532,30 @@ TEST_F(QuotaManagerTest, GetUsage_NoClient) { TEST_F(QuotaManagerTest, GetUsage_EmptyClient) { RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem)); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, usage()); EXPECT_EQ(0, unlimited_usage()); } @@ -574,13 +574,13 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_MultiOrigins) { // This time explicitly sets a temporary global quota. SetTemporaryGlobalQuota(100); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kTemp, type()); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(100, quota()); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20, usage()); @@ -591,7 +591,7 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_MultiOrigins) { EXPECT_EQ(kPerHostQuota, quota()); GetUsageAndQuota(GURL("http://bar.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(5 + 7, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -619,52 +619,52 @@ TEST_F(QuotaManagerTest, GetUsage_MultipleClients) { QuotaClient::kDatabase)); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 30, usage()); GetUsageAndQuota(GURL("http://bar.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(50, usage()); GetUsageAndQuota(GURL("http://unlimited/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); GetUsageAndQuota(GURL("http://unlimited/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); GetAvailableSpace(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_LE(0, available_space()); GetUsageAndQuota(GURL("http://installed/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(available_space(), quota()); GetUsageAndQuota(GURL("http://installed/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(available_space(), quota()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20 + 30 + 1 + 1, usage()); EXPECT_EQ(2, unlimited_usage()); GetGlobalUsage(kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(40 + 50 + 1 + 1, usage()); EXPECT_EQ(2, unlimited_usage()); @@ -680,7 +680,7 @@ void QuotaManagerTest::GetUsage_WithModifyTestBody(const StorageType type) { RegisterClient(client); GetUsageAndQuota(GURL("http://foo.com/"), type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20, usage()); @@ -689,19 +689,19 @@ void QuotaManagerTest::GetUsage_WithModifyTestBody(const StorageType type) { client->AddOriginAndNotify(GURL("https://foo.com/"), type, 1); GetUsageAndQuota(GURL("http://foo.com/"), type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20 + 30 - 5 + 1, usage()); int foo_usage = usage(); client->AddOriginAndNotify(GURL("http://bar.com/"), type, 40); GetUsageAndQuota(GURL("http://bar.com/"), type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(40, usage()); GetGlobalUsage(type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(foo_usage + 40, usage()); EXPECT_EQ(0, unlimited_usage()); } @@ -720,14 +720,14 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_WithAdditionalTasks) { RegisterClient(CreateClient(kData, ARRAYSIZE_UNSAFE(kData), QuotaClient::kFileSystem)); SetTemporaryGlobalQuota(100); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int kPerHostQuota = 100 / QuotaManager::kPerHostTemporaryPortion; GetUsageAndQuota(GURL("http://foo.com/"), kTemp); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -737,7 +737,7 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_WithAdditionalTasks) { kTemp); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); RunAdditionalUsageAndQuotaTask(GURL("http://bar.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(kPerHostQuota, quota()); @@ -754,7 +754,7 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_NukeManager) { RegisterClient(CreateClient(kData, ARRAYSIZE_UNSAFE(kData), QuotaClient::kFileSystem)); SetTemporaryGlobalQuota(100); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); set_additional_callback_count(0); GetUsageAndQuota(GURL("http://foo.com/"), kTemp); @@ -768,7 +768,7 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_NukeManager) { // Nuke before waiting for callbacks. set_quota_manager(NULL); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaErrorAbort, status()); } @@ -781,24 +781,24 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Overbudget) { RegisterClient(CreateClient(kData, ARRAYSIZE_UNSAFE(kData), QuotaClient::kFileSystem)); SetTemporaryGlobalQuota(100); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int kPerHostQuota = 100 / QuotaManager::kPerHostTemporaryPortion; GetUsageAndQuota(GURL("http://usage1/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(1, usage()); EXPECT_EQ(1, quota()); // should be clamped to our current usage GetUsageAndQuota(GURL("http://usage10/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(10, quota()); GetUsageAndQuota(GURL("http://usage200/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(200, usage()); EXPECT_EQ(kPerHostQuota, quota()); // should be clamped to the nominal quota @@ -817,10 +817,10 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { // Test when not overbugdet. SetTemporaryGlobalQuota(1000); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(10 + 50 + 4000, usage()); EXPECT_EQ(4000, unlimited_usage()); @@ -828,44 +828,44 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { 1000 / QuotaManager::kPerHostTemporaryPortion; GetUsageAndQuota(GURL("http://usage10/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor1000, quota()); GetUsageAndQuota(GURL("http://usage50/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor1000, quota()); GetUsageAndQuota(GURL("http://unlimited/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); // Test when overbugdet. SetTemporaryGlobalQuota(100); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int kPerHostQuotaFor100 = 100 / QuotaManager::kPerHostTemporaryPortion; GetUsageAndQuota(GURL("http://usage10/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuota(GURL("http://usage50/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuota(GURL("http://unlimited/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(QuotaManager::kNoLimit, quota()); @@ -875,24 +875,24 @@ TEST_F(QuotaManagerTest, GetTemporaryUsageAndQuota_Unlimited) { mock_special_storage_policy()->NotifyChanged(); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(10 + 50 + 4000, usage()); EXPECT_EQ(0, unlimited_usage()); GetUsageAndQuota(GURL("http://usage10/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); 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(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(50, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); GetUsageAndQuota(GURL("http://unlimited/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(4000, usage()); EXPECT_EQ(kPerHostQuotaFor100, quota()); @@ -924,11 +924,11 @@ TEST_F(QuotaManagerTest, GetAndSetPerststentHostQuota) { RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem)); GetPersistentHostQuota("foo.com"); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(0, quota()); SetPersistentHostQuota("foo.com", 100); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(100, quota()); GetPersistentHostQuota("foo.com"); @@ -936,7 +936,7 @@ TEST_F(QuotaManagerTest, GetAndSetPerststentHostQuota) { GetPersistentHostQuota("foo.com"); SetPersistentHostQuota("foo.com", 300000000000ll); GetPersistentHostQuota("foo.com"); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(300000000000ll, quota()); } @@ -944,14 +944,14 @@ TEST_F(QuotaManagerTest, GetAndSetPersistentUsageAndQuota) { RegisterClient(CreateClient(NULL, 0, QuotaClient::kFileSystem)); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(0, quota()); SetPersistentHostQuota("foo.com", 100); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, usage()); EXPECT_EQ(100, quota()); @@ -973,7 +973,7 @@ TEST_F(QuotaManagerTest, GetPersistentUsageAndQuota_MultiOrigins) { SetPersistentHostQuota("foo.com", 100); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20 + 13 + 19, usage()); EXPECT_EQ(100, quota()); @@ -997,7 +997,7 @@ TEST_F(QuotaManagerTest, GetPersistentUsageAndQuota_WithAdditionalTasks) { GetUsageAndQuota(GURL("http://foo.com/"), kPerm); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(100, quota()); @@ -1007,7 +1007,7 @@ TEST_F(QuotaManagerTest, GetPersistentUsageAndQuota_WithAdditionalTasks) { kPerm); GetUsageAndQuota(GURL("http://foo.com/"), kPerm); RunAdditionalUsageAndQuotaTask(GURL("http://bar.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(10 + 20, usage()); EXPECT_EQ(2, additional_callback_count()); @@ -1031,7 +1031,7 @@ TEST_F(QuotaManagerTest, GetPersistentUsageAndQuota_NukeManager) { // Nuke before waiting for callbacks. set_quota_manager(NULL); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaErrorAbort, status()); } @@ -1049,21 +1049,21 @@ TEST_F(QuotaManagerTest, GetUsage_Simple) { QuotaClient::kFileSystem)); GetGlobalUsage(kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20 + 600000); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000); EXPECT_EQ(0, unlimited_usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20); GetHostUsage("buz.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 4000 + 50000); } @@ -1083,7 +1083,7 @@ TEST_F(QuotaManagerTest, GetUsage_WithModification) { RegisterClient(client); GetGlobalUsage(kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20 + 600000); EXPECT_EQ(0, unlimited_usage()); @@ -1091,12 +1091,12 @@ TEST_F(QuotaManagerTest, GetUsage_WithModification) { GURL("http://foo.com/"), kPerm, 80000000); GetGlobalUsage(kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 1 + 20 + 600000 + 80000000); EXPECT_EQ(0, unlimited_usage()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000); EXPECT_EQ(0, unlimited_usage()); @@ -1104,19 +1104,19 @@ TEST_F(QuotaManagerTest, GetUsage_WithModification) { GURL("http://foo.com/"), kTemp, 1); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000 + 1); EXPECT_EQ(0, unlimited_usage()); GetHostUsage("buz.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 4000 + 50000); client->ModifyOriginAndNotify( GURL("http://buz.com/"), kTemp, 900000000); GetHostUsage("buz.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(usage(), 4000 + 50000 + 900000000); } @@ -1132,38 +1132,38 @@ TEST_F(QuotaManagerTest, GetUsage_WithDeleteOrigin) { RegisterClient(client); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_pers = usage(); DeleteClientOriginData(client, GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - 1, usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_tmp - 1, usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } TEST_F(QuotaManagerTest, GetAvailableSpaceTest) { GetAvailableSpace(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_LE(0, available_space()); } @@ -1190,15 +1190,15 @@ TEST_F(QuotaManagerTest, EvictOriginData) { RegisterClient(client2); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_pers = usage(); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kData1); ++i) @@ -1207,13 +1207,13 @@ TEST_F(QuotaManagerTest, EvictOriginData) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kData2); ++i) quota_manager()->NotifyStorageAccessed(QuotaClient::kUnknown, GURL(kData2[i].origin), kData2[i].type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EvictOriginData(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); DumpOriginInfoTable(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); typedef OriginInfoTableEntries::const_iterator iterator; for (iterator itr(origin_info_entries().begin()), @@ -1224,15 +1224,15 @@ TEST_F(QuotaManagerTest, EvictOriginData) { } GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - (1 + 50000), usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_tmp - (1 + 50000), usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } @@ -1249,20 +1249,20 @@ TEST_F(QuotaManagerTest, EvictOriginDataWithDeletionError) { RegisterClient(client); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_pers = usage(); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kData); ++i) NotifyStorageAccessed(client, GURL(kData[i].origin), kData[i].type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); client->AddOriginToErrorSet(GURL("http://foo.com/"), kTemp); @@ -1270,12 +1270,12 @@ TEST_F(QuotaManagerTest, EvictOriginDataWithDeletionError) { i < QuotaManager::kThresholdOfErrorsToBeBlacklisted + 1; ++i) { EvictOriginData(GURL("http://foo.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaErrorInvalidModification, status()); } DumpOriginInfoTable(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); bool found_origin_in_database = false; typedef OriginInfoTableEntries::const_iterator iterator; @@ -1293,31 +1293,31 @@ TEST_F(QuotaManagerTest, EvictOriginDataWithDeletionError) { for (size_t i = 0; i < kNumberOfTemporaryOrigins - 1; ++i) { GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(lru_origin().is_empty()); // The origin "http://foo.com/" should not be in the LRU list. EXPECT_NE(std::string("http://foo.com/"), lru_origin().spec()); DeleteOriginFromDatabase(lru_origin(), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } // Now the LRU list must be empty. GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(lru_origin().is_empty()); // Deleting origins from the database should not affect the results of the // following checks. GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_global_tmp, usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_tmp, usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } @@ -1335,10 +1335,10 @@ TEST_F(QuotaManagerTest, GetUsageAndQuotaForEviction) { RegisterClient(client); SetTemporaryGlobalQuota(10000000); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetUsageAndQuotaForEviction(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(4021, usage()); EXPECT_EQ(4000, unlimited_usage()); @@ -1355,47 +1355,47 @@ TEST_F(QuotaManagerTest, DeleteHostDataSimple) { RegisterClient(client); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_tmp = usage(); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); int64 predelete_host_pers = usage(); DeleteHostData("", kTemp, kAllClients); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_global_tmp, usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_tmp, usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); DeleteHostData("foo.com", kTemp, kAllClients); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - 1, usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_tmp - 1, usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_host_pers, usage()); } @@ -1421,35 +1421,35 @@ TEST_F(QuotaManagerTest, DeleteHostDataMultiple) { RegisterClient(client2); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_tmp = usage(); GetHostUsage("bar.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_bar_tmp = usage(); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_pers = usage(); GetHostUsage("bar.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_bar_pers = usage(); reset_status_callback_count(); DeleteHostData("foo.com", kTemp, kAllClients); DeleteHostData("bar.com", kTemp, kAllClients); DeleteHostData("foo.com", kTemp, kAllClients); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(3, status_callback_count()); DumpOriginInfoTable(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); typedef OriginInfoTableEntries::const_iterator iterator; for (iterator itr(origin_info_entries().begin()), @@ -1464,24 +1464,24 @@ TEST_F(QuotaManagerTest, DeleteHostDataMultiple) { } GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ( predelete_global_tmp - (1 + 20 + 4000 + 50000 + 6000 + 80 + 9), usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - (1 + 20 + 50000 + 6000 + 80), usage()); GetHostUsage("bar.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_bar_tmp - (4000 + 9), usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_pers, usage()); GetHostUsage("bar.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_bar_pers, usage()); } @@ -1509,23 +1509,23 @@ TEST_F(QuotaManagerTest, DeleteOriginDataMultiple) { RegisterClient(client2); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_global_tmp = usage(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_tmp = usage(); GetHostUsage("bar.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_bar_tmp = usage(); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_pers = usage(); GetHostUsage("bar.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_bar_pers = usage(); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kData1); ++i) @@ -1534,18 +1534,18 @@ TEST_F(QuotaManagerTest, DeleteOriginDataMultiple) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kData2); ++i) quota_manager()->NotifyStorageAccessed(QuotaClient::kUnknown, GURL(kData2[i].origin), kData2[i].type); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); reset_status_callback_count(); DeleteOriginData(GURL("http://foo.com/"), kTemp, kAllClients); DeleteOriginData(GURL("http://bar.com/"), kTemp, kAllClients); DeleteOriginData(GURL("http://foo.com/"), kTemp, kAllClients); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(3, status_callback_count()); DumpOriginInfoTable(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); typedef OriginInfoTableEntries::const_iterator iterator; for (iterator itr(origin_info_entries().begin()), @@ -1558,23 +1558,23 @@ TEST_F(QuotaManagerTest, DeleteOriginDataMultiple) { } GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_global_tmp - (1 + 4000 + 50000 + 9), usage()); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - (1 + 50000), usage()); GetHostUsage("bar.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_bar_tmp - (4000 + 9), usage()); GetHostUsage("foo.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_pers, usage()); GetHostUsage("bar.com", kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_bar_pers, usage()); } @@ -1598,12 +1598,12 @@ TEST_F(QuotaManagerTest, GetCachedOrigins) { // No matter how we make queries the quota manager tries to cache all // the origins at startup. GetHostUsage("a.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(3U, origins.size()); GetHostUsage("b.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(3U, origins.size()); @@ -1611,7 +1611,7 @@ TEST_F(QuotaManagerTest, GetCachedOrigins) { EXPECT_TRUE(origins.empty()); GetGlobalUsage(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetCachedOrigins(kTemp, &origins); EXPECT_EQ(3U, origins.size()); @@ -1635,29 +1635,29 @@ TEST_F(QuotaManagerTest, NotifyAndLRUOrigin) { GURL origin; GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(lru_origin().is_empty()); NotifyStorageAccessed(client, GURL("http://a.com/"), kTemp); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("http://a.com/", lru_origin().spec()); NotifyStorageAccessed(client, GURL("http://b.com/"), kPerm); NotifyStorageAccessed(client, GURL("https://a.com/"), kTemp); NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("http://a.com/", lru_origin().spec()); DeleteOriginFromDatabase(lru_origin(), kTemp); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("https://a.com/", lru_origin().spec()); DeleteOriginFromDatabase(lru_origin(), kTemp); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("http://c.com/", lru_origin().spec()); } @@ -1675,7 +1675,7 @@ TEST_F(QuotaManagerTest, GetLRUOriginWithOriginInUse) { GURL origin; GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(lru_origin().is_empty()); NotifyStorageAccessed(client, GURL("http://a.com/"), kTemp); @@ -1684,19 +1684,19 @@ TEST_F(QuotaManagerTest, GetLRUOriginWithOriginInUse) { NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("http://a.com/", lru_origin().spec()); // Notify origin http://a.com is in use. NotifyOriginInUse(GURL("http://a.com/")); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("https://a.com/", lru_origin().spec()); // Notify origin https://a.com is in use while GetLRUOrigin is running. GetLRUOrigin(kTemp); NotifyOriginInUse(GURL("https://a.com/")); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Post-filtering must have excluded the returned origin, so we will // see empty result here. EXPECT_TRUE(lru_origin().is_empty()); @@ -1704,7 +1704,7 @@ TEST_F(QuotaManagerTest, GetLRUOriginWithOriginInUse) { // Notify access for http://c.com while GetLRUOrigin is running. GetLRUOrigin(kTemp); NotifyStorageAccessed(client, GURL("http://c.com/"), kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Post-filtering must have excluded the returned origin, so we will // see empty result here. EXPECT_TRUE(lru_origin().is_empty()); @@ -1712,7 +1712,7 @@ TEST_F(QuotaManagerTest, GetLRUOriginWithOriginInUse) { NotifyOriginNoLongerInUse(GURL("http://a.com/")); NotifyOriginNoLongerInUse(GURL("https://a.com/")); GetLRUOrigin(kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ("http://a.com/", lru_origin().spec()); } @@ -1729,7 +1729,7 @@ TEST_F(QuotaManagerTest, GetOriginsModifiedSince) { RegisterClient(client); GetOriginsModifiedSince(kTemp, base::Time()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(modified_origins().empty()); EXPECT_EQ(modified_origins_type(), kTemp); @@ -1743,7 +1743,7 @@ TEST_F(QuotaManagerTest, GetOriginsModifiedSince) { base::Time time3 = client->IncrementMockTime(); GetOriginsModifiedSince(kTemp, time1); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(4U, modified_origins().size()); EXPECT_EQ(modified_origins_type(), kTemp); for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kData); ++i) { @@ -1752,18 +1752,18 @@ TEST_F(QuotaManagerTest, GetOriginsModifiedSince) { } GetOriginsModifiedSince(kTemp, time2); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(2U, modified_origins().size()); GetOriginsModifiedSince(kTemp, time3); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_TRUE(modified_origins().empty()); EXPECT_EQ(modified_origins_type(), kTemp); client->ModifyOriginAndNotify(GURL("http://a.com/"), kTemp, 10); GetOriginsModifiedSince(kTemp, time3); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1U, modified_origins().size()); EXPECT_EQ(1U, modified_origins().count(GURL("http://a.com/"))); EXPECT_EQ(modified_origins_type(), kTemp); @@ -1773,10 +1773,10 @@ TEST_F(QuotaManagerTest, DumpQuotaTable) { SetPersistentHostQuota("example1.com", 1); SetPersistentHostQuota("example2.com", 20); SetPersistentHostQuota("example3.com", 300); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); DumpQuotaTable(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const QuotaTableEntry kEntries[] = { QuotaTableEntry("example1.com", kPerm, 1), @@ -1812,10 +1812,10 @@ TEST_F(QuotaManagerTest, DumpOriginInfoTable) { QuotaClient::kUnknown, GURL("http://example.com/"), kPerm); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); DumpOriginInfoTable(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); typedef std::pair<GURL, StorageType> TypedOrigin; typedef std::pair<TypedOrigin, int> Entry; @@ -1843,12 +1843,12 @@ TEST_F(QuotaManagerTest, DumpOriginInfoTable) { TEST_F(QuotaManagerTest, QuotaForEmptyHost) { GetPersistentHostQuota(std::string()); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaStatusOk, status()); EXPECT_EQ(0, quota()); SetPersistentHostQuota(std::string(), 10); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(kQuotaErrorNotSupported, status()); } @@ -1879,32 +1879,32 @@ TEST_F(QuotaManagerTest, DeleteSpecificClientTypeSingleOrigin) { RegisterClient(client4); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_tmp = usage(); DeleteOriginData(GURL("http://foo.com/"), kTemp, QuotaClient::kFileSystem); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 1, usage()); DeleteOriginData(GURL("http://foo.com/"), kTemp, QuotaClient::kAppcache); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); DeleteOriginData(GURL("http://foo.com/"), kTemp, QuotaClient::kDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 4 - 2 - 1, usage()); DeleteOriginData(GURL("http://foo.com/"), kTemp, QuotaClient::kIndexedDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -1935,31 +1935,31 @@ TEST_F(QuotaManagerTest, DeleteSpecificClientTypeSingleHost) { RegisterClient(client4); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_tmp = usage(); DeleteHostData("foo.com", kTemp, QuotaClient::kFileSystem); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kAppcache); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 4 - 2 - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kIndexedDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -1990,21 +1990,21 @@ TEST_F(QuotaManagerTest, DeleteMultipleClientTypesSingleOrigin) { RegisterClient(client4); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_tmp = usage(); DeleteOriginData(GURL("http://foo.com/"), kTemp, QuotaClient::kFileSystem | QuotaClient::kDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 4 - 1, usage()); DeleteOriginData(GURL("http://foo.com/"), kTemp, QuotaClient::kAppcache | QuotaClient::kIndexedDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2035,21 +2035,21 @@ TEST_F(QuotaManagerTest, DeleteMultipleClientTypesSingleHost) { RegisterClient(client4); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); const int64 predelete_foo_tmp = usage(); DeleteHostData("foo.com", kTemp, QuotaClient::kFileSystem | QuotaClient::kAppcache); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); DeleteHostData("foo.com", kTemp, QuotaClient::kDatabase | QuotaClient::kIndexedDatabase); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); GetHostUsage("foo.com", kTemp); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } } // namespace quota diff --git a/webkit/quota/quota_temporary_storage_evictor_unittest.cc b/webkit/quota/quota_temporary_storage_evictor_unittest.cc index 756c627..21c1cf9 100644 --- a/webkit/quota/quota_temporary_storage_evictor_unittest.cc +++ b/webkit/quota/quota_temporary_storage_evictor_unittest.cc @@ -148,7 +148,7 @@ class QuotaTemporaryStorageEvictorTest : public testing::Test { void SetUp() { quota_eviction_handler_.reset(new MockQuotaEvictionHandler(this)); - // Run multiple evictions in a single RunAllPending() when interval_ms == 0 + // Run multiple evictions in a single RunUntilIdle() when interval_ms == 0 temporary_storage_evictor_.reset(new QuotaTemporaryStorageEvictor( quota_eviction_handler_.get(), 0)); } @@ -156,7 +156,7 @@ class QuotaTemporaryStorageEvictorTest : public testing::Test { void TearDown() { temporary_storage_evictor_.reset(); quota_eviction_handler_.reset(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); } void TaskForRepeatedEvictionTest( @@ -240,7 +240,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, SimpleEvictionTest) { EXPECT_EQ(3000 + 200 + 500, quota_eviction_handler()->GetUsage()); set_repeated_eviction(false); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(200 + 500, quota_eviction_handler()->GetUsage()); EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); @@ -260,7 +260,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, MultipleEvictionTest) { EXPECT_EQ(20 + 2900 + 450 + 400, quota_eviction_handler()->GetUsage()); set_repeated_eviction(false); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(450 + 400, quota_eviction_handler()->GetUsage()); EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); @@ -292,7 +292,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionTest) { initial_total_size - d_size + e_size - c_size)); EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage()); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(initial_total_size - d_size + e_size - c_size - b_size, quota_eviction_handler()->GetUsage()); EXPECT_EQ(5, num_get_usage_and_quota_for_eviction()); @@ -324,7 +324,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionSkippedTest) { EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage()); set_repeated_eviction(true); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(initial_total_size - d_size, quota_eviction_handler()->GetUsage()); EXPECT_EQ(4, num_get_usage_and_quota_for_eviction()); @@ -359,7 +359,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, RepeatedEvictionWithAccessOriginTest) { initial_total_size - d_size + e_size - b_size)); EXPECT_EQ(initial_total_size, quota_eviction_handler()->GetUsage()); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(initial_total_size - d_size + e_size - b_size - a_size, quota_eviction_handler()->GetUsage()); EXPECT_EQ(5, num_get_usage_and_quota_for_eviction()); @@ -381,7 +381,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, DiskSpaceNonEvictionTest) { reset_min_available_disk_space_to_start_eviction(); set_repeated_eviction(false); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(414 + 450, quota_eviction_handler()->GetUsage()); EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); @@ -404,7 +404,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, DiskSpaceEvictionTest) { default_min_available_disk_space_to_start_eviction()); set_repeated_eviction(false); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(150 + 300, quota_eviction_handler()->GetUsage()); EXPECT_EQ(0, statistics().num_errors_on_evicting_origin); @@ -424,7 +424,7 @@ TEST_F(QuotaTemporaryStorageEvictorTest, UnlimitedExclusionEvictionTest) { EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); set_repeated_eviction(false); temporary_storage_evictor()->Start(); - MessageLoop::current()->RunAllPending(); + MessageLoop::current()->RunUntilIdle(); // Nothing should have been evicted. EXPECT_EQ(3000 + 200 + 500000, quota_eviction_handler()->GetUsage()); } |