| 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/common/session/session_controller.h" | 10 #include "ash/common/session/session_controller.h" |
| 11 #include "ash/common/test/test_session_controller_client.h" | 11 #include "ash/common/test/test_session_controller_client.h" |
| 12 #include "ash/common/test/test_system_tray_delegate.h" | 12 #include "ash/common/test/test_system_tray_delegate.h" |
| 13 #include "ash/common/wm/window_positioner.h" | 13 #include "ash/common/wm/window_positioner.h" |
| 14 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 15 #include "ash/common/wm_window.h" | 15 #include "ash/common/wm_window.h" |
| 16 #include "ash/display/extended_mouse_warp_controller.h" | 16 #include "ash/display/extended_mouse_warp_controller.h" |
| 17 #include "ash/display/mouse_cursor_event_filter.h" | 17 #include "ash/display/mouse_cursor_event_filter.h" |
| 18 #include "ash/display/unified_mouse_warp_controller.h" | 18 #include "ash/display/unified_mouse_warp_controller.h" |
| 19 #include "ash/display/window_tree_host_manager.h" | 19 #include "ash/display/window_tree_host_manager.h" |
| 20 #include "ash/ime/input_method_event_handler.h" | 20 #include "ash/ime/input_method_event_handler.h" |
| 21 #include "ash/public/cpp/config.h" |
| 21 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 22 #include "ash/shell.h" | 23 #include "ash/shell.h" |
| 23 #include "ash/shell/toplevel_window.h" | 24 #include "ash/shell/toplevel_window.h" |
| 24 #include "ash/test/ash_test_environment.h" | 25 #include "ash/test/ash_test_environment.h" |
| 25 #include "ash/test/ash_test_helper.h" | 26 #include "ash/test/ash_test_helper.h" |
| 26 #include "ash/test/test_shell_delegate.h" | 27 #include "ash/test/test_shell_delegate.h" |
| 27 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 28 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 29 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 29 #include "ui/aura/client/aura_constants.h" | 30 #include "ui/aura/client/aura_constants.h" |
| 30 #include "ui/aura/client/screen_position_client.h" | 31 #include "ui/aura/client/screen_position_client.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 "1+1-800x600"); | 129 "1+1-800x600"); |
| 129 } | 130 } |
| 130 | 131 |
| 131 ash_test_helper_->SetUp(start_session_); | 132 ash_test_helper_->SetUp(start_session_); |
| 132 | 133 |
| 133 Shell::GetPrimaryRootWindow()->Show(); | 134 Shell::GetPrimaryRootWindow()->Show(); |
| 134 Shell::GetPrimaryRootWindow()->GetHost()->Show(); | 135 Shell::GetPrimaryRootWindow()->GetHost()->Show(); |
| 135 // Move the mouse cursor to far away so that native events doesn't | 136 // Move the mouse cursor to far away so that native events doesn't |
| 136 // interfere test expectations. | 137 // interfere test expectations. |
| 137 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); | 138 Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); |
| 138 // TODO: mash needs to support CursorManager. http://crbug.com/637853. | 139 // TODO: mus/mash needs to support CursorManager. http://crbug.com/637853. |
| 139 if (!WmShell::Get()->IsRunningInMash()) | 140 if (Shell::GetConfig() == Config::CLASSIC) |
| 140 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); | 141 Shell::GetInstance()->cursor_manager()->EnableMouseEvents(); |
| 141 | 142 |
| 142 // Changing GestureConfiguration shouldn't make tests fail. These values | 143 // Changing GestureConfiguration shouldn't make tests fail. These values |
| 143 // prevent unexpected events from being generated during tests. Such as | 144 // prevent unexpected events from being generated during tests. Such as |
| 144 // delayed events which create race conditions on slower tests. | 145 // delayed events which create race conditions on slower tests. |
| 145 ui::GestureConfiguration* gesture_config = | 146 ui::GestureConfiguration* gesture_config = |
| 146 ui::GestureConfiguration::GetInstance(); | 147 ui::GestureConfiguration::GetInstance(); |
| 147 gesture_config->set_max_touch_down_duration_for_click_in_ms(800); | 148 gesture_config->set_max_touch_down_duration_for_click_in_ms(800); |
| 148 gesture_config->set_long_press_time_in_ms(1000); | 149 gesture_config->set_long_press_time_in_ms(1000); |
| 149 gesture_config->set_max_touch_move_in_pixels_for_click(5); | 150 gesture_config->set_max_touch_move_in_pixels_for_click(5); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 .GetActiveRotation(); | 193 .GetActiveRotation(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 // static | 196 // static |
| 196 display::Display::Rotation AshTestBase::GetCurrentInternalDisplayRotation() { | 197 display::Display::Rotation AshTestBase::GetCurrentInternalDisplayRotation() { |
| 197 return GetActiveDisplayRotation(display::Display::InternalDisplayId()); | 198 return GetActiveDisplayRotation(display::Display::InternalDisplayId()); |
| 198 } | 199 } |
| 199 | 200 |
| 200 // static | 201 // static |
| 201 void AshTestBase::UpdateDisplay(const std::string& display_specs) { | 202 void AshTestBase::UpdateDisplay(const std::string& display_specs) { |
| 202 if (WmShell::Get()->IsRunningInMash()) { | 203 if (Shell::GetConfig() != Config::CLASSIC) { |
| 203 ash_test_helper_->UpdateDisplayForMash(display_specs); | 204 ash_test_helper_->UpdateDisplayForMash(display_specs); |
| 204 } else { | 205 } else { |
| 205 display::test::DisplayManagerTestApi( | 206 display::test::DisplayManagerTestApi( |
| 206 Shell::GetInstance()->display_manager()) | 207 Shell::GetInstance()->display_manager()) |
| 207 .UpdateDisplay(display_specs); | 208 .UpdateDisplay(display_specs); |
| 208 } | 209 } |
| 209 } | 210 } |
| 210 | 211 |
| 211 aura::Window* AshTestBase::CurrentContext() { | 212 aura::Window* AshTestBase::CurrentContext() { |
| 212 return ash_test_helper_->CurrentContext(); | 213 return ash_test_helper_->CurrentContext(); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( | 401 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( |
| 401 display_manager()->GetSecondaryDisplay().id()); | 402 display_manager()->GetSecondaryDisplay().id()); |
| 402 } | 403 } |
| 403 | 404 |
| 404 display::Display AshTestBase::GetSecondaryDisplay() { | 405 display::Display AshTestBase::GetSecondaryDisplay() { |
| 405 return ash_test_helper_->GetSecondaryDisplay(); | 406 return ash_test_helper_->GetSecondaryDisplay(); |
| 406 } | 407 } |
| 407 | 408 |
| 408 } // namespace test | 409 } // namespace test |
| 409 } // namespace ash | 410 } // namespace ash |
| OLD | NEW |