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); | |
99 Env::GetInstance()->set_context_factory(context_factory); | 98 Env::GetInstance()->set_context_factory(context_factory); |
100 // Unit tests generally don't want to query the system, rather use the state | 99 // Unit tests generally don't want to query the system, rather use the state |
101 // from RootWindow. | 100 // from RootWindow. |
102 EnvTestHelper env_helper(Env::GetInstance()); | 101 EnvTestHelper env_helper(Env::GetInstance()); |
103 env_helper.SetInputStateLookup(nullptr); | 102 env_helper.SetInputStateLookup(nullptr); |
104 env_helper.ResetEventState(); | 103 env_helper.ResetEventState(); |
105 | 104 |
106 ui::InitializeInputMethodForTesting(); | 105 ui::InitializeInputMethodForTesting(); |
107 | 106 |
108 display::Screen* screen = display::Screen::GetScreen(); | 107 display::Screen* screen = display::Screen::GetScreen(); |
(...skipping 25 matching lines...) Expand all Loading... |
134 host_.reset(); | 133 host_.reset(); |
135 ui::GestureRecognizer::Reset(); | 134 ui::GestureRecognizer::Reset(); |
136 if (display::Screen::GetScreen() == test_screen_.get()) | 135 if (display::Screen::GetScreen() == test_screen_.get()) |
137 display::Screen::SetScreenInstance(nullptr); | 136 display::Screen::SetScreenInstance(nullptr); |
138 test_screen_.reset(); | 137 test_screen_.reset(); |
139 | 138 |
140 #if defined(USE_X11) | 139 #if defined(USE_X11) |
141 ui::test::ResetXCursorCache(); | 140 ui::test::ResetXCursorCache(); |
142 #endif | 141 #endif |
143 | 142 |
144 Env::GetInstance()->SetActiveFocusClient(nullptr, nullptr); | |
145 window_tree_client_setup_.reset(); | 143 window_tree_client_setup_.reset(); |
146 focus_client_.reset(); | 144 focus_client_.reset(); |
147 capture_client_.reset(); | 145 capture_client_.reset(); |
148 | 146 |
149 ui::ShutdownInputMethodForTesting(); | 147 ui::ShutdownInputMethodForTesting(); |
150 | 148 |
151 if (env_) { | 149 if (env_) { |
152 env_.reset(); | 150 env_.reset(); |
153 } else { | 151 } else { |
154 EnvTestHelper(Env::GetInstance()) | 152 EnvTestHelper(Env::GetInstance()) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 base::MakeUnique<WindowPortLocal>(window); | 187 base::MakeUnique<WindowPortLocal>(window); |
190 return std::move(window_port); | 188 return std::move(window_port); |
191 } | 189 } |
192 std::unique_ptr<WindowPortMus> window_port = base::MakeUnique<WindowPortMus>( | 190 std::unique_ptr<WindowPortMus> window_port = base::MakeUnique<WindowPortMus>( |
193 window_tree_client_, WindowMusType::LOCAL); | 191 window_tree_client_, WindowMusType::LOCAL); |
194 return std::move(window_port); | 192 return std::move(window_port); |
195 } | 193 } |
196 | 194 |
197 } // namespace test | 195 } // namespace test |
198 } // namespace aura | 196 } // namespace aura |
OLD | NEW |