| 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/display/display_info.h" | 10 #include "ash/display/display_info.h" |
| 10 #include "ash/display/display_manager.h" | 11 #include "ash/display/display_manager.h" |
| 11 #include "ash/display/display_util.h" | 12 #include "ash/display/display_util.h" |
| 12 #include "ash/display/extended_mouse_warp_controller.h" | 13 #include "ash/display/extended_mouse_warp_controller.h" |
| 13 #include "ash/display/mouse_cursor_event_filter.h" | 14 #include "ash/display/mouse_cursor_event_filter.h" |
| 14 #include "ash/display/unified_mouse_warp_controller.h" | 15 #include "ash/display/unified_mouse_warp_controller.h" |
| 15 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "base/command_line.h" |
| 16 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 17 #include "ui/aura/env.h" | 19 #include "ui/aura/env.h" |
| 18 #include "ui/aura/window_event_dispatcher.h" | 20 #include "ui/aura/window_event_dispatcher.h" |
| 19 #include "ui/events/test/event_generator.h" | 21 #include "ui/events/test/event_generator.h" |
| 20 #include "ui/gfx/display.h" | 22 #include "ui/gfx/display.h" |
| 21 | 23 |
| 22 namespace ash { | 24 namespace ash { |
| 23 namespace test { | 25 namespace test { |
| 24 typedef std::vector<gfx::Display> DisplayList; | 26 typedef std::vector<gfx::Display> DisplayList; |
| 25 typedef DisplayInfo DisplayInfo; | 27 typedef DisplayInfo DisplayInfo; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 gfx::Screen* screen = gfx::Screen::GetScreenFor(context); | 87 gfx::Screen* screen = gfx::Screen::GetScreenFor(context); |
| 86 gfx::Display original_display = | 88 gfx::Display original_display = |
| 87 screen->GetDisplayNearestPoint(point_in_screen); | 89 screen->GetDisplayNearestPoint(point_in_screen); |
| 88 event_generator.MoveMouseTo(point_in_screen); | 90 event_generator.MoveMouseTo(point_in_screen); |
| 89 return original_display.id() != | 91 return original_display.id() != |
| 90 screen->GetDisplayNearestPoint( | 92 screen->GetDisplayNearestPoint( |
| 91 aura::Env::GetInstance()->last_mouse_location()).id(); | 93 aura::Env::GetInstance()->last_mouse_location()).id(); |
| 92 } | 94 } |
| 93 } | 95 } |
| 94 | 96 |
| 97 // static |
| 98 void DisplayManagerTestApi::EnableUnifiedDesktopForTest() { |
| 99 #if defined(OS_CHROMEOS) |
| 100 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 101 switches::kAshEnableUnifiedDesktop); |
| 102 #endif |
| 103 } |
| 104 |
| 95 DisplayManagerTestApi::DisplayManagerTestApi(DisplayManager* display_manager) | 105 DisplayManagerTestApi::DisplayManagerTestApi(DisplayManager* display_manager) |
| 96 : display_manager_(display_manager) {} | 106 : display_manager_(display_manager) {} |
| 97 | 107 |
| 98 DisplayManagerTestApi::~DisplayManagerTestApi() {} | 108 DisplayManagerTestApi::~DisplayManagerTestApi() {} |
| 99 | 109 |
| 100 void DisplayManagerTestApi::UpdateDisplay( | 110 void DisplayManagerTestApi::UpdateDisplay( |
| 101 const std::string& display_specs) { | 111 const std::string& display_specs) { |
| 102 std::vector<DisplayInfo> display_info_list = | 112 std::vector<DisplayInfo> display_info_list = |
| 103 CreateDisplayInfoListFromString(display_specs, display_manager_); | 113 CreateDisplayInfoListFromString(display_specs, display_manager_); |
| 104 bool is_host_origin_set = false; | 114 bool is_host_origin_set = false; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 159 |
| 150 void DisplayManagerTestApi::SetAvailableColorProfiles( | 160 void DisplayManagerTestApi::SetAvailableColorProfiles( |
| 151 int64 display_id, | 161 int64 display_id, |
| 152 const std::vector<ui::ColorCalibrationProfile>& profiles) { | 162 const std::vector<ui::ColorCalibrationProfile>& profiles) { |
| 153 display_manager_->display_info_[display_id].set_available_color_profiles( | 163 display_manager_->display_info_[display_id].set_available_color_profiles( |
| 154 profiles); | 164 profiles); |
| 155 } | 165 } |
| 156 | 166 |
| 157 } // namespace test | 167 } // namespace test |
| 158 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |