Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: ui/display/test/display_manager_test_api.cc

Issue 2519993002: Move kInvalidDisplayID to display_constants.h. (Closed)
Patch Set: Address comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/display/manager/managed_display_info.cc ('k') | ui/display/types/display_constants.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 16 matching lines...) Expand all
27 specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 27 specs, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
28 size_t index = 0; 28 size_t index = 0;
29 29
30 display::Displays list = 30 display::Displays list =
31 display_manager->IsInUnifiedMode() 31 display_manager->IsInUnifiedMode()
32 ? display_manager->software_mirroring_display_list() 32 ? display_manager->software_mirroring_display_list()
33 : display_manager->active_display_list(); 33 : display_manager->active_display_list();
34 34
35 for (std::vector<std::string>::const_iterator iter = parts.begin(); 35 for (std::vector<std::string>::const_iterator iter = parts.begin();
36 iter != parts.end(); ++iter, ++index) { 36 iter != parts.end(); ++iter, ++index) {
37 int64_t id = (index < list.size()) ? list[index].id() 37 int64_t id = (index < list.size()) ? list[index].id() : kInvalidDisplayId;
38 : display::Display::kInvalidDisplayID;
39 display_info_list.push_back( 38 display_info_list.push_back(
40 display::ManagedDisplayInfo::CreateFromSpecWithID(*iter, id)); 39 display::ManagedDisplayInfo::CreateFromSpecWithID(*iter, id));
41 } 40 }
42 return display_info_list; 41 return display_info_list;
43 } 42 }
44 43
45 scoped_refptr<display::ManagedDisplayMode> GetDisplayModeForUIScale( 44 scoped_refptr<display::ManagedDisplayMode> GetDisplayModeForUIScale(
46 const display::ManagedDisplayInfo& info, 45 const display::ManagedDisplayInfo& info,
47 float ui_scale) { 46 float ui_scale) {
48 const display::ManagedDisplayInfo::ManagedDisplayModeList& modes = 47 const display::ManagedDisplayInfo::ManagedDisplayModeList& modes =
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 display::ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(true); 148 display::ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(true);
150 } 149 }
151 150
152 ScopedSetInternalDisplayId::ScopedSetInternalDisplayId( 151 ScopedSetInternalDisplayId::ScopedSetInternalDisplayId(
153 DisplayManager* display_manager, 152 DisplayManager* display_manager,
154 int64_t id) { 153 int64_t id) {
155 DisplayManagerTestApi(display_manager).SetInternalDisplayId(id); 154 DisplayManagerTestApi(display_manager).SetInternalDisplayId(id);
156 } 155 }
157 156
158 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() { 157 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() {
159 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); 158 display::Display::SetInternalDisplayId(kInvalidDisplayId);
160 } 159 }
161 160
162 bool SetDisplayResolution(DisplayManager* display_manager, 161 bool SetDisplayResolution(DisplayManager* display_manager,
163 int64_t display_id, 162 int64_t display_id,
164 const gfx::Size& resolution) { 163 const gfx::Size& resolution) {
165 const display::ManagedDisplayInfo& info = 164 const display::ManagedDisplayInfo& info =
166 display_manager->GetDisplayInfo(display_id); 165 display_manager->GetDisplayInfo(display_id);
167 scoped_refptr<display::ManagedDisplayMode> mode = 166 scoped_refptr<display::ManagedDisplayMode> mode =
168 GetDisplayModeForResolution(info, resolution); 167 GetDisplayModeForResolution(info, resolution);
169 if (!mode) 168 if (!mode)
(...skipping 27 matching lines...) Expand all
197 for (size_t i = 0; i < count; i++) { 196 for (size_t i = 0; i < count; i++) {
198 int64_t id = va_arg(args, int64_t); 197 int64_t id = va_arg(args, int64_t);
199 list.push_back(id); 198 list.push_back(id);
200 } 199 }
201 display::SortDisplayIdList(&list); 200 display::SortDisplayIdList(&list);
202 return list; 201 return list;
203 } 202 }
204 203
205 } // namespace test 204 } // namespace test
206 } // namespace display 205 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/managed_display_info.cc ('k') | ui/display/types/display_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698