| 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 27 matching lines...) Expand all Loading... |
| 38 specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 38 specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 39 size_t index = 0; | 39 size_t index = 0; |
| 40 | 40 |
| 41 DisplayManager::DisplayList list = | 41 DisplayManager::DisplayList list = |
| 42 display_manager->IsInUnifiedMode() | 42 display_manager->IsInUnifiedMode() |
| 43 ? display_manager->software_mirroring_display_list() | 43 ? display_manager->software_mirroring_display_list() |
| 44 : display_manager->active_display_list(); | 44 : display_manager->active_display_list(); |
| 45 | 45 |
| 46 for (std::vector<std::string>::const_iterator iter = parts.begin(); | 46 for (std::vector<std::string>::const_iterator iter = parts.begin(); |
| 47 iter != parts.end(); ++iter, ++index) { | 47 iter != parts.end(); ++iter, ++index) { |
| 48 int64 id = (index < list.size()) ? list[index].id() | 48 int64_t id = (index < list.size()) ? list[index].id() |
| 49 : gfx::Display::kInvalidDisplayID; | 49 : gfx::Display::kInvalidDisplayID; |
| 50 display_info_list.push_back( | 50 display_info_list.push_back( |
| 51 DisplayInfo::CreateFromSpecWithID(*iter, id)); | 51 DisplayInfo::CreateFromSpecWithID(*iter, id)); |
| 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( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 next_y += bounds.height(); | 110 next_y += bounds.height(); |
| 111 iter->SetBounds(bounds); | 111 iter->SetBounds(bounds); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 display_manager_->OnNativeDisplaysChanged(display_info_list); | 115 display_manager_->OnNativeDisplaysChanged(display_info_list); |
| 116 display_manager_->UpdateInternalDisplayModeListForTest(); | 116 display_manager_->UpdateInternalDisplayModeListForTest(); |
| 117 display_manager_->RunPendingTasksForTest(); | 117 display_manager_->RunPendingTasksForTest(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 int64 DisplayManagerTestApi::SetFirstDisplayAsInternalDisplay() { | 120 int64_t DisplayManagerTestApi::SetFirstDisplayAsInternalDisplay() { |
| 121 const gfx::Display& internal = display_manager_->active_display_list_[0]; | 121 const gfx::Display& internal = display_manager_->active_display_list_[0]; |
| 122 SetInternalDisplayId(internal.id()); | 122 SetInternalDisplayId(internal.id()); |
| 123 return gfx::Display::InternalDisplayId(); | 123 return gfx::Display::InternalDisplayId(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void DisplayManagerTestApi::SetInternalDisplayId(int64 id) { | 126 void DisplayManagerTestApi::SetInternalDisplayId(int64_t id) { |
| 127 gfx::Display::SetInternalDisplayId(id); | 127 gfx::Display::SetInternalDisplayId(id); |
| 128 display_manager_->UpdateInternalDisplayModeListForTest(); | 128 display_manager_->UpdateInternalDisplayModeListForTest(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void DisplayManagerTestApi::DisableChangeDisplayUponHostResize() { | 131 void DisplayManagerTestApi::DisableChangeDisplayUponHostResize() { |
| 132 display_manager_->set_change_display_upon_host_resize(false); | 132 display_manager_->set_change_display_upon_host_resize(false); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void DisplayManagerTestApi::SetAvailableColorProfiles( | 135 void DisplayManagerTestApi::SetAvailableColorProfiles( |
| 136 int64 display_id, | 136 int64_t display_id, |
| 137 const std::vector<ui::ColorCalibrationProfile>& profiles) { | 137 const std::vector<ui::ColorCalibrationProfile>& profiles) { |
| 138 display_manager_->display_info_[display_id].set_available_color_profiles( | 138 display_manager_->display_info_[display_id].set_available_color_profiles( |
| 139 profiles); | 139 profiles); |
| 140 } | 140 } |
| 141 | 141 |
| 142 ScopedDisable125DSFForUIScaling::ScopedDisable125DSFForUIScaling() { | 142 ScopedDisable125DSFForUIScaling::ScopedDisable125DSFForUIScaling() { |
| 143 DisplayInfo::SetUse125DSFForUIScalingForTest(false); | 143 DisplayInfo::SetUse125DSFForUIScalingForTest(false); |
| 144 } | 144 } |
| 145 | 145 |
| 146 ScopedDisable125DSFForUIScaling::~ScopedDisable125DSFForUIScaling() { | 146 ScopedDisable125DSFForUIScaling::~ScopedDisable125DSFForUIScaling() { |
| 147 DisplayInfo::SetUse125DSFForUIScalingForTest(true); | 147 DisplayInfo::SetUse125DSFForUIScalingForTest(true); |
| 148 } | 148 } |
| 149 | 149 |
| 150 ScopedSetInternalDisplayId::ScopedSetInternalDisplayId(int64 id) { | 150 ScopedSetInternalDisplayId::ScopedSetInternalDisplayId(int64_t id) { |
| 151 DisplayManagerTestApi().SetInternalDisplayId(id); | 151 DisplayManagerTestApi().SetInternalDisplayId(id); |
| 152 } | 152 } |
| 153 | 153 |
| 154 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() { | 154 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() { |
| 155 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); | 155 gfx::Display::SetInternalDisplayId(gfx::Display::kInvalidDisplayID); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool SetDisplayResolution(int64 display_id, const gfx::Size& resolution) { | 158 bool SetDisplayResolution(int64_t display_id, const gfx::Size& resolution) { |
| 159 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 159 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
| 160 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); | 160 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); |
| 161 DisplayMode mode; | 161 DisplayMode mode; |
| 162 if (!GetDisplayModeForResolution(info, resolution, &mode)) | 162 if (!GetDisplayModeForResolution(info, resolution, &mode)) |
| 163 return false; | 163 return false; |
| 164 return display_manager->SetDisplayMode(display_id, mode); | 164 return display_manager->SetDisplayMode(display_id, mode); |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace test | 167 } // namespace test |
| 168 } // namespace ash | 168 } // namespace ash |
| OLD | NEW |