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

Side by Side Diff: ui/aura/test/aura_test_helper.cc

Issue 2453953003: Moves TransientWindowClient to ui/aura/client and adds observer (Closed)
Patch Set: merge Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/views/corewm/tooltip_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind.h"
8 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 9 #include "base/run_loop.h"
11 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
12 #include "ui/aura/client/focus_client.h" 11 #include "ui/aura/client/focus_client.h"
13 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
14 #include "ui/aura/input_state_lookup.h" 13 #include "ui/aura/input_state_lookup.h"
15 #include "ui/aura/mus/window_port_mus.h" 14 #include "ui/aura/mus/window_port_mus.h"
16 #include "ui/aura/mus/window_tree_client.h" 15 #include "ui/aura/mus/window_tree_client.h"
17 #include "ui/aura/test/env_test_helper.h" 16 #include "ui/aura/test/env_test_helper.h"
18 #include "ui/aura/test/event_generator_delegate_aura.h" 17 #include "ui/aura/test/event_generator_delegate_aura.h"
19 #include "ui/aura/test/mus/test_window_tree.h" 18 #include "ui/aura/test/mus/test_window_tree.h"
20 #include "ui/aura/test/mus/test_window_tree_client_setup.h" 19 #include "ui/aura/test/mus/test_window_tree_client_setup.h"
21 #include "ui/aura/test/test_focus_client.h" 20 #include "ui/aura/test/test_focus_client.h"
22 #include "ui/aura/test/test_screen.h" 21 #include "ui/aura/test/test_screen.h"
23 #include "ui/aura/test/test_window_parenting_client.h" 22 #include "ui/aura/test/test_window_parenting_client.h"
24 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
25 #include "ui/aura/window_event_dispatcher.h" 24 #include "ui/aura/window_event_dispatcher.h"
26 #include "ui/base/ime/input_method_factory.h" 25 #include "ui/base/ime/input_method_factory.h"
27 #include "ui/base/ime/input_method_initializer.h" 26 #include "ui/base/ime/input_method_initializer.h"
28 #include "ui/compositor/compositor.h" 27 #include "ui/compositor/compositor.h"
29 #include "ui/compositor/layer_animator.h" 28 #include "ui/compositor/layer_animator.h"
30 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 29 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
31 #include "ui/display/screen.h" 30 #include "ui/display/screen.h"
31 #include "ui/wm/core/wm_state.h"
32 32
33 #if defined(USE_X11) 33 #if defined(USE_X11)
34 #include "ui/aura/window_tree_host_x11.h" 34 #include "ui/aura/window_tree_host_x11.h"
35 #include "ui/base/x/x11_util.h" // nogncheck 35 #include "ui/base/x/x11_util.h" // nogncheck
36 #endif 36 #endif
37 37
38 namespace aura { 38 namespace aura {
39 namespace test { 39 namespace test {
40 40
41 AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop) 41 AuraTestHelper::AuraTestHelper(base::MessageLoopForUI* message_loop)
(...skipping 21 matching lines...) Expand all
63 WindowManagerDelegate* window_manager_delegate) { 63 WindowManagerDelegate* window_manager_delegate) {
64 DCHECK(!setup_called_); 64 DCHECK(!setup_called_);
65 use_mus_ = true; 65 use_mus_ = true;
66 window_tree_delegate_ = window_tree_delegate; 66 window_tree_delegate_ = window_tree_delegate;
67 window_manager_delegate_ = window_manager_delegate; 67 window_manager_delegate_ = window_manager_delegate;
68 } 68 }
69 69
70 void AuraTestHelper::SetUp(ui::ContextFactory* context_factory) { 70 void AuraTestHelper::SetUp(ui::ContextFactory* context_factory) {
71 setup_called_ = true; 71 setup_called_ = true;
72 72
73 wm_state_ = base::MakeUnique<wm::WMState>();
73 // Needs to be before creating WindowTreeClient. 74 // Needs to be before creating WindowTreeClient.
74 focus_client_ = base::MakeUnique<TestFocusClient>(); 75 focus_client_ = base::MakeUnique<TestFocusClient>();
75 capture_client_ = base::MakeUnique<client::DefaultCaptureClient>(); 76 capture_client_ = base::MakeUnique<client::DefaultCaptureClient>();
76 Env::WindowPortFactory window_impl_factory; 77 Env::WindowPortFactory window_impl_factory;
77 if (use_mus_) 78 if (use_mus_)
78 window_impl_factory = InitMus(); 79 window_impl_factory = InitMus();
79 if (!Env::GetInstanceDontCreate()) 80 if (!Env::GetInstanceDontCreate())
80 env_ = aura::Env::CreateInstance(window_impl_factory); 81 env_ = aura::Env::CreateInstance(window_impl_factory);
81 else if (use_mus_) 82 else if (use_mus_)
82 EnvTestHelper(Env::GetInstance()).SetWindowPortFactory(window_impl_factory); 83 EnvTestHelper(Env::GetInstance()).SetWindowPortFactory(window_impl_factory);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 capture_client_.reset(); 131 capture_client_.reset();
131 132
132 ui::ShutdownInputMethodForTesting(); 133 ui::ShutdownInputMethodForTesting();
133 134
134 if (env_) { 135 if (env_) {
135 env_.reset(); 136 env_.reset();
136 } else if (use_mus_) { 137 } else if (use_mus_) {
137 EnvTestHelper(Env::GetInstance()) 138 EnvTestHelper(Env::GetInstance())
138 .SetWindowPortFactory(Env::WindowPortFactory()); 139 .SetWindowPortFactory(Env::WindowPortFactory());
139 } 140 }
141 wm_state_.reset();
140 } 142 }
141 143
142 void AuraTestHelper::RunAllPendingInMessageLoop() { 144 void AuraTestHelper::RunAllPendingInMessageLoop() {
143 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them 145 // TODO(jbates) crbug.com/134753 Find quitters of this RunLoop and have them
144 // use run_loop.QuitClosure(). 146 // use run_loop.QuitClosure().
145 base::RunLoop run_loop; 147 base::RunLoop run_loop;
146 run_loop.RunUntilIdle(); 148 run_loop.RunUntilIdle();
147 } 149 }
148 150
149 TestWindowTree* AuraTestHelper::window_tree() { 151 TestWindowTree* AuraTestHelper::window_tree() {
(...skipping 16 matching lines...) Expand all
166 base::Unretained(this)); 168 base::Unretained(this));
167 } 169 }
168 170
169 std::unique_ptr<WindowPort> AuraTestHelper::CreateWindowPortMus( 171 std::unique_ptr<WindowPort> AuraTestHelper::CreateWindowPortMus(
170 Window* window) { 172 Window* window) {
171 return base::MakeUnique<WindowPortMus>(window_tree_client()); 173 return base::MakeUnique<WindowPortMus>(window_tree_client());
172 } 174 }
173 175
174 } // namespace test 176 } // namespace test
175 } // namespace aura 177 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/test/aura_test_helper.h ('k') | ui/views/corewm/tooltip_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698