| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_base.h" | 5 #include "ash/test/ash_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/display/extended_mouse_warp_controller.h" | 10 #include "ash/display/extended_mouse_warp_controller.h" |
| 11 #include "ash/display/mouse_cursor_event_filter.h" | 11 #include "ash/display/mouse_cursor_event_filter.h" |
| 12 #include "ash/display/unified_mouse_warp_controller.h" | 12 #include "ash/display/unified_mouse_warp_controller.h" |
| 13 #include "ash/display/window_tree_host_manager.h" | 13 #include "ash/display/window_tree_host_manager.h" |
| 14 #include "ash/ime/input_method_event_handler.h" | 14 #include "ash/ime/input_method_event_handler.h" |
| 15 #include "ash/public/cpp/config.h" | 15 #include "ash/public/cpp/config.h" |
| 16 #include "ash/public/cpp/window_properties.h" | 16 #include "ash/public/cpp/window_properties.h" |
| 17 #include "ash/root_window_controller.h" | 17 #include "ash/root_window_controller.h" |
| 18 #include "ash/session/session_controller.h" | 18 #include "ash/session/session_controller.h" |
| 19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/shell/toplevel_window.h" | 20 #include "ash/shell/toplevel_window.h" |
| 21 #include "ash/shell_port.h" | 21 #include "ash/shell_port.h" |
| 22 #include "ash/test/ash_test_environment.h" | 22 #include "ash/test/ash_test_environment.h" |
| 23 #include "ash/test/ash_test_helper.h" | 23 #include "ash/test/ash_test_helper.h" |
| 24 #include "ash/test/test_session_controller_client.h" | 24 #include "ash/test/test_session_controller_client.h" |
| 25 #include "ash/test/test_shell_delegate.h" | 25 #include "ash/test/test_shell_delegate.h" |
| 26 #include "ash/test/test_system_tray_delegate.h" | 26 #include "ash/test/test_system_tray_delegate.h" |
| 27 #include "ash/wm/window_positioner.h" | 27 #include "ash/wm/window_positioner.h" |
| 28 #include "ash/wm_window.h" | 28 #include "ash/wm_window.h" |
| 29 #include "base/command_line.h" | |
| 30 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 29 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 31 #include "ui/aura/client/aura_constants.h" | 30 #include "ui/aura/client/aura_constants.h" |
| 32 #include "ui/aura/client/screen_position_client.h" | 31 #include "ui/aura/client/screen_position_client.h" |
| 33 #include "ui/aura/client/window_parenting_client.h" | 32 #include "ui/aura/client/window_parenting_client.h" |
| 34 #include "ui/aura/env.h" | 33 #include "ui/aura/env.h" |
| 35 #include "ui/aura/test/event_generator_delegate_aura.h" | 34 #include "ui/aura/test/event_generator_delegate_aura.h" |
| 36 #include "ui/aura/test/test_window_delegate.h" | 35 #include "ui/aura/test/test_window_delegate.h" |
| 37 #include "ui/aura/window.h" | 36 #include "ui/aura/window.h" |
| 38 #include "ui/aura/window_delegate.h" | 37 #include "ui/aura/window_delegate.h" |
| 39 #include "ui/aura/window_tree_host.h" | 38 #include "ui/aura/window_tree_host.h" |
| 40 #include "ui/base/ime/input_method_initializer.h" | 39 #include "ui/base/ime/input_method_initializer.h" |
| 41 #include "ui/display/display.h" | 40 #include "ui/display/display.h" |
| 42 #include "ui/display/display_switches.h" | |
| 43 #include "ui/display/screen.h" | 41 #include "ui/display/screen.h" |
| 44 #include "ui/display/test/display_manager_test_api.h" | 42 #include "ui/display/test/display_manager_test_api.h" |
| 45 #include "ui/display/types/display_constants.h" | 43 #include "ui/display/types/display_constants.h" |
| 46 #include "ui/events/gesture_detection/gesture_configuration.h" | 44 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 47 #include "ui/gfx/geometry/point.h" | 45 #include "ui/gfx/geometry/point.h" |
| 48 #include "ui/wm/core/coordinate_conversion.h" | 46 #include "ui/wm/core/coordinate_conversion.h" |
| 49 | 47 |
| 50 #if defined(USE_X11) | 48 #if defined(USE_X11) |
| 51 #include "ui/gfx/x/x11_connection.h" // nogncheck | 49 #include "ui/gfx/x/x11_connection.h" // nogncheck |
| 52 #endif | 50 #endif |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 << "You have overridden TearDown but never called AshTestBase::TearDown"; | 112 << "You have overridden TearDown but never called AshTestBase::TearDown"; |
| 115 } | 113 } |
| 116 | 114 |
| 117 void AshTestBase::SetUp() { | 115 void AshTestBase::SetUp() { |
| 118 setup_called_ = true; | 116 setup_called_ = true; |
| 119 | 117 |
| 120 // Clears the saved state so that test doesn't use on the wrong | 118 // Clears the saved state so that test doesn't use on the wrong |
| 121 // default state. | 119 // default state. |
| 122 shell::ToplevelWindow::ClearSavedStateForTest(); | 120 shell::ToplevelWindow::ClearSavedStateForTest(); |
| 123 | 121 |
| 124 // TODO(jamescook): Can we do this without changing command line? | |
| 125 // Use the origin (1,1) so that it doesn't over | |
| 126 // lap with the native mouse cursor. | |
| 127 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 128 if (!command_line->HasSwitch(::switches::kHostWindowBounds)) { | |
| 129 command_line->AppendSwitchASCII(::switches::kHostWindowBounds, | |
| 130 "1+1-800x600"); | |
| 131 } | |
| 132 | |
| 133 ash_test_helper_->SetUp(start_session_); | 122 ash_test_helper_->SetUp(start_session_); |
| 134 | 123 |
| 135 Shell::GetPrimaryRootWindow()->Show(); | 124 Shell::GetPrimaryRootWindow()->Show(); |
| 136 Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 125 Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 137 // Move the mouse cursor to far away so that native events doesn't | 126 // Move the mouse cursor to far away so that native events doesn't |
| 138 // interfere test expectations. | 127 // interfere test expectations. |
| 139 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 128 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
| 140 // TODO: mus/mash needs to support CursorManager. http://crbug.com/637853. | 129 // TODO: mus/mash needs to support CursorManager. http://crbug.com/637853. |
| 141 if (Shell::GetAshConfig() == Config::CLASSIC) | 130 if (Shell::GetAshConfig() == Config::CLASSIC) |
| 142 Shell::Get()->cursor_manager()->EnableMouseEvents(); | 131 Shell::Get()->cursor_manager()->EnableMouseEvents(); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( | 412 Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( |
| 424 display_manager()->GetSecondaryDisplay().id()); | 413 display_manager()->GetSecondaryDisplay().id()); |
| 425 } | 414 } |
| 426 | 415 |
| 427 display::Display AshTestBase::GetSecondaryDisplay() { | 416 display::Display AshTestBase::GetSecondaryDisplay() { |
| 428 return ash_test_helper_->GetSecondaryDisplay(); | 417 return ash_test_helper_->GetSecondaryDisplay(); |
| 429 } | 418 } |
| 430 | 419 |
| 431 } // namespace test | 420 } // namespace test |
| 432 } // namespace ash | 421 } // namespace ash |
| OLD | NEW |