Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Unified Diff: ui/aura/test/aura_test_helper.cc

Issue 1297173003: Revert of aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/test/run_all_unittests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/aura/test/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698