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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 gfx::Screen* screen = gfx::Screen::GetScreenFor(context); | 88 gfx::Screen* screen = gfx::Screen::GetScreenFor(context); |
89 gfx::Display original_display = | 89 gfx::Display original_display = |
90 screen->GetDisplayNearestPoint(point_in_screen); | 90 screen->GetDisplayNearestPoint(point_in_screen); |
91 event_generator.MoveMouseTo(point_in_screen); | 91 event_generator.MoveMouseTo(point_in_screen); |
92 return original_display.id() != | 92 return original_display.id() != |
93 screen->GetDisplayNearestPoint( | 93 screen->GetDisplayNearestPoint( |
94 aura::Env::GetInstance()->last_mouse_location()).id(); | 94 aura::Env::GetInstance()->last_mouse_location()).id(); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
98 // static | |
99 void DisplayManagerTestApi::EnableUnifiedDesktopForTest() { | |
100 #if defined(OS_CHROMEOS) | |
101 base::CommandLine::ForCurrentProcess()->AppendSwitch( | |
102 switches::kAshEnableUnifiedDesktop); | |
103 Shell::GetInstance() | |
104 ->display_manager() | |
105 ->layout_store() | |
106 ->SetDefaultDisplayLayout(DisplayLayout()); | |
107 #endif | |
108 } | |
109 | |
110 DisplayManagerTestApi::DisplayManagerTestApi() | 98 DisplayManagerTestApi::DisplayManagerTestApi() |
111 : display_manager_(Shell::GetInstance()->display_manager()) {} | 99 : display_manager_(Shell::GetInstance()->display_manager()) {} |
112 | 100 |
113 DisplayManagerTestApi::~DisplayManagerTestApi() {} | 101 DisplayManagerTestApi::~DisplayManagerTestApi() {} |
114 | 102 |
115 void DisplayManagerTestApi::UpdateDisplay( | 103 void DisplayManagerTestApi::UpdateDisplay( |
116 const std::string& display_specs) { | 104 const std::string& display_specs) { |
117 std::vector<DisplayInfo> display_info_list = | 105 std::vector<DisplayInfo> display_info_list = |
118 CreateDisplayInfoListFromString(display_specs, display_manager_); | 106 CreateDisplayInfoListFromString(display_specs, display_manager_); |
119 bool is_host_origin_set = false; | 107 bool is_host_origin_set = false; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 178 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
191 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); | 179 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); |
192 DisplayMode mode; | 180 DisplayMode mode; |
193 if (!GetDisplayModeForResolution(info, resolution, &mode)) | 181 if (!GetDisplayModeForResolution(info, resolution, &mode)) |
194 return false; | 182 return false; |
195 return display_manager->SetDisplayMode(display_id, mode); | 183 return display_manager->SetDisplayMode(display_id, mode); |
196 } | 184 } |
197 | 185 |
198 } // namespace test | 186 } // namespace test |
199 } // namespace ash | 187 } // namespace ash |
OLD | NEW |