| 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/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/shell_init_params.h" | 17 #include "ash/shell_init_params.h" |
| 18 #include "ash/system/chromeos/screen_layout_observer.h" | 18 #include "ash/system/chromeos/screen_layout_observer.h" |
| 19 #include "ash/test/ash_test_environment.h" | 19 #include "ash/test/ash_test_environment.h" |
| 20 #include "ash/test/ash_test_views_delegate.h" | 20 #include "ash/test/ash_test_views_delegate.h" |
| 21 #include "ash/test/display_configuration_controller_test_api.h" | 21 #include "ash/test/display_configuration_controller_test_api.h" |
| 22 #include "ash/test/test_screenshot_delegate.h" | 22 #include "ash/test/test_screenshot_delegate.h" |
| 23 #include "ash/test/test_shell_delegate.h" | 23 #include "ash/test/test_shell_delegate.h" |
| 24 #include "base/memory/ptr_util.h" | 24 #include "base/memory/ptr_util.h" |
| 25 #include "base/run_loop.h" | 25 #include "base/run_loop.h" |
| 26 #include "base/strings/string_split.h" | 26 #include "base/strings/string_split.h" |
| 27 #include "base/test/sequenced_worker_pool_owner.h" | 27 #include "base/test/sequenced_worker_pool_owner.h" |
| 28 #include "chromeos/audio/cras_audio_handler.h" | 28 #include "chromeos/audio/cras_audio_handler.h" |
| 29 #include "chromeos/dbus/dbus_thread_manager.h" | 29 #include "chromeos/dbus/dbus_thread_manager.h" |
| 30 #include "chromeos/network/network_handler.h" |
| 30 #include "device/bluetooth/bluetooth_adapter_factory.h" | 31 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 31 #include "device/bluetooth/dbus/bluez_dbus_manager.h" | 32 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 32 #include "ui/aura/env.h" | 33 #include "ui/aura/env.h" |
| 33 #include "ui/aura/input_state_lookup.h" | 34 #include "ui/aura/input_state_lookup.h" |
| 34 #include "ui/aura/mus/window_tree_client.h" | 35 #include "ui/aura/mus/window_tree_client.h" |
| 35 #include "ui/aura/test/env_test_helper.h" | 36 #include "ui/aura/test/env_test_helper.h" |
| 36 #include "ui/aura/test/event_generator_delegate_aura.h" | 37 #include "ui/aura/test/event_generator_delegate_aura.h" |
| 37 #include "ui/aura/test/mus/window_tree_client_private.h" | 38 #include "ui/aura/test/mus/window_tree_client_private.h" |
| 38 #include "ui/base/ime/input_method_initializer.h" | 39 #include "ui/base/ime/input_method_initializer.h" |
| 39 #include "ui/base/material_design/material_design_controller.h" | 40 #include "ui/base/material_design/material_design_controller.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 window_manager_app_->window_manager()->shell_delegate_for_test_.reset( | 290 window_manager_app_->window_manager()->shell_delegate_for_test_.reset( |
| 290 test_shell_delegate_); | 291 test_shell_delegate_); |
| 291 window_manager_app_->window_manager() | 292 window_manager_app_->window_manager() |
| 292 ->create_session_state_delegate_stub_for_test_ = false; | 293 ->create_session_state_delegate_stub_for_test_ = false; |
| 293 | 294 |
| 294 window_tree_client_setup_.InitForWindowManager( | 295 window_tree_client_setup_.InitForWindowManager( |
| 295 window_manager_app_->window_manager_.get(), | 296 window_manager_app_->window_manager_.get(), |
| 296 window_manager_app_->window_manager_.get()); | 297 window_manager_app_->window_manager_.get()); |
| 297 aura::test::EnvTestHelper().SetWindowTreeClient( | 298 aura::test::EnvTestHelper().SetWindowTreeClient( |
| 298 window_tree_client_setup_.window_tree_client()); | 299 window_tree_client_setup_.window_tree_client()); |
| 300 // Classic ash does not start the NetworkHandler in tests, so don't start it |
| 301 // for mash either. The NetworkHandler may cause subtle side effects (such as |
| 302 // additional tray items) that can make for flaky tests. |
| 303 const bool init_network_handler = false; |
| 299 window_manager_app_->InitWindowManager( | 304 window_manager_app_->InitWindowManager( |
| 300 window_tree_client_setup_.OwnWindowTreeClient(), | 305 window_tree_client_setup_.OwnWindowTreeClient(), |
| 301 ash_test_environment_->GetBlockingPool()); | 306 ash_test_environment_->GetBlockingPool(), init_network_handler); |
| 302 | 307 |
| 303 aura::WindowTreeClient* window_tree_client = | 308 aura::WindowTreeClient* window_tree_client = |
| 304 window_manager_app_->window_manager()->window_tree_client(); | 309 window_manager_app_->window_manager()->window_tree_client(); |
| 305 window_tree_client_private_ = | 310 window_tree_client_private_ = |
| 306 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); | 311 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); |
| 307 int next_x = 0; | 312 int next_x = 0; |
| 308 CreateRootWindowController("800x600", &next_x); | 313 CreateRootWindowController("800x600", &next_x); |
| 314 |
| 315 // Make sure the NetworkHandler didn't get turned on, see above comment as to |
| 316 // why the NetworkHandler should not be running. |
| 317 CHECK(!chromeos::NetworkHandler::IsInitialized()); |
| 309 } | 318 } |
| 310 | 319 |
| 311 void AshTestHelper::CreateShell() { | 320 void AshTestHelper::CreateShell() { |
| 312 CHECK(!IsMash()); | 321 CHECK(!IsMash()); |
| 313 ui::ContextFactory* context_factory = nullptr; | 322 ui::ContextFactory* context_factory = nullptr; |
| 314 ui::ContextFactoryPrivate* context_factory_private = nullptr; | 323 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 315 bool enable_pixel_output = false; | 324 bool enable_pixel_output = false; |
| 316 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, | 325 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 317 &context_factory_private); | 326 &context_factory_private); |
| 318 ShellInitParams init_params; | 327 ShellInitParams init_params; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 std::set<RootWindowController*> roots = | 379 std::set<RootWindowController*> roots = |
| 371 window_manager_app_->window_manager()->GetRootWindowControllers(); | 380 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 372 std::vector<RootWindowController*> ordered_roots; | 381 std::vector<RootWindowController*> ordered_roots; |
| 373 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 382 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 374 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 383 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 375 return ordered_roots; | 384 return ordered_roots; |
| 376 } | 385 } |
| 377 | 386 |
| 378 } // namespace test | 387 } // namespace test |
| 379 } // namespace ash | 388 } // namespace ash |
| OLD | NEW |