| 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 "ui/display/test/display_manager_test_api.h" | 5 #include "ui/display/test/display_manager_test_api.h" |
| 6 | 6 |
| 7 #include <cstdarg> | 7 #include <cstdarg> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 Display::SetInternalDisplayId(id); | 107 Display::SetInternalDisplayId(id); |
| 108 display_manager_->UpdateInternalManagedDisplayModeListForTest(); | 108 display_manager_->UpdateInternalManagedDisplayModeListForTest(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void DisplayManagerTestApi::DisableChangeDisplayUponHostResize() { | 111 void DisplayManagerTestApi::DisableChangeDisplayUponHostResize() { |
| 112 display_manager_->set_change_display_upon_host_resize(false); | 112 display_manager_->set_change_display_upon_host_resize(false); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void DisplayManagerTestApi::SetAvailableColorProfiles( | 115 void DisplayManagerTestApi::SetAvailableColorProfiles( |
| 116 int64_t display_id, | 116 int64_t display_id, |
| 117 const std::vector<ui::ColorCalibrationProfile>& profiles) { | 117 const std::vector<ColorCalibrationProfile>& profiles) { |
| 118 display_manager_->display_info_[display_id].set_available_color_profiles( | 118 display_manager_->display_info_[display_id].set_available_color_profiles( |
| 119 profiles); | 119 profiles); |
| 120 } | 120 } |
| 121 | 121 |
| 122 const ManagedDisplayInfo& DisplayManagerTestApi::GetInternalManagedDisplayInfo( | 122 const ManagedDisplayInfo& DisplayManagerTestApi::GetInternalManagedDisplayInfo( |
| 123 int64_t display_id) { | 123 int64_t display_id) { |
| 124 return display_manager_->display_info_[display_id]; | 124 return display_manager_->display_info_[display_id]; |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool DisplayManagerTestApi::SetDisplayUIScale(int64_t id, float ui_scale) { | 127 bool DisplayManagerTestApi::SetDisplayUIScale(int64_t id, float ui_scale) { |
| 128 if (!display_manager_->IsActiveDisplayId(id) || | 128 if (!display_manager_->IsActiveDisplayId(id) || |
| 129 !Display::IsInternalDisplayId(id)) { | 129 !Display::IsInternalDisplayId(id)) { |
| 130 return false; | 130 return false; |
| 131 } | 131 } |
| 132 const ManagedDisplayInfo& info = display_manager_->GetDisplayInfo(id); | 132 const ManagedDisplayInfo& info = display_manager_->GetDisplayInfo(id); |
| 133 | 133 |
| 134 scoped_refptr<ManagedDisplayMode> mode = | 134 scoped_refptr<ManagedDisplayMode> mode = |
| 135 GetDisplayModeForUIScale(info, ui_scale); | 135 GetDisplayModeForUIScale(info, ui_scale); |
| 136 if (!mode) | 136 if (!mode) |
| 137 return false; | 137 return false; |
| 138 return display_manager_->SetDisplayMode(id, mode); | 138 return display_manager_->SetDisplayMode(id, mode); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void DisplayManagerTestApi::SetTouchSupport( | 141 void DisplayManagerTestApi::SetTouchSupport( |
| 142 int64_t display_id, | 142 int64_t display_id, |
| 143 display::Display::TouchSupport touch_support) { | 143 Display::TouchSupport touch_support) { |
| 144 display_manager_->FindDisplayForId(display_id) | 144 display_manager_->FindDisplayForId(display_id) |
| 145 ->set_touch_support(touch_support); | 145 ->set_touch_support(touch_support); |
| 146 } | 146 } |
| 147 | 147 |
| 148 ScopedDisable125DSFForUIScaling::ScopedDisable125DSFForUIScaling() { | 148 ScopedDisable125DSFForUIScaling::ScopedDisable125DSFForUIScaling() { |
| 149 ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(false); | 149 ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(false); |
| 150 } | 150 } |
| 151 | 151 |
| 152 ScopedDisable125DSFForUIScaling::~ScopedDisable125DSFForUIScaling() { | 152 ScopedDisable125DSFForUIScaling::~ScopedDisable125DSFForUIScaling() { |
| 153 ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(true); | 153 ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(true); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 for (size_t i = 0; i < count; i++) { | 199 for (size_t i = 0; i < count; i++) { |
| 200 int64_t id = va_arg(args, int64_t); | 200 int64_t id = va_arg(args, int64_t); |
| 201 list.push_back(id); | 201 list.push_back(id); |
| 202 } | 202 } |
| 203 SortDisplayIdList(&list); | 203 SortDisplayIdList(&list); |
| 204 return list; | 204 return list; |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace test | 207 } // namespace test |
| 208 } // namespace display | 208 } // namespace display |
| OLD | NEW |