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 <cstdarg> | 7 #include <cstdarg> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 display::DisplayList list = | 40 display::DisplayList list = |
41 display_manager->IsInUnifiedMode() | 41 display_manager->IsInUnifiedMode() |
42 ? display_manager->software_mirroring_display_list() | 42 ? display_manager->software_mirroring_display_list() |
43 : display_manager->active_display_list(); | 43 : display_manager->active_display_list(); |
44 | 44 |
45 for (std::vector<std::string>::const_iterator iter = parts.begin(); | 45 for (std::vector<std::string>::const_iterator iter = parts.begin(); |
46 iter != parts.end(); ++iter, ++index) { | 46 iter != parts.end(); ++iter, ++index) { |
47 int64_t id = (index < list.size()) ? list[index].id() | 47 int64_t id = (index < list.size()) ? list[index].id() |
48 : display::Display::kInvalidDisplayID; | 48 : display::Display::kInvalidDisplayID; |
49 display_info_list.push_back( | 49 display_info_list.push_back(DisplayInfo::CreateFromSpecWithID(*iter, id)); |
50 DisplayInfo::CreateFromSpecWithID(*iter, id)); | |
51 } | 50 } |
52 return display_info_list; | 51 return display_info_list; |
53 } | 52 } |
54 | 53 |
55 } // namespace | 54 } // namespace |
56 | 55 |
57 // static | 56 // static |
58 bool DisplayManagerTestApi::TestIfMouseWarpsAt( | 57 bool DisplayManagerTestApi::TestIfMouseWarpsAt( |
59 ui::test::EventGenerator& event_generator, | 58 ui::test::EventGenerator& event_generator, |
60 const gfx::Point& point_in_screen) { | 59 const gfx::Point& point_in_screen) { |
61 DCHECK(!Shell::GetInstance()->display_manager()->IsInUnifiedMode()); | 60 DCHECK(!Shell::GetInstance()->display_manager()->IsInUnifiedMode()); |
62 static_cast<ExtendedMouseWarpController*>( | 61 static_cast<ExtendedMouseWarpController*>( |
63 Shell::GetInstance() | 62 Shell::GetInstance() |
64 ->mouse_cursor_filter() | 63 ->mouse_cursor_filter() |
65 ->mouse_warp_controller_for_test()) | 64 ->mouse_warp_controller_for_test()) |
66 ->allow_non_native_event_for_test(); | 65 ->allow_non_native_event_for_test(); |
67 display::Screen* screen = display::Screen::GetScreen(); | 66 display::Screen* screen = display::Screen::GetScreen(); |
68 display::Display original_display = | 67 display::Display original_display = |
69 screen->GetDisplayNearestPoint(point_in_screen); | 68 screen->GetDisplayNearestPoint(point_in_screen); |
70 event_generator.MoveMouseTo(point_in_screen); | 69 event_generator.MoveMouseTo(point_in_screen); |
71 return original_display.id() != | 70 return original_display.id() != |
72 screen->GetDisplayNearestPoint( | 71 screen |
73 aura::Env::GetInstance()->last_mouse_location()) | 72 ->GetDisplayNearestPoint( |
| 73 aura::Env::GetInstance()->last_mouse_location()) |
74 .id(); | 74 .id(); |
75 } | 75 } |
76 | 76 |
77 DisplayManagerTestApi::DisplayManagerTestApi() | 77 DisplayManagerTestApi::DisplayManagerTestApi() |
78 : display_manager_(Shell::GetInstance()->display_manager()) {} | 78 : display_manager_(Shell::GetInstance()->display_manager()) {} |
79 | 79 |
80 DisplayManagerTestApi::~DisplayManagerTestApi() {} | 80 DisplayManagerTestApi::~DisplayManagerTestApi() {} |
81 | 81 |
82 void DisplayManagerTestApi::UpdateDisplay(const std::string& display_specs) { | 82 void DisplayManagerTestApi::UpdateDisplay(const std::string& display_specs) { |
83 std::vector<DisplayInfo> display_info_list = | 83 std::vector<DisplayInfo> display_info_list = |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 for (size_t i = 0; i < count; i++) { | 196 for (size_t i = 0; i < count; i++) { |
197 int64_t id = va_arg(args, int64_t); | 197 int64_t id = va_arg(args, int64_t); |
198 list.push_back(id); | 198 list.push_back(id); |
199 } | 199 } |
200 SortDisplayIdList(&list); | 200 SortDisplayIdList(&list); |
201 return list; | 201 return list; |
202 } | 202 } |
203 | 203 |
204 } // namespace test | 204 } // namespace test |
205 } // namespace ash | 205 } // namespace ash |
OLD | NEW |