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

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

Issue 1871253002: aura: Require explicit ownership of the Env instance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tot.merge Created 4 years, 8 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 554f229a3c6ebc95429c7ee1296ecf31d73507d6..2d679e59f184c7f2248e374f1e65832776bb6b06 100644
--- a/ui/aura/test/aura_test_helper.cc
+++ b/ui/aura/test/aura_test_helper.cc
@@ -34,8 +34,7 @@ namespace test {
AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop)
: setup_called_(false),
- teardown_called_(false),
- env_created_(false) {
+ teardown_called_(false) {
DCHECK(message_loop);
message_loop_ = message_loop;
// Disable animations during tests.
@@ -57,10 +56,8 @@ AuraTestHelper::~AuraTestHelper() {
void AuraTestHelper::SetUp(ui::ContextFactory* context_factory) {
setup_called_ = true;
- if (!Env::GetInstanceDontCreate()) {
- env_created_ = true;
- Env::CreateInstance(true);
- }
+ if (!Env::GetInstanceDontCreate())
+ env_ = aura::Env::CreateInstance();
Env::GetInstance()->set_context_factory(context_factory);
// Unit tests generally don't want to query the system, rather use the state
// from RootWindow.
@@ -103,8 +100,7 @@ void AuraTestHelper::TearDown() {
ui::ShutdownInputMethodForTesting();
- if (env_created_)
- Env::DeleteInstance();
+ env_.reset();
}
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