| Index: content/browser/indexed_db/indexed_db_quota_client_unittest.cc
|
| diff --git a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
|
| index a5a11cee301d7bfd322eaec132f0731312f46122..d7e9b04c7cafccb3dd895494f3c7fac6832208d6 100644
|
| --- a/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
|
| +++ b/content/browser/indexed_db/indexed_db_quota_client_unittest.cc
|
| @@ -12,7 +12,8 @@
|
| #include "base/files/scoped_temp_dir.h"
|
| #include "base/macros.h"
|
| #include "base/run_loop.h"
|
| -#include "base/test/test_simple_task_runner.h"
|
| +#include "base/test/scoped_task_environment.h"
|
| +#include "base/threading/sequenced_task_runner_handle.h"
|
| #include "base/threading/thread.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "content/browser/browser_thread_impl.h"
|
| @@ -42,27 +43,24 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| kOriginB("http://host:8000"),
|
| kOriginOther("http://other"),
|
| usage_(0),
|
| - task_runner_(new base::TestSimpleTaskRunner),
|
| + scoped_task_environment_(
|
| + base::test::ScopedTaskEnvironment::MainThreadType::UI),
|
| weak_factory_(this) {
|
| browser_context_.reset(new TestBrowserContext());
|
|
|
| scoped_refptr<storage::QuotaManager> quota_manager =
|
| new MockQuotaManager(false /*in_memory*/, browser_context_->GetPath(),
|
| base::ThreadTaskRunnerHandle::Get(),
|
| - base::ThreadTaskRunnerHandle::Get(),
|
| + base::SequencedTaskRunnerHandle::Get(),
|
| browser_context_->GetSpecialStoragePolicy());
|
|
|
| - idb_context_ =
|
| - new IndexedDBContextImpl(browser_context_->GetPath(),
|
| - browser_context_->GetSpecialStoragePolicy(),
|
| - quota_manager->proxy(),
|
| - task_runner_.get());
|
| + idb_context_ = new IndexedDBContextImpl(
|
| + browser_context_->GetPath(),
|
| + browser_context_->GetSpecialStoragePolicy(), quota_manager->proxy());
|
| base::RunLoop().RunUntilIdle();
|
| setup_temp_dir();
|
| }
|
|
|
| - void FlushIndexedDBTaskRunner() { task_runner_->RunUntilIdle(); }
|
| -
|
| void setup_temp_dir() {
|
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| base::FilePath indexeddb_dir =
|
| @@ -72,7 +70,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| }
|
|
|
| ~IndexedDBQuotaClientTest() override {
|
| - FlushIndexedDBTaskRunner();
|
| + scoped_task_environment_.RunUntilIdle();
|
| idb_context_ = NULL;
|
| browser_context_.reset();
|
| base::RunLoop().RunUntilIdle();
|
| @@ -87,8 +85,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| type,
|
| base::Bind(&IndexedDBQuotaClientTest::OnGetOriginUsageComplete,
|
| weak_factory_.GetWeakPtr()));
|
| - FlushIndexedDBTaskRunner();
|
| - base::RunLoop().RunUntilIdle();
|
| + scoped_task_environment_.RunUntilIdle();
|
| EXPECT_GT(usage_, -1);
|
| return usage_;
|
| }
|
| @@ -100,8 +97,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| type,
|
| base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete,
|
| weak_factory_.GetWeakPtr()));
|
| - FlushIndexedDBTaskRunner();
|
| - base::RunLoop().RunUntilIdle();
|
| + scoped_task_environment_.RunUntilIdle();
|
| return origins_;
|
| }
|
|
|
| @@ -114,8 +110,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| host,
|
| base::Bind(&IndexedDBQuotaClientTest::OnGetOriginsComplete,
|
| weak_factory_.GetWeakPtr()));
|
| - FlushIndexedDBTaskRunner();
|
| - base::RunLoop().RunUntilIdle();
|
| + scoped_task_environment_.RunUntilIdle();
|
| return origins_;
|
| }
|
|
|
| @@ -127,8 +122,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| kTemp,
|
| base::Bind(&IndexedDBQuotaClientTest::OnDeleteOriginComplete,
|
| weak_factory_.GetWeakPtr()));
|
| - FlushIndexedDBTaskRunner();
|
| - base::RunLoop().RunUntilIdle();
|
| + scoped_task_environment_.RunUntilIdle();
|
| return delete_status_;
|
| }
|
|
|
| @@ -165,7 +159,7 @@ class IndexedDBQuotaClientTest : public testing::Test {
|
| base::ScopedTempDir temp_dir_;
|
| int64_t usage_;
|
| std::set<GURL> origins_;
|
| - scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
|
| + base::test::ScopedTaskEnvironment scoped_task_environment_;
|
| scoped_refptr<IndexedDBContextImpl> idb_context_;
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| std::unique_ptr<TestBrowserContext> browser_context_;
|
|
|