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

Side by Side Diff: ui/base/layout_unittest.cc

Issue 11301007: Load the resources for max scale factor first. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle.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/base/layout.h" 5 #include "ui/base/layout.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 #if defined(OS_CHROMEOS) 9 #if defined(OS_CHROMEOS)
10 #include "base/chromeos/chromeos_version.h" 10 #include "base/chromeos/chromeos_version.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(1.91f)); 65 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(1.91f));
66 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(2.0f)); 66 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(2.0f));
67 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(2.1f)); 67 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(2.1f));
68 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(999.0f)); 68 EXPECT_EQ(SCALE_FACTOR_200P, GetScaleFactorFromScale(999.0f));
69 69
70 test::SetSupportedScaleFactors(original_supported_factors); 70 test::SetSupportedScaleFactors(original_supported_factors);
71 } 71 }
72 72
73 TEST(LayoutTest, GetMaxScaleFactor) { 73 TEST(LayoutTest, GetMaxScaleFactor) {
74 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
75 // On Chrome OS, the maximum scale factor differs depending on the devices and 75 // On Chrome OS, the maximum scale factor is based on
76 // force-device-scale-factor flag. Tests only the cases not affected by these. 76 // the available resource pack. In testing environment,
77 if (!base::chromeos::IsRunningOnChromeOS() && 77 // we always have 200P.
78 !CommandLine::ForCurrentProcess()->HasSwitch( 78 EXPECT_EQ(SCALE_FACTOR_200P, GetMaxScaleFactor());
79 switches::kForceDeviceScaleFactor))
80 EXPECT_EQ(SCALE_FACTOR_100P, GetMaxScaleFactor());
81 #else 79 #else
82 std::vector<ScaleFactor> original_supported_factors = 80 std::vector<ScaleFactor> original_supported_factors =
83 GetSupportedScaleFactors(); 81 GetSupportedScaleFactors();
84 { 82 {
85 ScaleFactor scale_factors[] = { SCALE_FACTOR_100P }; 83 ScaleFactor scale_factors[] = { SCALE_FACTOR_100P };
86 std::vector<ScaleFactor> supported_factors( 84 std::vector<ScaleFactor> supported_factors(
87 scale_factors, scale_factors + arraysize(scale_factors)); 85 scale_factors, scale_factors + arraysize(scale_factors));
88 test::SetSupportedScaleFactors(supported_factors); 86 test::SetSupportedScaleFactors(supported_factors);
89 EXPECT_EQ(SCALE_FACTOR_100P, GetMaxScaleFactor()); 87 EXPECT_EQ(SCALE_FACTOR_100P, GetMaxScaleFactor());
90 } 88 }
(...skipping 15 matching lines...) Expand all
106 std::vector<ScaleFactor> supported_factors( 104 std::vector<ScaleFactor> supported_factors(
107 scale_factors, scale_factors + arraysize(scale_factors)); 105 scale_factors, scale_factors + arraysize(scale_factors));
108 test::SetSupportedScaleFactors(supported_factors); 106 test::SetSupportedScaleFactors(supported_factors);
109 EXPECT_EQ(SCALE_FACTOR_200P, GetMaxScaleFactor()); 107 EXPECT_EQ(SCALE_FACTOR_200P, GetMaxScaleFactor());
110 } 108 }
111 test::SetSupportedScaleFactors(original_supported_factors); 109 test::SetSupportedScaleFactors(original_supported_factors);
112 #endif 110 #endif
113 } 111 }
114 112
115 } // namespace ui 113 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698