| Index: ui/aura/test/aura_test_helper.cc
|
| diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc
|
| index 230f215c513d7a84851855320d5013aa8fd66f4d..9d8c305201e7eb51ab72147183a06bb1f887ceb7 100644
|
| --- a/ui/aura/test/aura_test_helper.cc
|
| +++ b/ui/aura/test/aura_test_helper.cc
|
| @@ -34,7 +34,8 @@
|
|
|
| AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop)
|
| : setup_called_(false),
|
| - teardown_called_(false) {
|
| + teardown_called_(false),
|
| + env_created_(false) {
|
| DCHECK(message_loop);
|
| message_loop_ = message_loop;
|
| // Disable animations during tests.
|
| @@ -56,8 +57,10 @@
|
| void AuraTestHelper::SetUp(ui::ContextFactory* context_factory) {
|
| setup_called_ = true;
|
|
|
| - if (!Env::GetInstanceDontCreate())
|
| - env_ = aura::Env::CreateInstance();
|
| + if (!Env::GetInstanceDontCreate()) {
|
| + env_created_ = true;
|
| + Env::CreateInstance(true);
|
| + }
|
| Env::GetInstance()->set_context_factory(context_factory);
|
| // Unit tests generally don't want to query the system, rather use the state
|
| // from RootWindow.
|
| @@ -99,7 +102,8 @@
|
|
|
| ui::ShutdownInputMethodForTesting();
|
|
|
| - env_.reset();
|
| + if (env_created_)
|
| + Env::DeleteInstance();
|
| }
|
|
|
| void AuraTestHelper::RunAllPendingInMessageLoop() {
|
|
|