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

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

Issue 2207043002: SetDeviceScaleFactorForTest Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: SetDeviceScaleFactorForTest Created 4 years, 4 months 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/display.h ('k') | ui/display/mac/screen_mac.mm » ('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/display.h" 5 #include "ui/display/display.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 // static 63 // static
64 bool Display::HasForceDeviceScaleFactor() { 64 bool Display::HasForceDeviceScaleFactor() {
65 if (g_has_forced_device_scale_factor == -1) 65 if (g_has_forced_device_scale_factor == -1)
66 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl(); 66 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl();
67 return !!g_has_forced_device_scale_factor; 67 return !!g_has_forced_device_scale_factor;
68 } 68 }
69 69
70 // static 70 // static
71 void Display::SetForceDeviceScaleFactorForTesting(float scale_factor) {
72 g_has_forced_device_scale_factor = 1;
73 g_forced_device_scale_factor = scale_factor;
74 }
75
76 // static
71 void Display::ResetForceDeviceScaleFactorForTesting() { 77 void Display::ResetForceDeviceScaleFactorForTesting() {
72 g_has_forced_device_scale_factor = -1; 78 g_has_forced_device_scale_factor = -1;
73 g_forced_device_scale_factor = -1.0; 79 g_forced_device_scale_factor = -1.0;
74 } 80 }
75 81
76 constexpr int DEFAULT_BITS_PER_PIXEL = 24; 82 constexpr int DEFAULT_BITS_PER_PIXEL = 24;
77 constexpr int DEFAULT_BITS_PER_COMPONENT = 8; 83 constexpr int DEFAULT_BITS_PER_COMPONENT = 8;
78 84
79 Display::Display() 85 Display::Display()
80 : id_(kInvalidDisplayID), 86 : id_(kInvalidDisplayID),
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 DCHECK_NE(kInvalidDisplayID, display_id); 221 DCHECK_NE(kInvalidDisplayID, display_id);
216 return HasInternalDisplay() && internal_display_id_ == display_id; 222 return HasInternalDisplay() && internal_display_id_ == display_id;
217 } 223 }
218 224
219 // static 225 // static
220 bool Display::HasInternalDisplay() { 226 bool Display::HasInternalDisplay() {
221 return internal_display_id_ != kInvalidDisplayID; 227 return internal_display_id_ != kInvalidDisplayID;
222 } 228 }
223 229
224 } // namespace display 230 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display.h ('k') | ui/display/mac/screen_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698