Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/aura/shell_port_classic.h" | 9 #include "ash/aura/shell_port_classic.h" |
| 10 #include "ash/mus/bridge/shell_port_mash.h" | 10 #include "ash/mus/bridge/shell_port_mash.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 std::unique_ptr<aura::InputStateLookup>()); | 173 std::unique_ptr<aura::InputStateLookup>()); |
| 174 | 174 |
| 175 Shell* shell = Shell::Get(); | 175 Shell* shell = Shell::Get(); |
| 176 session_controller_client_.reset( | 176 session_controller_client_.reset( |
| 177 new TestSessionControllerClient(shell->session_controller())); | 177 new TestSessionControllerClient(shell->session_controller())); |
| 178 session_controller_client_->InitializeAndBind(); | 178 session_controller_client_->InitializeAndBind(); |
| 179 | 179 |
| 180 if (start_session) | 180 if (start_session) |
| 181 session_controller_client_->CreatePredefinedUserSessions(1); | 181 session_controller_client_->CreatePredefinedUserSessions(1); |
| 182 | 182 |
| 183 // TODO(sky): mash should use this too http://crbug.com/718860. | 183 // TODO(sky): mash should use this too http://crbug.com/718860. |
|
msw
2017/05/26 16:38:50
q: leaving this for a later cleanup pass? (ok eith
sky
2017/06/05 17:19:44
Yes. After this lands and stays enabled for a day
| |
| 184 if (config_ != Config::MASH) { | 184 if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
| 185 // Tests that change the display configuration generally don't care about | 185 // Tests that change the display configuration generally don't care about |
| 186 // the notifications and the popup UI can interfere with things like | 186 // the notifications and the popup UI can interfere with things like |
| 187 // cursors. | 187 // cursors. |
| 188 shell->screen_layout_observer()->set_show_notifications_for_testing(false); | 188 shell->screen_layout_observer()->set_show_notifications_for_testing(false); |
| 189 | 189 |
| 190 display::test::DisplayManagerTestApi(shell->display_manager()) | 190 display::test::DisplayManagerTestApi(shell->display_manager()) |
| 191 .DisableChangeDisplayUponHostResize(); | 191 .DisableChangeDisplayUponHostResize(); |
| 192 DisplayConfigurationControllerTestApi( | 192 DisplayConfigurationControllerTestApi( |
| 193 shell->display_configuration_controller()) | 193 shell->display_configuration_controller()) |
| 194 .DisableDisplayAnimator(); | 194 .DisableDisplayAnimator(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 } | 306 } |
| 307 const bool in_shutdown = false; | 307 const bool in_shutdown = false; |
| 308 while (root_window_controllers.size() > parts.size()) { | 308 while (root_window_controllers.size() > parts.size()) { |
| 309 window_manager_app_->window_manager()->DestroyRootWindowController( | 309 window_manager_app_->window_manager()->DestroyRootWindowController( |
| 310 root_window_controllers.back(), in_shutdown); | 310 root_window_controllers.back(), in_shutdown); |
| 311 root_window_controllers.pop_back(); | 311 root_window_controllers.pop_back(); |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 display::Display AshTestHelper::GetSecondaryDisplay() { | 315 display::Display AshTestHelper::GetSecondaryDisplay() { |
| 316 if (config_ != Config::MASH) | 316 if (Shell::ShouldEnableSimplifiedDisplayManagement()) |
| 317 return Shell::Get()->display_manager()->GetSecondaryDisplay(); | 317 return Shell::Get()->display_manager()->GetSecondaryDisplay(); |
| 318 | 318 |
| 319 std::vector<RootWindowController*> roots = GetRootsOrderedByDisplayId(); | 319 std::vector<RootWindowController*> roots = GetRootsOrderedByDisplayId(); |
| 320 CHECK_LE(2U, roots.size()); | 320 CHECK_LE(2U, roots.size()); |
| 321 return roots.size() < 2 ? display::Display() | 321 return roots.size() < 2 ? display::Display() |
| 322 : roots[1]->GetWindow()->GetDisplayNearestWindow(); | 322 : roots[1]->GetWindow()->GetDisplayNearestWindow(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void AshTestHelper::CreateMashWindowManager() { | 325 void AshTestHelper::CreateMashWindowManager() { |
| 326 CHECK(config_ != Config::CLASSIC); | 326 CHECK(config_ != Config::CLASSIC); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 345 // additional tray items) that can make for flaky tests. | 345 // additional tray items) that can make for flaky tests. |
| 346 const bool init_network_handler = false; | 346 const bool init_network_handler = false; |
| 347 window_manager_app_->InitWindowManager( | 347 window_manager_app_->InitWindowManager( |
| 348 window_tree_client_setup_.OwnWindowTreeClient(), | 348 window_tree_client_setup_.OwnWindowTreeClient(), |
| 349 ash_test_environment_->GetBlockingPool(), init_network_handler); | 349 ash_test_environment_->GetBlockingPool(), init_network_handler); |
| 350 | 350 |
| 351 aura::WindowTreeClient* window_tree_client = | 351 aura::WindowTreeClient* window_tree_client = |
| 352 window_manager_app_->window_manager()->window_tree_client(); | 352 window_manager_app_->window_manager()->window_tree_client(); |
| 353 window_tree_client_private_ = | 353 window_tree_client_private_ = |
| 354 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); | 354 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); |
| 355 if (config_ == Config::MUS) { | 355 if (Shell::ShouldEnableSimplifiedDisplayManagement(config_)) { |
| 356 window_tree_client_private_->CallOnConnect(); | 356 window_tree_client_private_->CallOnConnect(); |
| 357 } else { | 357 } else { |
| 358 int next_x = 0; | 358 int next_x = 0; |
| 359 CreateRootWindowController("800x600", &next_x); | 359 CreateRootWindowController("800x600", &next_x); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 | 362 |
| 363 void AshTestHelper::CreateShell() { | 363 void AshTestHelper::CreateShell() { |
| 364 CHECK(config_ == Config::CLASSIC); | 364 CHECK(config_ == Config::CLASSIC); |
| 365 ui::ContextFactory* context_factory = nullptr; | 365 ui::ContextFactory* context_factory = nullptr; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 std::set<RootWindowController*> roots = | 415 std::set<RootWindowController*> roots = |
| 416 window_manager_app_->window_manager()->GetRootWindowControllers(); | 416 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 417 std::vector<RootWindowController*> ordered_roots; | 417 std::vector<RootWindowController*> ordered_roots; |
| 418 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 418 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 419 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 419 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 420 return ordered_roots; | 420 return ordered_roots; |
| 421 } | 421 } |
| 422 | 422 |
| 423 } // namespace test | 423 } // namespace test |
| 424 } // namespace ash | 424 } // namespace ash |
| OLD | NEW |