diff options
author | skyostil <skyostil@chromium.org> | 2015-06-05 10:23:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-05 17:24:40 +0000 |
commit | 422456f9d53f0bf936a64f21a1463fd0abd3df84 (patch) | |
tree | afa337c4e76bfb38d0bcf606d5272a7a4b6f5ba0 /content/browser/storage_partition_impl_unittest.cc | |
parent | 9c8e5d7259661cda32b698ee88254491e6984900 (diff) | |
download | chromium_src-422456f9d53f0bf936a64f21a1463fd0abd3df84.zip chromium_src-422456f9d53f0bf936a64f21a1463fd0abd3df84.tar.gz chromium_src-422456f9d53f0bf936a64f21a1463fd0abd3df84.tar.bz2 |
content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs
This patch was mostly autogenerated with
https://codereview.chromium.org/1010073002/.
BUG=465354
TBR=nick@chromium.org
Review URL: https://codereview.chromium.org/1159623009
Cr-Commit-Position: refs/heads/master@{#333081}
Diffstat (limited to 'content/browser/storage_partition_impl_unittest.cc')
-rw-r--r-- | content/browser/storage_partition_impl_unittest.cc | 95 |
1 files changed, 44 insertions, 51 deletions
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc index a2950c8..79e33beb2 100644 --- a/content/browser/storage_partition_impl_unittest.cc +++ b/content/browser/storage_partition_impl_unittest.cc @@ -3,8 +3,10 @@ // found in the LICENSE file. #include "base/files/file_util.h" -#include "base/message_loop/message_loop_proxy.h" +#include "base/location.h" #include "base/run_loop.h" +#include "base/single_thread_task_runner.h" +#include "base/thread_task_runner_handle.h" #include "base/threading/thread.h" #include "content/browser/browser_thread_impl.h" #include "content/browser/gpu/shader_disk_cache.h" @@ -403,11 +405,11 @@ TEST_F(StoragePartitionShaderClearTest, ClearShaderCache) { EXPECT_EQ(1u, Size()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind( - &ClearData, - BrowserContext::GetDefaultStoragePartition(browser_context()), - &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&ClearData, + BrowserContext::GetDefaultStoragePartition(browser_context()), + &run_loop)); run_loop.Run(); EXPECT_EQ(0u, Size()); } @@ -475,7 +477,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForeverBoth) { GetMockManager()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearQuotaData, partition, &run_loop)); run_loop.Run(); @@ -502,7 +504,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForeverOnlyTemporary) { GetMockManager()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearQuotaData, partition, &run_loop)); run_loop.Run(); @@ -529,7 +531,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForeverOnlyPersistent) { GetMockManager()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearQuotaData, partition, &run_loop)); run_loop.Run(); @@ -554,7 +556,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForeverNeither) { GetMockManager()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearQuotaData, partition, &run_loop)); run_loop.Run(); @@ -581,10 +583,9 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForeverSpecificOrigin) { GetMockManager()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearQuotaDataForOrigin, - partition, kOrigin1, base::Time(), - &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&ClearQuotaDataForOrigin, partition, kOrigin1, + base::Time(), &run_loop)); run_loop.Run(); EXPECT_FALSE(GetMockManager()->OriginHasData(kOrigin1, kTemporary, @@ -610,11 +611,10 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForLastHour) { GetMockManager()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearQuotaDataForOrigin, - partition, GURL(), - base::Time::Now() - base::TimeDelta::FromHours(1), - &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&ClearQuotaDataForOrigin, partition, GURL(), + base::Time::Now() - base::TimeDelta::FromHours(1), &run_loop)); run_loop.Run(); EXPECT_FALSE(GetMockManager()->OriginHasData(kOrigin1, kTemporary, @@ -639,11 +639,10 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedDataForLastWeek) { BrowserContext::GetDefaultStoragePartition(browser_context())); partition->OverrideQuotaManagerForTesting( GetMockManager()); - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearQuotaDataForNonPersistent, - partition, - base::Time::Now() - base::TimeDelta::FromDays(7), - &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&ClearQuotaDataForNonPersistent, partition, + base::Time::Now() - base::TimeDelta::FromDays(7), &run_loop)); run_loop.Run(); EXPECT_FALSE(GetMockManager()->OriginHasData(kOrigin1, kTemporary, @@ -675,9 +674,8 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedUnprotectedOrigins) { partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearQuotaDataWithOriginMatcher, - partition, GURL(), + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&ClearQuotaDataWithOriginMatcher, partition, GURL(), base::Bind(&DoesOriginMatchForUnprotectedWeb), base::Time(), &run_loop)); run_loop.Run(); @@ -712,11 +710,11 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedProtectedSpecificOrigin) { // Try to remove kOrigin1. Expect failure. base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearQuotaDataWithOriginMatcher, - partition, kOrigin1, - base::Bind(&DoesOriginMatchForUnprotectedWeb), - base::Time(), &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::Bind(&ClearQuotaDataWithOriginMatcher, partition, kOrigin1, + base::Bind(&DoesOriginMatchForUnprotectedWeb), base::Time(), + &run_loop)); run_loop.Run(); EXPECT_TRUE(GetMockManager()->OriginHasData(kOrigin1, kTemporary, @@ -748,10 +746,9 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedProtectedOrigins) { partition->OverrideQuotaManagerForTesting( GetMockManager()); partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind(&ClearQuotaDataWithOriginMatcher, - partition, GURL(), + base::Bind(&ClearQuotaDataWithOriginMatcher, partition, GURL(), base::Bind(&DoesOriginMatchForBothProtectedAndUnprotectedWeb), base::Time(), &run_loop)); run_loop.Run(); @@ -778,9 +775,8 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedIgnoreDevTools) { BrowserContext::GetDefaultStoragePartition(browser_context())); partition->OverrideQuotaManagerForTesting( GetMockManager()); - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearQuotaDataWithOriginMatcher, - partition, GURL(), + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&ClearQuotaDataWithOriginMatcher, partition, GURL(), base::Bind(&DoesOriginMatchUnprotected), base::Time(), &run_loop)); run_loop.Run(); @@ -803,10 +799,9 @@ TEST_F(StoragePartitionImplTest, RemoveCookieForever) { partition->SetURLRequestContext(browser_context()->GetRequestContext()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearCookies, - partition, base::Time(), base::Time::Max(), - &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&ClearCookies, partition, base::Time(), + base::Time::Max(), &run_loop)); run_loop.Run(); EXPECT_FALSE(tester.ContainsCookie()); @@ -824,10 +819,9 @@ TEST_F(StoragePartitionImplTest, RemoveCookieLastHour) { partition->SetURLRequestContext(browser_context()->GetRequestContext()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( - FROM_HERE, base::Bind(&ClearCookies, - partition, an_hour_ago, base::Time::Max(), - &run_loop)); + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::Bind(&ClearCookies, partition, an_hour_ago, + base::Time::Max(), &run_loop)); run_loop.Run(); EXPECT_FALSE(tester.ContainsCookie()); @@ -851,13 +845,12 @@ TEST_F(StoragePartitionImplTest, RemoveUnprotectedLocalStorageForever) { partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearStuff, StoragePartitionImpl::REMOVE_DATA_MASK_LOCAL_STORAGE, partition, base::Time(), base::Time::Max(), - base::Bind(&DoesOriginMatchForUnprotectedWeb), - &run_loop)); + base::Bind(&DoesOriginMatchForUnprotectedWeb), &run_loop)); run_loop.Run(); EXPECT_TRUE(tester.DOMStorageExistsForOrigin(kOrigin1)); @@ -883,7 +876,7 @@ TEST_F(StoragePartitionImplTest, RemoveProtectedLocalStorageForever) { partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearStuff, StoragePartitionImpl::REMOVE_DATA_MASK_LOCAL_STORAGE, @@ -912,7 +905,7 @@ TEST_F(StoragePartitionImplTest, RemoveLocalStorageForLastWeek) { base::Time a_week_ago = base::Time::Now() - base::TimeDelta::FromDays(7); base::RunLoop run_loop; - base::MessageLoop::current()->PostTask( + base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&ClearStuff, StoragePartitionImpl::REMOVE_DATA_MASK_LOCAL_STORAGE, |