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

Side by Side Diff: ash/test/ash_test_helper.cc

Issue 2694623016: chromeos: Makes AshTestBase/Helper target mash when appropriate (Closed)
Patch Set: comment Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/test/ash_test_helper.h" 5 #include "ash/test/ash_test_helper.h"
6 6
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/common/test/test_session_state_delegate.h" 8 #include "ash/common/test/test_session_state_delegate.h"
9 #include "ash/common/test/test_system_tray_delegate.h" 9 #include "ash/common/test/test_system_tray_delegate.h"
10 #include "ash/common/test/wm_shell_test_api.h" 10 #include "ash/common/test/wm_shell_test_api.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/common/wm_window.h"
13 #include "ash/mus/screen_mus.h"
14 #include "ash/mus/window_manager.h"
15 #include "ash/mus/window_manager_application.h"
12 #include "ash/shell.h" 16 #include "ash/shell.h"
13 #include "ash/shell_init_params.h" 17 #include "ash/shell_init_params.h"
14 #include "ash/system/chromeos/screen_layout_observer.h" 18 #include "ash/system/chromeos/screen_layout_observer.h"
15 #include "ash/test/ash_test_environment.h" 19 #include "ash/test/ash_test_environment.h"
16 #include "ash/test/ash_test_views_delegate.h" 20 #include "ash/test/ash_test_views_delegate.h"
17 #include "ash/test/shell_test_api.h" 21 #include "ash/test/shell_test_api.h"
18 #include "ash/test/test_screenshot_delegate.h" 22 #include "ash/test/test_screenshot_delegate.h"
19 #include "ash/test/test_shell_delegate.h" 23 #include "ash/test/test_shell_delegate.h"
20 #include "base/memory/ptr_util.h" 24 #include "base/memory/ptr_util.h"
21 #include "base/run_loop.h" 25 #include "base/run_loop.h"
26 #include "base/strings/string_split.h"
27 #include "base/test/sequenced_worker_pool_owner.h"
22 #include "chromeos/audio/cras_audio_handler.h" 28 #include "chromeos/audio/cras_audio_handler.h"
23 #include "chromeos/dbus/dbus_thread_manager.h" 29 #include "chromeos/dbus/dbus_thread_manager.h"
24 #include "device/bluetooth/bluetooth_adapter_factory.h" 30 #include "device/bluetooth/bluetooth_adapter_factory.h"
25 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 31 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
26 #include "ui/aura/env.h" 32 #include "ui/aura/env.h"
27 #include "ui/aura/input_state_lookup.h" 33 #include "ui/aura/input_state_lookup.h"
34 #include "ui/aura/mus/window_tree_client.h"
28 #include "ui/aura/test/env_test_helper.h" 35 #include "ui/aura/test/env_test_helper.h"
29 #include "ui/aura/test/event_generator_delegate_aura.h" 36 #include "ui/aura/test/event_generator_delegate_aura.h"
37 #include "ui/aura/test/mus/window_tree_client_private.h"
30 #include "ui/base/ime/input_method_initializer.h" 38 #include "ui/base/ime/input_method_initializer.h"
31 #include "ui/base/material_design/material_design_controller.h" 39 #include "ui/base/material_design/material_design_controller.h"
32 #include "ui/base/platform_window_defaults.h" 40 #include "ui/base/platform_window_defaults.h"
33 #include "ui/base/test/material_design_controller_test_api.h" 41 #include "ui/base/test/material_design_controller_test_api.h"
34 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 42 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
35 #include "ui/compositor/test/context_factories_for_test.h" 43 #include "ui/compositor/test/context_factories_for_test.h"
44 #include "ui/display/manager/display_manager.h"
36 #include "ui/display/manager/managed_display_info.h" 45 #include "ui/display/manager/managed_display_info.h"
37 #include "ui/display/test/display_manager_test_api.h" 46 #include "ui/display/test/display_manager_test_api.h"
38 #include "ui/message_center/message_center.h" 47 #include "ui/message_center/message_center.h"
39 #include "ui/wm/core/capture_controller.h" 48 #include "ui/wm/core/capture_controller.h"
40 #include "ui/wm/core/cursor_manager.h" 49 #include "ui/wm/core/cursor_manager.h"
41 #include "ui/wm/core/wm_state.h" 50 #include "ui/wm/core/wm_state.h"
42 51
52 using display::ManagedDisplayInfo;
53
43 namespace ash { 54 namespace ash {
44 namespace test { 55 namespace test {
56 namespace {
57
58 bool IsMash() {
59 // Assume if no env (which happens when AshTestHelper is used outside of ash
msw 2017/02/19 21:49:20 nit: "If there is no Env, which happens when ...,
sky 2017/02/21 17:06:50 Done.
60 // tests) that we're using classic ash.
61 aura::Env* env = aura::Env::GetInstanceDontCreate();
62 return env && env->mode() == aura::Env::Mode::MUS;
63 }
64
65 bool CompareByDisplayId(RootWindowController* root1,
66 RootWindowController* root2) {
67 return root1->GetWindow()->GetDisplayNearestWindow().id() <
68 root2->GetWindow()->GetDisplayNearestWindow().id();
69 }
70
71 } // namespace
45 72
46 AshTestHelper::AshTestHelper(AshTestEnvironment* ash_test_environment) 73 AshTestHelper::AshTestHelper(AshTestEnvironment* ash_test_environment)
47 : ash_test_environment_(ash_test_environment), 74 : ash_test_environment_(ash_test_environment),
48 test_shell_delegate_(nullptr), 75 test_shell_delegate_(nullptr),
49 test_screenshot_delegate_(nullptr), 76 test_screenshot_delegate_(nullptr),
50 dbus_thread_manager_initialized_(false), 77 dbus_thread_manager_initialized_(false),
51 bluez_dbus_manager_initialized_(false) { 78 bluez_dbus_manager_initialized_(false) {
52 ui::test::EnableTestConfigForPlatformWindows(); 79 ui::test::EnableTestConfigForPlatformWindows();
53 aura::test::InitializeAuraEventGeneratorDelegate(); 80 aura::test::InitializeAuraEventGeneratorDelegate();
81 if (IsMash())
82 aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true);
54 } 83 }
55 84
56 AshTestHelper::~AshTestHelper() {} 85 AshTestHelper::~AshTestHelper() {}
57 86
58 void AshTestHelper::SetUp(bool start_session) { 87 void AshTestHelper::SetUp(bool start_session) {
59 display::ResetDisplayIdForTest(); 88 display::ResetDisplayIdForTest();
60 wm_state_ = base::MakeUnique<::wm::WMState>(); 89 const bool is_mash = IsMash();
90 // WindowManager creates WMState for mash.
91 if (!is_mash)
92 wm_state_ = base::MakeUnique<::wm::WMState>();
61 views_delegate_ = ash_test_environment_->CreateViewsDelegate(); 93 views_delegate_ = ash_test_environment_->CreateViewsDelegate();
62 94
63 // Disable animations during tests. 95 // Disable animations during tests.
64 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( 96 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode(
65 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); 97 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION));
66 ui::InitializeInputMethodForTesting(); 98 ui::InitializeInputMethodForTesting();
67 99
68 bool enable_pixel_output = false;
69 ui::ContextFactory* context_factory = nullptr;
70 ui::ContextFactoryPrivate* context_factory_private = nullptr;
71 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory,
72 &context_factory_private);
73
74 // Creates Shell and hook with Desktop. 100 // Creates Shell and hook with Desktop.
75 if (!test_shell_delegate_) 101 if (!test_shell_delegate_)
76 test_shell_delegate_ = new TestShellDelegate; 102 test_shell_delegate_ = new TestShellDelegate;
77 103
78 // Creates MessageCenter since g_browser_process is not created in AshTestBase 104 if (!is_mash) {
79 // tests. 105 // All of this initialization is done in WindowManagerApplication for mash.
80 message_center::MessageCenter::Initialize();
81 106
82 // Create DBusThreadManager for testing. 107 // Creates MessageCenter since g_browser_process is not created in
83 if (!chromeos::DBusThreadManager::IsInitialized()) { 108 // AshTestBase tests.
84 chromeos::DBusThreadManager::Initialize( 109 message_center::MessageCenter::Initialize();
85 chromeos::DBusThreadManager::PROCESS_ASH); 110
86 dbus_thread_manager_initialized_ = true; 111 if (!chromeos::DBusThreadManager::IsInitialized()) {
112 chromeos::DBusThreadManager::Initialize(
113 chromeos::DBusThreadManager::PROCESS_ASH);
114 dbus_thread_manager_initialized_ = true;
115 }
116
117 if (!bluez::BluezDBusManager::IsInitialized()) {
118 bluez::BluezDBusManager::Initialize(
119 chromeos::DBusThreadManager::Get()->GetSystemBus(),
120 chromeos::DBusThreadManager::Get()->IsUsingFakes());
121 bluez_dbus_manager_initialized_ = true;
122 }
123
124 // Create CrasAudioHandler for testing since g_browser_process is not
125 // created in AshTestBase tests.
126 chromeos::CrasAudioHandler::InitializeForTesting();
87 } 127 }
88 128
89 if (!bluez::BluezDBusManager::IsInitialized()) {
90 bluez::BluezDBusManager::Initialize(
91 chromeos::DBusThreadManager::Get()->GetSystemBus(),
92 chromeos::DBusThreadManager::Get()->IsUsingFakes());
93 bluez_dbus_manager_initialized_ = true;
94 }
95
96 // Create CrasAudioHandler for testing since g_browser_process is not
97 // created in AshTestBase tests.
98 chromeos::CrasAudioHandler::InitializeForTesting();
99
100 ash_test_environment_->SetUp(); 129 ash_test_environment_->SetUp();
101 // Reset the global state for the cursor manager. This includes the 130 // Reset the global state for the cursor manager. This includes the
102 // last cursor visibility state, etc. 131 // last cursor visibility state, etc.
103 ::wm::CursorManager::ResetCursorVisibilityStateForTest(); 132 ::wm::CursorManager::ResetCursorVisibilityStateForTest();
104 133
105 // ContentTestSuiteBase might have already initialized 134 // ContentTestSuiteBase might have already initialized
106 // MaterialDesignController in unit_tests suite. 135 // MaterialDesignController in unit_tests suite.
107 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); 136 ui::test::MaterialDesignControllerTestAPI::Uninitialize();
108 ui::MaterialDesignController::Initialize(); 137 ui::MaterialDesignController::Initialize();
109 138
110 ShellInitParams init_params; 139 if (is_mash)
111 init_params.delegate = test_shell_delegate_; 140 CreateMashWindowManager();
112 init_params.context_factory = context_factory; 141 else
113 init_params.context_factory_private = context_factory_private; 142 CreateShell();
114 init_params.blocking_pool = ash_test_environment_->GetBlockingPool(); 143
115 Shell::CreateInstance(init_params); 144 aura::test::EnvTestHelper().SetInputStateLookup(
msw 2017/02/19 21:49:20 Is it okay that this might construct an Env instan
sky 2017/02/21 17:06:51 Env::GetInstance() DCHECKs that there is an instan
116 aura::test::EnvTestHelper(aura::Env::GetInstance()) 145 std::unique_ptr<aura::InputStateLookup>());
117 .SetInputStateLookup(std::unique_ptr<aura::InputStateLookup>());
118 146
119 Shell* shell = Shell::GetInstance(); 147 Shell* shell = Shell::GetInstance();
120 if (start_session) { 148 if (start_session) {
121 GetTestSessionStateDelegate()->SetActiveUserSessionStarted(true); 149 GetTestSessionStateDelegate()->SetActiveUserSessionStarted(true);
122 GetTestSessionStateDelegate()->SetHasActiveUser(true); 150 GetTestSessionStateDelegate()->SetHasActiveUser(true);
123 } 151 }
124 152
125 // Tests that change the display configuration generally don't care about the 153 if (!is_mash) {
126 // notifications and the popup UI can interfere with things like cursors. 154 // ScreenLayoutObserver is specific to cash.
msw 2017/02/19 21:49:20 nit: cash -> classic Ash, ditto below
sky 2017/02/21 17:06:50 we're going to start using cash in file names soon
127 shell->screen_layout_observer()->set_show_notifications_for_testing(false); 155 // Tests that change the display configuration generally don't care about
156 // the notifications and the popup UI can interfere with things like
157 // cursors.
158 shell->screen_layout_observer()->set_show_notifications_for_testing(false);
128 159
129 display::test::DisplayManagerTestApi(Shell::GetInstance()->display_manager()) 160 // DisplayManager is specific to cash.
130 .DisableChangeDisplayUponHostResize(); 161 display::test::DisplayManagerTestApi(
131 ShellTestApi(shell).DisableDisplayAnimator(); 162 Shell::GetInstance()->display_manager())
163 .DisableChangeDisplayUponHostResize();
164 ShellTestApi(shell).DisableDisplayAnimator();
132 165
133 test_screenshot_delegate_ = new TestScreenshotDelegate(); 166 // TODO: disabled for mash as AcceleratorControllerDelegateAura isn't
134 shell->accelerator_controller_delegate()->SetScreenshotDelegate( 167 // created in mash http://crbug.com/632111.
135 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); 168 test_screenshot_delegate_ = new TestScreenshotDelegate();
169 shell->accelerator_controller_delegate()->SetScreenshotDelegate(
170 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_));
171 }
136 } 172 }
137 173
138 void AshTestHelper::TearDown() { 174 void AshTestHelper::TearDown() {
139 // Tear down the shell. 175 window_manager_app_.reset();
140 Shell::DeleteInstance(); 176
177 const bool is_mash = IsMash();
178
179 // WindowManger owns the Shell in mash.
180 if (!is_mash)
181 Shell::DeleteInstance();
141 182
142 // Suspend the tear down until all resources are returned via 183 // Suspend the tear down until all resources are returned via
143 // MojoCompositorFrameSinkClient::ReclaimResources() 184 // MojoCompositorFrameSinkClient::ReclaimResources()
144 RunAllPendingInMessageLoop(); 185 RunAllPendingInMessageLoop();
145 ash_test_environment_->TearDown(); 186 ash_test_environment_->TearDown();
146 187
147 test_screenshot_delegate_ = NULL; 188 test_screenshot_delegate_ = NULL;
148 189
149 // Remove global message center state. 190 if (!is_mash) {
150 message_center::MessageCenter::Shutdown(); 191 // Remove global message center state.
192 message_center::MessageCenter::Shutdown();
151 193
152 chromeos::CrasAudioHandler::Shutdown(); 194 chromeos::CrasAudioHandler::Shutdown();
195 }
196
153 if (bluez_dbus_manager_initialized_) { 197 if (bluez_dbus_manager_initialized_) {
154 device::BluetoothAdapterFactory::Shutdown(); 198 device::BluetoothAdapterFactory::Shutdown();
155 bluez::BluezDBusManager::Shutdown(); 199 bluez::BluezDBusManager::Shutdown();
156 bluez_dbus_manager_initialized_ = false; 200 bluez_dbus_manager_initialized_ = false;
157 } 201 }
202
158 if (dbus_thread_manager_initialized_) { 203 if (dbus_thread_manager_initialized_) {
159 chromeos::DBusThreadManager::Shutdown(); 204 chromeos::DBusThreadManager::Shutdown();
160 dbus_thread_manager_initialized_ = false; 205 dbus_thread_manager_initialized_ = false;
161 } 206 }
162 207
163 ui::TerminateContextFactoryForTests(); 208 ui::TerminateContextFactoryForTests();
164 209
165 ui::ShutdownInputMethodForTesting(); 210 ui::ShutdownInputMethodForTesting();
166 zero_duration_mode_.reset(); 211 zero_duration_mode_.reset();
167 212
168 views_delegate_.reset(); 213 views_delegate_.reset();
169 wm_state_.reset(); 214 wm_state_.reset();
170 215
171 CHECK(!::wm::CaptureController::Get()); 216 // WindowManager owns the CaptureController for mash.
217 CHECK(is_mash || !::wm::CaptureController::Get());
172 } 218 }
173 219
174 void AshTestHelper::RunAllPendingInMessageLoop() { 220 void AshTestHelper::RunAllPendingInMessageLoop() {
175 base::RunLoop run_loop; 221 base::RunLoop run_loop;
176 run_loop.RunUntilIdle(); 222 run_loop.RunUntilIdle();
177 } 223 }
178 224
179 // static 225 // static
180 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() { 226 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() {
181 CHECK(WmShell::HasInstance()); 227 CHECK(WmShell::HasInstance());
182 return static_cast<TestSessionStateDelegate*>( 228 return static_cast<TestSessionStateDelegate*>(
183 WmShell::Get()->GetSessionStateDelegate()); 229 WmShell::Get()->GetSessionStateDelegate());
184 } 230 }
185 231
186 aura::Window* AshTestHelper::CurrentContext() { 232 aura::Window* AshTestHelper::CurrentContext() {
187 aura::Window* root_window = Shell::GetTargetRootWindow(); 233 aura::Window* root_window = Shell::GetTargetRootWindow();
188 if (!root_window) 234 if (!root_window)
189 root_window = Shell::GetPrimaryRootWindow(); 235 root_window = Shell::GetPrimaryRootWindow();
190 DCHECK(root_window); 236 DCHECK(root_window);
191 return root_window; 237 return root_window;
192 } 238 }
193 239
240 void AshTestHelper::UpdateDisplayForMash(const std::string& display_spec) {
241 CHECK(IsMash());
242 const std::vector<std::string> parts = base::SplitString(
243 display_spec, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
244 std::vector<RootWindowController*> root_window_controllers =
245 GetRootsOrderedByDisplayId();
246 int next_x = 0;
247 for (size_t i = 0,
248 end = std::min(parts.size(), root_window_controllers.size());
249 i < end; ++i) {
250 UpdateDisplay(root_window_controllers[i], parts[i], &next_x);
251 }
252 for (size_t i = root_window_controllers.size(); i < parts.size(); ++i) {
253 root_window_controllers.push_back(
254 CreateRootWindowController(parts[i], &next_x));
255 }
256 const bool in_shutdown = false;
257 while (root_window_controllers.size() > parts.size()) {
258 window_manager_app_->window_manager()->DestroyRootWindowController(
259 root_window_controllers.back(), in_shutdown);
260 root_window_controllers.pop_back();
261 }
262 }
263
264 display::Display AshTestHelper::GetSecondaryDisplay() {
265 if (!IsMash())
266 return Shell::GetInstance()->display_manager()->GetSecondaryDisplay();
267
268 std::vector<RootWindowController*> roots = GetRootsOrderedByDisplayId();
269 CHECK_LE(2U, roots.size());
270 return roots.size() < 2 ? display::Display()
271 : roots[1]->GetWindow()->GetDisplayNearestWindow();
272 }
273
274 void AshTestHelper::CreateMashWindowManager() {
msw 2017/02/19 21:49:20 nit: CHECK(IsMash()); at top
sky 2017/02/21 17:06:51 Done.
275 window_manager_app_ = base::MakeUnique<mus::WindowManagerApplication>();
276
277 window_manager_app_->window_manager_.reset(new mus::WindowManager(nullptr));
278 window_manager_app_->window_manager()->shell_delegate_for_test_.reset(
279 test_shell_delegate_);
280 window_manager_app_->window_manager()
281 ->create_session_state_delegate_stub_for_test_ = false;
282
283 window_tree_client_setup_.InitForWindowManager(
284 window_manager_app_->window_manager_.get(),
285 window_manager_app_->window_manager_.get());
286 aura::test::EnvTestHelper().SetWindowTreeClient(
287 window_tree_client_setup_.window_tree_client());
288 window_manager_app_->InitWindowManager(
289 window_tree_client_setup_.OwnWindowTreeClient(),
290 ash_test_environment_->GetBlockingPool());
291
292 aura::WindowTreeClient* window_tree_client =
293 window_manager_app_->window_manager()->window_tree_client();
294 window_tree_client_private_ =
295 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client);
296 int next_x = 0;
297 CreateRootWindowController("800x600", &next_x);
298 }
299
300 void AshTestHelper::CreateShell() {
msw 2017/02/19 21:49:20 nit: CHECK(!IsMash()); at top
sky 2017/02/21 17:06:51 Done.
301 ui::ContextFactory* context_factory = nullptr;
302 ui::ContextFactoryPrivate* context_factory_private = nullptr;
303 bool enable_pixel_output = false;
304 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory,
305 &context_factory_private);
306 ShellInitParams init_params;
307 init_params.delegate = test_shell_delegate_;
308 init_params.context_factory = context_factory;
309 init_params.context_factory_private = context_factory_private;
310 init_params.blocking_pool = ash_test_environment_->GetBlockingPool();
311 Shell::CreateInstance(init_params);
312 }
313
314 RootWindowController* AshTestHelper::CreateRootWindowController(
315 const std::string& display_spec,
316 int* next_x) {
317 ManagedDisplayInfo display_info =
318 ManagedDisplayInfo::CreateFromSpec(display_spec);
319 gfx::Rect bounds = display_info.bounds_in_native();
320 bounds.set_x(*next_x);
321 *next_x += bounds.size().width();
322 display::Display display(next_display_id_++, bounds);
323 display.set_device_scale_factor(display_info.device_scale_factor());
324 gfx::Rect work_area(bounds.size());
325 // Offset the height slightly to give a different work area. -20 is arbitrary,
326 // it could be anything.
327 work_area.set_height(std::max(0, work_area.height() - 20));
328 display.set_work_area(work_area);
329 window_tree_client_private_->CallWmNewDisplayAdded(display);
330 return GetRootsOrderedByDisplayId().back();
331 }
332
333 void AshTestHelper::UpdateDisplay(RootWindowController* root_window_controller,
334 const std::string& display_spec,
335 int* next_x) {
336 ManagedDisplayInfo display_info =
337 ManagedDisplayInfo::CreateFromSpec(display_spec);
338 gfx::Rect bounds = display_info.bounds_in_native();
339 bounds.set_x(*next_x);
340 *next_x += bounds.size().width();
341 display::Display updated_display =
342 root_window_controller->GetWindow()->GetDisplayNearestWindow();
343 gfx::Insets work_area_insets = updated_display.GetWorkAreaInsets();
344 updated_display.set_bounds(bounds);
345 updated_display.UpdateWorkAreaFromInsets(work_area_insets);
346 updated_display.set_device_scale_factor(display_info.device_scale_factor());
347 root_window_controller->GetWindow()->SetBounds(gfx::Rect(bounds.size()));
348 ScreenMus* screen = window_manager_app_->window_manager()->screen_.get();
349 const bool is_primary =
350 screen->display_list().FindDisplayById(updated_display.id()) ==
351 screen->display_list().GetPrimaryDisplayIterator();
352 screen->display_list().UpdateDisplay(
353 updated_display, is_primary ? display::DisplayList::Type::PRIMARY
354 : display::DisplayList::Type::NOT_PRIMARY);
355 }
356
357 std::vector<RootWindowController*> AshTestHelper::GetRootsOrderedByDisplayId() {
358 std::set<RootWindowController*> roots =
359 window_manager_app_->window_manager()->GetRootWindowControllers();
360 std::vector<RootWindowController*> ordered_roots;
361 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end());
362 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId);
363 return ordered_roots;
364 }
365
194 } // namespace test 366 } // namespace test
195 } // namespace ash 367 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698