| 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/aura/wm_shell_aura.h" | 8 #include "ash/aura/wm_shell_aura.h" |
| 9 #include "ash/common/test/test_session_state_delegate.h" | 9 #include "ash/common/test/test_session_state_delegate.h" |
| 10 #include "ash/common/test/test_system_tray_delegate.h" | 10 #include "ash/common/test/test_system_tray_delegate.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 13 #include "ash/mus/screen_mus.h" | 13 #include "ash/mus/screen_mus.h" |
| 14 #include "ash/mus/window_manager.h" | 14 #include "ash/mus/window_manager.h" |
| 15 #include "ash/mus/window_manager_application.h" | 15 #include "ash/mus/window_manager_application.h" |
| 16 #include "ash/public/cpp/config.h" |
| 16 #include "ash/shell.h" | 17 #include "ash/shell.h" |
| 17 #include "ash/shell_init_params.h" | 18 #include "ash/shell_init_params.h" |
| 18 #include "ash/system/chromeos/screen_layout_observer.h" | 19 #include "ash/system/chromeos/screen_layout_observer.h" |
| 19 #include "ash/test/ash_test_environment.h" | 20 #include "ash/test/ash_test_environment.h" |
| 20 #include "ash/test/ash_test_views_delegate.h" | 21 #include "ash/test/ash_test_views_delegate.h" |
| 21 #include "ash/test/display_configuration_controller_test_api.h" | 22 #include "ash/test/display_configuration_controller_test_api.h" |
| 22 #include "ash/test/test_screenshot_delegate.h" | 23 #include "ash/test/test_screenshot_delegate.h" |
| 23 #include "ash/test/test_shell_delegate.h" | 24 #include "ash/test/test_shell_delegate.h" |
| 24 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
| 25 #include "base/run_loop.h" | 26 #include "base/run_loop.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 std::vector<RootWindowController*> roots = GetRootsOrderedByDisplayId(); | 281 std::vector<RootWindowController*> roots = GetRootsOrderedByDisplayId(); |
| 281 CHECK_LE(2U, roots.size()); | 282 CHECK_LE(2U, roots.size()); |
| 282 return roots.size() < 2 ? display::Display() | 283 return roots.size() < 2 ? display::Display() |
| 283 : roots[1]->GetWindow()->GetDisplayNearestWindow(); | 284 : roots[1]->GetWindow()->GetDisplayNearestWindow(); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void AshTestHelper::CreateMashWindowManager() { | 287 void AshTestHelper::CreateMashWindowManager() { |
| 287 CHECK(IsMash()); | 288 CHECK(IsMash()); |
| 288 window_manager_app_ = base::MakeUnique<mus::WindowManagerApplication>(); | 289 window_manager_app_ = base::MakeUnique<mus::WindowManagerApplication>(); |
| 289 | 290 |
| 290 window_manager_app_->window_manager_.reset(new mus::WindowManager(nullptr)); | 291 window_manager_app_->window_manager_.reset( |
| 291 window_manager_app_->window_manager()->shell_delegate_for_test_.reset( | 292 new mus::WindowManager(nullptr, Config::MASH)); |
| 293 window_manager_app_->window_manager()->shell_delegate_.reset( |
| 292 test_shell_delegate_); | 294 test_shell_delegate_); |
| 293 window_manager_app_->window_manager() | 295 window_manager_app_->window_manager() |
| 294 ->create_session_state_delegate_stub_for_test_ = false; | 296 ->create_session_state_delegate_stub_for_test_ = false; |
| 295 | 297 |
| 296 window_tree_client_setup_.InitForWindowManager( | 298 window_tree_client_setup_.InitForWindowManager( |
| 297 window_manager_app_->window_manager_.get(), | 299 window_manager_app_->window_manager_.get(), |
| 298 window_manager_app_->window_manager_.get()); | 300 window_manager_app_->window_manager_.get()); |
| 299 aura::test::EnvTestHelper().SetWindowTreeClient( | 301 aura::test::EnvTestHelper().SetWindowTreeClient( |
| 300 window_tree_client_setup_.window_tree_client()); | 302 window_tree_client_setup_.window_tree_client()); |
| 301 // Classic ash does not start the NetworkHandler in tests, so don't start it | 303 // Classic ash does not start the NetworkHandler in tests, so don't start it |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 std::set<RootWindowController*> roots = | 382 std::set<RootWindowController*> roots = |
| 381 window_manager_app_->window_manager()->GetRootWindowControllers(); | 383 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 382 std::vector<RootWindowController*> ordered_roots; | 384 std::vector<RootWindowController*> ordered_roots; |
| 383 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 385 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 384 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 386 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 385 return ordered_roots; | 387 return ordered_roots; |
| 386 } | 388 } |
| 387 | 389 |
| 388 } // namespace test | 390 } // namespace test |
| 389 } // namespace ash | 391 } // namespace ash |
| OLD | NEW |