OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/aura/test/aura_test_helper.h" | 5 #include "ui/aura/test/aura_test_helper.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "ui/aura/client/default_capture_client.h" | 10 #include "ui/aura/client/default_capture_client.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 focus_client_ = base::MakeUnique<TestFocusClient>(); | 88 focus_client_ = base::MakeUnique<TestFocusClient>(); |
89 capture_client_ = base::MakeUnique<client::DefaultCaptureClient>(); | 89 capture_client_ = base::MakeUnique<client::DefaultCaptureClient>(); |
90 Env::WindowPortFactory window_impl_factory = | 90 Env::WindowPortFactory window_impl_factory = |
91 base::Bind(&AuraTestHelper::CreateWindowPort, base::Unretained(this)); | 91 base::Bind(&AuraTestHelper::CreateWindowPort, base::Unretained(this)); |
92 if (mode_ == Mode::MUS_CREATE_WINDOW_TREE_CLIENT) | 92 if (mode_ == Mode::MUS_CREATE_WINDOW_TREE_CLIENT) |
93 InitWindowTreeClient(); | 93 InitWindowTreeClient(); |
94 if (!Env::GetInstanceDontCreate()) | 94 if (!Env::GetInstanceDontCreate()) |
95 env_ = Env::CreateInstance(window_impl_factory); | 95 env_ = Env::CreateInstance(window_impl_factory); |
96 else | 96 else |
97 EnvTestHelper(Env::GetInstance()).SetWindowPortFactory(window_impl_factory); | 97 EnvTestHelper(Env::GetInstance()).SetWindowPortFactory(window_impl_factory); |
| 98 Env::GetInstance()->SetActiveFocusClient(focus_client_.get(), nullptr); |
98 Env::GetInstance()->set_context_factory(context_factory); | 99 Env::GetInstance()->set_context_factory(context_factory); |
99 // Unit tests generally don't want to query the system, rather use the state | 100 // Unit tests generally don't want to query the system, rather use the state |
100 // from RootWindow. | 101 // from RootWindow. |
101 EnvTestHelper env_helper(Env::GetInstance()); | 102 EnvTestHelper env_helper(Env::GetInstance()); |
102 env_helper.SetInputStateLookup(nullptr); | 103 env_helper.SetInputStateLookup(nullptr); |
103 env_helper.ResetEventState(); | 104 env_helper.ResetEventState(); |
104 | 105 |
105 ui::InitializeInputMethodForTesting(); | 106 ui::InitializeInputMethodForTesting(); |
106 | 107 |
107 display::Screen* screen = display::Screen::GetScreen(); | 108 display::Screen* screen = display::Screen::GetScreen(); |
(...skipping 25 matching lines...) Expand all Loading... |
133 host_.reset(); | 134 host_.reset(); |
134 ui::GestureRecognizer::Reset(); | 135 ui::GestureRecognizer::Reset(); |
135 if (display::Screen::GetScreen() == test_screen_.get()) | 136 if (display::Screen::GetScreen() == test_screen_.get()) |
136 display::Screen::SetScreenInstance(nullptr); | 137 display::Screen::SetScreenInstance(nullptr); |
137 test_screen_.reset(); | 138 test_screen_.reset(); |
138 | 139 |
139 #if defined(USE_X11) | 140 #if defined(USE_X11) |
140 ui::test::ResetXCursorCache(); | 141 ui::test::ResetXCursorCache(); |
141 #endif | 142 #endif |
142 | 143 |
| 144 Env::GetInstance()->SetActiveFocusClient(nullptr, nullptr); |
143 window_tree_client_setup_.reset(); | 145 window_tree_client_setup_.reset(); |
144 focus_client_.reset(); | 146 focus_client_.reset(); |
145 capture_client_.reset(); | 147 capture_client_.reset(); |
146 | 148 |
147 ui::ShutdownInputMethodForTesting(); | 149 ui::ShutdownInputMethodForTesting(); |
148 | 150 |
149 if (env_) { | 151 if (env_) { |
150 env_.reset(); | 152 env_.reset(); |
151 } else { | 153 } else { |
152 EnvTestHelper(Env::GetInstance()) | 154 EnvTestHelper(Env::GetInstance()) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 base::MakeUnique<WindowPortLocal>(window); | 189 base::MakeUnique<WindowPortLocal>(window); |
188 return std::move(window_port); | 190 return std::move(window_port); |
189 } | 191 } |
190 std::unique_ptr<WindowPortMus> window_port = base::MakeUnique<WindowPortMus>( | 192 std::unique_ptr<WindowPortMus> window_port = base::MakeUnique<WindowPortMus>( |
191 window_tree_client_, WindowMusType::LOCAL); | 193 window_tree_client_, WindowMusType::LOCAL); |
192 return std::move(window_port); | 194 return std::move(window_port); |
193 } | 195 } |
194 | 196 |
195 } // namespace test | 197 } // namespace test |
196 } // namespace aura | 198 } // namespace aura |
OLD | NEW |