Index: ash/mus/window_manager_unittest.cc |
diff --git a/ash/mus/window_manager_unittest.cc b/ash/mus/window_manager_unittest.cc |
index 4c2c0cd0e88246778ebfd775b94812bdbd1a1108..9a93b736f8a8c7bad7fd21b22d1034f6fd82c50e 100644 |
--- a/ash/mus/window_manager_unittest.cc |
+++ b/ash/mus/window_manager_unittest.cc |
@@ -66,7 +66,28 @@ class WindowManagerTest : public service_manager::test::ServiceTest { |
WindowManagerTest() : service_manager::test::ServiceTest("mash_unittests") {} |
~WindowManagerTest() override {} |
+ // service_manager::test::ServiceTest: |
+ void SetUp() override { |
+ service_manager::test::ServiceTest::SetUp(); |
+ |
+ // This test triggers a path that clobbers the context_factory set on Env. |
+ // As all tests share the same Env (see mash_test_suite) we need to restore |
+ // the context_factory when done. |
+ aura::Env* env = aura::Env::GetInstance(); |
+ initial_context_factory_ = env->context_factory(); |
+ initial_context_factory_private_ = env->context_factory_private(); |
+ } |
+ |
+ void TearDown() override { |
+ aura::Env* env = aura::Env::GetInstance(); |
+ env->set_context_factory(initial_context_factory_); |
+ env->set_context_factory_private(initial_context_factory_private_); |
+ } |
+ |
private: |
+ ui::ContextFactory* initial_context_factory_; |
James Cook
2017/02/18 02:23:20
nit: = nullptr since constructor doesn't initializ
sky
2017/02/18 18:00:57
Done.
|
+ ui::ContextFactoryPrivate* initial_context_factory_private_; |
+ |
DISALLOW_COPY_AND_ASSIGN(WindowManagerTest); |
}; |