| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 Shell* shell = Shell::Get(); | 182 Shell* shell = Shell::Get(); |
| 183 session_controller_client_.reset( | 183 session_controller_client_.reset( |
| 184 new TestSessionControllerClient(shell->session_controller())); | 184 new TestSessionControllerClient(shell->session_controller())); |
| 185 session_controller_client_->InitializeAndBind(); | 185 session_controller_client_->InitializeAndBind(); |
| 186 | 186 |
| 187 if (start_session) | 187 if (start_session) |
| 188 session_controller_client_->CreatePredefinedUserSessions(1); | 188 session_controller_client_->CreatePredefinedUserSessions(1); |
| 189 | 189 |
| 190 // TODO(sky): mash should use this too http://crbug.com/718860. | 190 // TODO(sky): mash should use this too http://crbug.com/718860. |
| 191 if (config_ != Config::MASH) { | 191 if (Shell::ShouldEnableSimplifiedDisplayManagement()) { |
| 192 // Tests that change the display configuration generally don't care about | 192 // Tests that change the display configuration generally don't care about |
| 193 // the notifications and the popup UI can interfere with things like | 193 // the notifications and the popup UI can interfere with things like |
| 194 // cursors. | 194 // cursors. |
| 195 shell->screen_layout_observer()->set_show_notifications_for_testing(false); | 195 shell->screen_layout_observer()->set_show_notifications_for_testing(false); |
| 196 | 196 |
| 197 display::test::DisplayManagerTestApi(shell->display_manager()) | 197 display::test::DisplayManagerTestApi(shell->display_manager()) |
| 198 .DisableChangeDisplayUponHostResize(); | 198 .DisableChangeDisplayUponHostResize(); |
| 199 DisplayConfigurationControllerTestApi( | 199 DisplayConfigurationControllerTestApi( |
| 200 shell->display_configuration_controller()) | 200 shell->display_configuration_controller()) |
| 201 .DisableDisplayAnimator(); | 201 .DisableDisplayAnimator(); |
| (...skipping 104 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 : GetDisplayNearestWindow(roots[1]->GetRootWindow()); | 322 : GetDisplayNearestWindow(roots[1]->GetRootWindow()); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void AshTestHelper::CreateMashWindowManager() { | 325 void AshTestHelper::CreateMashWindowManager() { |
| 326 CHECK(config_ != Config::CLASSIC); | 326 CHECK(config_ != Config::CLASSIC); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 343 // additional tray items) that can make for flaky tests. | 343 // additional tray items) that can make for flaky tests. |
| 344 const bool init_network_handler = false; | 344 const bool init_network_handler = false; |
| 345 window_manager_app_->InitWindowManager( | 345 window_manager_app_->InitWindowManager( |
| 346 window_tree_client_setup_.OwnWindowTreeClient(), | 346 window_tree_client_setup_.OwnWindowTreeClient(), |
| 347 ash_test_environment_->GetBlockingPool(), init_network_handler); | 347 ash_test_environment_->GetBlockingPool(), init_network_handler); |
| 348 | 348 |
| 349 aura::WindowTreeClient* window_tree_client = | 349 aura::WindowTreeClient* window_tree_client = |
| 350 window_manager_app_->window_manager()->window_tree_client(); | 350 window_manager_app_->window_manager()->window_tree_client(); |
| 351 window_tree_client_private_ = | 351 window_tree_client_private_ = |
| 352 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); | 352 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); |
| 353 if (config_ == Config::MUS) { | 353 if (Shell::ShouldEnableSimplifiedDisplayManagement(config_)) { |
| 354 window_tree_client_private_->CallOnConnect(); | 354 window_tree_client_private_->CallOnConnect(); |
| 355 } else { | 355 } else { |
| 356 int next_x = 0; | 356 int next_x = 0; |
| 357 CreateRootWindowController("800x600", &next_x); | 357 CreateRootWindowController("800x600", &next_x); |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 void AshTestHelper::CreateShell() { | 361 void AshTestHelper::CreateShell() { |
| 362 CHECK(config_ == Config::CLASSIC); | 362 CHECK(config_ == Config::CLASSIC); |
| 363 ui::ContextFactory* context_factory = nullptr; | 363 ui::ContextFactory* context_factory = nullptr; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 std::set<RootWindowController*> roots = | 413 std::set<RootWindowController*> roots = |
| 414 window_manager_app_->window_manager()->GetRootWindowControllers(); | 414 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 415 std::vector<RootWindowController*> ordered_roots; | 415 std::vector<RootWindowController*> ordered_roots; |
| 416 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 416 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 417 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 417 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 418 return ordered_roots; | 418 return ordered_roots; |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace test | 421 } // namespace test |
| 422 } // namespace ash | 422 } // namespace ash |
| OLD | NEW |