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/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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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()); |
| 299 window_manager_app_->InitWindowManager( | 300 window_manager_app_->InitWindowManager( |
| 300 window_tree_client_setup_.OwnWindowTreeClient(), | 301 window_tree_client_setup_.OwnWindowTreeClient(), |
| 301 ash_test_environment_->GetBlockingPool()); | 302 ash_test_environment_->GetBlockingPool()); |
| 302 | 303 |
| 304 // WindowManagerApplication starts the NetworkHandler. The NetworkHandler may | |
| 305 // cause subtle side effects (such as additional tray items) and tests expect | |
| 306 // it not to be running, so shut it down. | |
| 307 chromeos::NetworkHandler::Shutdown(); | |
|
James Cook
2017/03/22 22:27:22
Rather than doing this, how about passing a "for_t
| |
| 308 | |
| 303 aura::WindowTreeClient* window_tree_client = | 309 aura::WindowTreeClient* window_tree_client = |
| 304 window_manager_app_->window_manager()->window_tree_client(); | 310 window_manager_app_->window_manager()->window_tree_client(); |
| 305 window_tree_client_private_ = | 311 window_tree_client_private_ = |
| 306 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); | 312 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); |
| 307 int next_x = 0; | 313 int next_x = 0; |
| 308 CreateRootWindowController("800x600", &next_x); | 314 CreateRootWindowController("800x600", &next_x); |
| 315 | |
| 316 // Make sure the NetworkHandler didn't get turned on, see above comment as to | |
| 317 // why the NetworkHandler should not be running. | |
| 318 CHECK(!chromeos::NetworkHandler::IsInitialized()); | |
| 309 } | 319 } |
| 310 | 320 |
| 311 void AshTestHelper::CreateShell() { | 321 void AshTestHelper::CreateShell() { |
| 312 CHECK(!IsMash()); | 322 CHECK(!IsMash()); |
| 313 ui::ContextFactory* context_factory = nullptr; | 323 ui::ContextFactory* context_factory = nullptr; |
| 314 ui::ContextFactoryPrivate* context_factory_private = nullptr; | 324 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 315 bool enable_pixel_output = false; | 325 bool enable_pixel_output = false; |
| 316 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, | 326 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 317 &context_factory_private); | 327 &context_factory_private); |
| 318 ShellInitParams init_params; | 328 ShellInitParams init_params; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 370 std::set<RootWindowController*> roots = | 380 std::set<RootWindowController*> roots = |
| 371 window_manager_app_->window_manager()->GetRootWindowControllers(); | 381 window_manager_app_->window_manager()->GetRootWindowControllers(); |
| 372 std::vector<RootWindowController*> ordered_roots; | 382 std::vector<RootWindowController*> ordered_roots; |
| 373 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); | 383 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); |
| 374 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); | 384 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); |
| 375 return ordered_roots; | 385 return ordered_roots; |
| 376 } | 386 } |
| 377 | 387 |
| 378 } // namespace test | 388 } // namespace test |
| 379 } // namespace ash | 389 } // namespace ash |
| OLD | NEW |