Index: content/browser/storage_partition_impl_unittest.cc |
diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc |
index a2950c850aaf2d0a76de15621dc3a93f9081101e..79e33beb2500a0331329c421d40df6c0edd86f7a 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, |