| Index: content/public/test/test_renderer_host.cc
|
| diff --git a/content/public/test/test_renderer_host.cc b/content/public/test/test_renderer_host.cc
|
| index 9a1cc856c58935bdf4b447e44d833e7b112eb315..c9b4e6d6cc4cc82224f4be84756bc0d55c242115 100644
|
| --- a/content/public/test/test_renderer_host.cc
|
| +++ b/content/public/test/test_renderer_host.cc
|
| @@ -72,7 +72,9 @@ RenderViewHostTestEnabler::~RenderViewHostTestEnabler() {
|
|
|
| // RenderViewHostTestHarness --------------------------------------------------
|
|
|
| -RenderViewHostTestHarness::RenderViewHostTestHarness() : contents_(NULL) {
|
| +RenderViewHostTestHarness::RenderViewHostTestHarness()
|
| + : contents_(NULL),
|
| + real_threads_mask_(TestBrowserThreadBundle::NO_REAL_THREAD) {
|
| }
|
|
|
| RenderViewHostTestHarness::~RenderViewHostTestHarness() {
|
| @@ -155,11 +157,14 @@ void RenderViewHostTestHarness::FailedReload() {
|
| }
|
|
|
| void RenderViewHostTestHarness::SetUp() {
|
| + thread_bundle_.reset(new TestBrowserThreadBundle(real_threads_mask_));
|
| +
|
| #if defined(OS_WIN)
|
| ole_initializer_.reset(new ui::ScopedOleInitializer());
|
| #endif
|
| #if defined(USE_AURA)
|
| - aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
|
| + aura_test_helper_.reset(
|
| + new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
|
| aura_test_helper_->SetUp();
|
| #endif
|
| SetContents(CreateTestWebContents());
|
| @@ -178,13 +183,19 @@ void RenderViewHostTestHarness::TearDown() {
|
| if (rvh_test_enabler_.rph_factory_)
|
| rvh_test_enabler_.rph_factory_.reset();
|
|
|
| - // Release the browser context on the UI thread.
|
| - message_loop_.DeleteSoon(FROM_HERE, browser_context_.release());
|
| + // Release the browser context by posting itself on the end of the task
|
| + // queue. This is preferable to immediate deletion because it will behave
|
| + // properly if the |rph_factory_| reset above enqueued any tasks which
|
| + // depend on |browser_context_|.
|
| + BrowserThread::DeleteSoon(content::BrowserThread::UI,
|
| + FROM_HERE,
|
| + browser_context_.release());
|
| base::RunLoop().RunUntilIdle();
|
|
|
| #if defined(OS_WIN)
|
| ole_initializer_.reset();
|
| #endif
|
| + thread_bundle_.reset();
|
| }
|
|
|
| void RenderViewHostTestHarness::SetRenderProcessHostFactory(
|
|
|