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/display_manager_test_api.h" | 5 #include "ash/test/display_manager_test_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_info.h" | 10 #include "ash/display/display_info.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 return display_info_list; | 53 return display_info_list; |
54 } | 54 } |
55 | 55 |
56 } // namespace | 56 } // namespace |
57 | 57 |
58 // static | 58 // static |
59 bool DisplayManagerTestApi::TestIfMouseWarpsAt( | 59 bool DisplayManagerTestApi::TestIfMouseWarpsAt( |
60 ui::test::EventGenerator& event_generator, | 60 ui::test::EventGenerator& event_generator, |
61 const gfx::Point& point_in_screen) { | 61 const gfx::Point& point_in_screen) { |
62 aura::Window* context = Shell::GetAllRootWindows()[0]; | |
63 DCHECK(!Shell::GetInstance()->display_manager()->IsInUnifiedMode()); | 62 DCHECK(!Shell::GetInstance()->display_manager()->IsInUnifiedMode()); |
64 static_cast<ExtendedMouseWarpController*>( | 63 static_cast<ExtendedMouseWarpController*>( |
65 Shell::GetInstance() | 64 Shell::GetInstance() |
66 ->mouse_cursor_filter() | 65 ->mouse_cursor_filter() |
67 ->mouse_warp_controller_for_test()) | 66 ->mouse_warp_controller_for_test()) |
68 ->allow_non_native_event_for_test(); | 67 ->allow_non_native_event_for_test(); |
69 gfx::Screen* screen = gfx::Screen::GetScreenFor(context); | 68 gfx::Screen* screen = gfx::Screen::GetScreen(); |
70 gfx::Display original_display = | 69 gfx::Display original_display = |
71 screen->GetDisplayNearestPoint(point_in_screen); | 70 screen->GetDisplayNearestPoint(point_in_screen); |
72 event_generator.MoveMouseTo(point_in_screen); | 71 event_generator.MoveMouseTo(point_in_screen); |
73 return original_display.id() != | 72 return original_display.id() != |
74 screen->GetDisplayNearestPoint( | 73 screen->GetDisplayNearestPoint( |
75 aura::Env::GetInstance()->last_mouse_location()) | 74 aura::Env::GetInstance()->last_mouse_location()) |
76 .id(); | 75 .id(); |
77 } | 76 } |
78 | 77 |
79 DisplayManagerTestApi::DisplayManagerTestApi() | 78 DisplayManagerTestApi::DisplayManagerTestApi() |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 158 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
160 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); | 159 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); |
161 DisplayMode mode; | 160 DisplayMode mode; |
162 if (!GetDisplayModeForResolution(info, resolution, &mode)) | 161 if (!GetDisplayModeForResolution(info, resolution, &mode)) |
163 return false; | 162 return false; |
164 return display_manager->SetDisplayMode(display_id, mode); | 163 return display_manager->SetDisplayMode(display_id, mode); |
165 } | 164 } |
166 | 165 |
167 } // namespace test | 166 } // namespace test |
168 } // namespace ash | 167 } // namespace ash |
OLD | NEW |