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

Side by Side Diff: ui/gfx/icon_util_unittest.cc

Issue 1406403007: Eliminate HICON leaks caused by creating icons from bitmap image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ScopedHICON instead of HICON. Created 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/gfx/icon_util.h" 5 #include "ui/gfx/icon_util.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "ui/gfx/geometry/size.h" 13 #include "ui/gfx/geometry/size.h"
14 #include "ui/gfx/gfx_paths.h" 14 #include "ui/gfx/gfx_paths.h"
15 #include "ui/gfx/icon_util_unittests_resource.h" 15 #include "ui/gfx/icon_util_unittests_resource.h"
16 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
17 #include "ui/gfx/image/image_family.h" 17 #include "ui/gfx/image/image_family.h"
18 18
19 using base::win::ScopedHICON;
grt (UTC plus 2) 2015/11/10 16:44:43 nit: can you move this into the public: section of
20
19 namespace { 21 namespace {
20 22
21 static const char kSmallIconName[] = "icon_util/16_X_16_icon.ico"; 23 static const char kSmallIconName[] = "icon_util/16_X_16_icon.ico";
22 static const char kLargeIconName[] = "icon_util/128_X_128_icon.ico"; 24 static const char kLargeIconName[] = "icon_util/128_X_128_icon.ico";
23 static const char kTempIconFilename[] = "temp_test_icon.ico"; 25 static const char kTempIconFilename[] = "temp_test_icon.ico";
24 26
25 } // namespace 27 } // namespace
26 28
27 class IconUtilTest : public testing::Test { 29 class IconUtilTest : public testing::Test {
28 public: 30 public:
29 void SetUp() override { 31 void SetUp() override {
30 gfx::RegisterPathProvider(); 32 gfx::RegisterPathProvider();
31 ASSERT_TRUE(PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_)); 33 ASSERT_TRUE(PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_));
32 ASSERT_TRUE(temp_directory_.CreateUniqueTempDir()); 34 ASSERT_TRUE(temp_directory_.CreateUniqueTempDir());
33 } 35 }
34 36
35 static const int kSmallIconWidth = 16; 37 static const int kSmallIconWidth = 16;
36 static const int kSmallIconHeight = 16; 38 static const int kSmallIconHeight = 16;
37 static const int kLargeIconWidth = 128; 39 static const int kLargeIconWidth = 128;
38 static const int kLargeIconHeight = 128; 40 static const int kLargeIconHeight = 128;
39 41
40 // Given a file name for an .ico file and an image dimensions, this 42 // Given a file name for an .ico file and an image dimensions, this
41 // function loads the icon and returns an HICON handle. 43 // function loads the icon and returns an HICON handle.
42 HICON LoadIconFromFile(const base::FilePath& filename, 44 ScopedHICON LoadIconFromFile(const base::FilePath& filename,
43 int width, int height) { 45 int width,
46 int height) {
44 HICON icon = static_cast<HICON>(LoadImage(NULL, 47 HICON icon = static_cast<HICON>(LoadImage(NULL,
45 filename.value().c_str(), 48 filename.value().c_str(),
46 IMAGE_ICON, 49 IMAGE_ICON,
47 width, 50 width,
48 height, 51 height,
49 LR_LOADTRANSPARENT | LR_LOADFROMFILE)); 52 LR_LOADTRANSPARENT | LR_LOADFROMFILE));
50 return icon; 53 return ScopedHICON(icon).Pass();
grt (UTC plus 2) 2015/11/10 16:44:43 can you remove .Pass() here?
51 } 54 }
52 55
53 SkBitmap CreateBlackSkBitmap(int width, int height) { 56 SkBitmap CreateBlackSkBitmap(int width, int height) {
54 SkBitmap bitmap; 57 SkBitmap bitmap;
55 bitmap.allocN32Pixels(width, height); 58 bitmap.allocN32Pixels(width, height);
56 // Setting the pixels to transparent-black. 59 // Setting the pixels to transparent-black.
57 memset(bitmap.getPixels(), 0, width * height * 4); 60 memset(bitmap.getPixels(), 0, width * height * 4);
58 return bitmap; 61 return bitmap;
59 } 62 }
60 63
(...skipping 17 matching lines...) Expand all
78 81
79 // Determine how many icons to expect, based on |max_icon_size|. 82 // Determine how many icons to expect, based on |max_icon_size|.
80 int expected_num_icons = 0; 83 int expected_num_icons = 0;
81 for (size_t i = 0; i < IconUtil::kNumIconDimensions; ++i) { 84 for (size_t i = 0; i < IconUtil::kNumIconDimensions; ++i) {
82 if (IconUtil::kIconDimensions[i] > max_icon_size) 85 if (IconUtil::kIconDimensions[i] > max_icon_size)
83 break; 86 break;
84 ++expected_num_icons; 87 ++expected_num_icons;
85 } 88 }
86 89
87 // First, use the Windows API to load the icon, a basic validity test. 90 // First, use the Windows API to load the icon, a basic validity test.
88 HICON icon = LoadIconFromFile(icon_filename, kSmallIconWidth, 91 ScopedHICON icon =
89 kSmallIconHeight); 92 LoadIconFromFile(icon_filename, kSmallIconWidth, kSmallIconHeight).Pass();
90 EXPECT_NE(static_cast<HICON>(NULL), icon); 93 EXPECT_TRUE(icon.is_valid());
grt (UTC plus 2) 2015/11/10 16:44:43 EXPECT_TRUE(LoadIconFromFile(icon_filename, kSmall
91 if (icon != NULL) 94 icon.reset();
92 ::DestroyIcon(icon);
93 95
94 // Read the file completely into memory. 96 // Read the file completely into memory.
95 std::string icon_data; 97 std::string icon_data;
96 ASSERT_TRUE(base::ReadFileToString(icon_filename, &icon_data)); 98 ASSERT_TRUE(base::ReadFileToString(icon_filename, &icon_data));
97 ASSERT_GE(icon_data.length(), sizeof(IconUtil::ICONDIR)); 99 ASSERT_GE(icon_data.length(), sizeof(IconUtil::ICONDIR));
98 100
99 // Ensure that it has exactly the expected number and sizes of icons, in the 101 // Ensure that it has exactly the expected number and sizes of icons, in the
100 // expected order. This matches each entry of the loaded file's icon directory 102 // expected order. This matches each entry of the loaded file's icon directory
101 // with the corresponding element of kIconDimensions. 103 // with the corresponding element of kIconDimensions.
102 // Also extracts the 256x256 entry as png_entry. 104 // Also extracts the 256x256 entry as png_entry.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 EXPECT_EQ(256, bitmap.height()); 138 EXPECT_EQ(256, bitmap.height());
137 } 139 }
138 } 140 }
139 141
140 // The following test case makes sure IconUtil::SkBitmapFromHICON fails 142 // The following test case makes sure IconUtil::SkBitmapFromHICON fails
141 // gracefully when called with invalid input parameters. 143 // gracefully when called with invalid input parameters.
142 TEST_F(IconUtilTest, TestIconToBitmapInvalidParameters) { 144 TEST_F(IconUtilTest, TestIconToBitmapInvalidParameters) {
143 base::FilePath icon_filename = 145 base::FilePath icon_filename =
144 test_data_directory_.AppendASCII(kSmallIconName); 146 test_data_directory_.AppendASCII(kSmallIconName);
145 gfx::Size icon_size(kSmallIconWidth, kSmallIconHeight); 147 gfx::Size icon_size(kSmallIconWidth, kSmallIconHeight);
146 HICON icon = LoadIconFromFile(icon_filename, 148 ScopedHICON icon =
grt (UTC plus 2) 2015/11/10 16:44:43 can you use: ScopedHICON icon(LoadIconFromFile(i
147 icon_size.width(), 149 LoadIconFromFile(icon_filename, icon_size.width(), icon_size.height())
148 icon_size.height()); 150 .Pass();
149 ASSERT_TRUE(icon != NULL); 151 ASSERT_TRUE(icon.is_valid());
150 152
151 // Invalid size parameter. 153 // Invalid size parameter.
152 gfx::Size invalid_icon_size(kSmallIconHeight, 0); 154 gfx::Size invalid_icon_size(kSmallIconHeight, 0);
153 EXPECT_EQ(IconUtil::CreateSkBitmapFromHICON(icon, invalid_icon_size), 155 EXPECT_EQ(IconUtil::CreateSkBitmapFromHICON(icon.get(), invalid_icon_size),
154 static_cast<SkBitmap*>(NULL)); 156 static_cast<SkBitmap*>(NULL));
155 157
156 // Invalid icon. 158 // Invalid icon.
157 EXPECT_EQ(IconUtil::CreateSkBitmapFromHICON(NULL, icon_size), 159 EXPECT_EQ(IconUtil::CreateSkBitmapFromHICON(NULL, icon_size),
158 static_cast<SkBitmap*>(NULL)); 160 static_cast<SkBitmap*>(NULL));
159 161
160 // The following code should succeed. 162 // The following code should succeed.
161 scoped_ptr<SkBitmap> bitmap; 163 scoped_ptr<SkBitmap> bitmap;
162 bitmap.reset(IconUtil::CreateSkBitmapFromHICON(icon, icon_size)); 164 bitmap.reset(IconUtil::CreateSkBitmapFromHICON(icon.get(), icon_size));
163 EXPECT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL)); 165 EXPECT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL));
164 ::DestroyIcon(icon);
165 } 166 }
166 167
167 // The following test case makes sure IconUtil::CreateHICONFromSkBitmap fails 168 // The following test case makes sure IconUtil::CreateHICONFromSkBitmap fails
168 // gracefully when called with invalid input parameters. 169 // gracefully when called with invalid input parameters.
169 TEST_F(IconUtilTest, TestBitmapToIconInvalidParameters) { 170 TEST_F(IconUtilTest, TestBitmapToIconInvalidParameters) {
170 HICON icon = NULL; 171 ScopedHICON icon;
171 scoped_ptr<SkBitmap> bitmap; 172 scoped_ptr<SkBitmap> bitmap;
172 173
173 // Wrong bitmap format. 174 // Wrong bitmap format.
174 bitmap.reset(new SkBitmap); 175 bitmap.reset(new SkBitmap);
175 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL)); 176 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL));
176 bitmap->setInfo(SkImageInfo::MakeA8(kSmallIconWidth, kSmallIconHeight)); 177 bitmap->setInfo(SkImageInfo::MakeA8(kSmallIconWidth, kSmallIconHeight));
177 icon = IconUtil::CreateHICONFromSkBitmap(*bitmap); 178 icon = IconUtil::CreateHICONFromSkBitmap(*bitmap).Pass();
178 EXPECT_EQ(icon, static_cast<HICON>(NULL)); 179 EXPECT_FALSE(icon.is_valid());
179 180
180 // Invalid bitmap size. 181 // Invalid bitmap size.
181 bitmap.reset(new SkBitmap); 182 bitmap.reset(new SkBitmap);
182 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL)); 183 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL));
183 bitmap->setInfo(SkImageInfo::MakeN32Premul(0, 0)); 184 bitmap->setInfo(SkImageInfo::MakeN32Premul(0, 0));
184 icon = IconUtil::CreateHICONFromSkBitmap(*bitmap); 185 icon = IconUtil::CreateHICONFromSkBitmap(*bitmap).Pass();
185 EXPECT_EQ(icon, static_cast<HICON>(NULL)); 186 EXPECT_FALSE(icon.is_valid());
186 187
187 // Valid bitmap configuration but no pixels allocated. 188 // Valid bitmap configuration but no pixels allocated.
188 bitmap.reset(new SkBitmap); 189 bitmap.reset(new SkBitmap);
189 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL)); 190 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL));
190 bitmap->setInfo(SkImageInfo::MakeN32Premul(kSmallIconWidth, 191 bitmap->setInfo(SkImageInfo::MakeN32Premul(kSmallIconWidth,
191 kSmallIconHeight)); 192 kSmallIconHeight));
192 icon = IconUtil::CreateHICONFromSkBitmap(*bitmap); 193 icon = IconUtil::CreateHICONFromSkBitmap(*bitmap).Pass();
193 EXPECT_TRUE(icon == NULL); 194 EXPECT_FALSE(icon.is_valid());
194 } 195 }
195 196
196 // The following test case makes sure IconUtil::CreateIconFileFromImageFamily 197 // The following test case makes sure IconUtil::CreateIconFileFromImageFamily
197 // fails gracefully when called with invalid input parameters. 198 // fails gracefully when called with invalid input parameters.
198 TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { 199 TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) {
199 scoped_ptr<SkBitmap> bitmap; 200 scoped_ptr<SkBitmap> bitmap;
200 gfx::ImageFamily image_family; 201 gfx::ImageFamily image_family;
201 base::FilePath valid_icon_filename = temp_directory_.path().AppendASCII( 202 base::FilePath valid_icon_filename = temp_directory_.path().AppendASCII(
202 kTempIconFilename); 203 kTempIconFilename);
203 base::FilePath invalid_icon_filename = temp_directory_.path().AppendASCII( 204 base::FilePath invalid_icon_filename = temp_directory_.path().AppendASCII(
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 EXPECT_FALSE(base::PathExists(icon_filename)); 267 EXPECT_FALSE(base::PathExists(icon_filename));
267 } 268 }
268 269
269 // This test case makes sure that when we load an icon from disk and convert 270 // This test case makes sure that when we load an icon from disk and convert
270 // the HICON into a bitmap, the bitmap has the expected format and dimensions. 271 // the HICON into a bitmap, the bitmap has the expected format and dimensions.
271 TEST_F(IconUtilTest, TestCreateSkBitmapFromHICON) { 272 TEST_F(IconUtilTest, TestCreateSkBitmapFromHICON) {
272 scoped_ptr<SkBitmap> bitmap; 273 scoped_ptr<SkBitmap> bitmap;
273 base::FilePath small_icon_filename = test_data_directory_.AppendASCII( 274 base::FilePath small_icon_filename = test_data_directory_.AppendASCII(
274 kSmallIconName); 275 kSmallIconName);
275 gfx::Size small_icon_size(kSmallIconWidth, kSmallIconHeight); 276 gfx::Size small_icon_size(kSmallIconWidth, kSmallIconHeight);
276 HICON small_icon = LoadIconFromFile(small_icon_filename, 277 ScopedHICON small_icon =
277 small_icon_size.width(), 278 LoadIconFromFile(small_icon_filename, small_icon_size.width(),
278 small_icon_size.height()); 279 small_icon_size.height())
279 ASSERT_NE(small_icon, static_cast<HICON>(NULL)); 280 .Pass();
280 bitmap.reset(IconUtil::CreateSkBitmapFromHICON(small_icon, small_icon_size)); 281 ASSERT_TRUE(small_icon.is_valid());
282 bitmap.reset(
283 IconUtil::CreateSkBitmapFromHICON(small_icon.get(), small_icon_size));
281 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL)); 284 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL));
282 EXPECT_EQ(bitmap->width(), small_icon_size.width()); 285 EXPECT_EQ(bitmap->width(), small_icon_size.width());
283 EXPECT_EQ(bitmap->height(), small_icon_size.height()); 286 EXPECT_EQ(bitmap->height(), small_icon_size.height());
284 EXPECT_EQ(bitmap->colorType(), kN32_SkColorType); 287 EXPECT_EQ(bitmap->colorType(), kN32_SkColorType);
285 ::DestroyIcon(small_icon);
286 288
287 base::FilePath large_icon_filename = test_data_directory_.AppendASCII( 289 base::FilePath large_icon_filename = test_data_directory_.AppendASCII(
288 kLargeIconName); 290 kLargeIconName);
289 gfx::Size large_icon_size(kLargeIconWidth, kLargeIconHeight); 291 gfx::Size large_icon_size(kLargeIconWidth, kLargeIconHeight);
290 HICON large_icon = LoadIconFromFile(large_icon_filename, 292 ScopedHICON large_icon =
291 large_icon_size.width(), 293 LoadIconFromFile(large_icon_filename, large_icon_size.width(),
292 large_icon_size.height()); 294 large_icon_size.height())
293 ASSERT_NE(large_icon, static_cast<HICON>(NULL)); 295 .Pass();
294 bitmap.reset(IconUtil::CreateSkBitmapFromHICON(large_icon, large_icon_size)); 296 ASSERT_TRUE(large_icon.is_valid());
297 bitmap.reset(
298 IconUtil::CreateSkBitmapFromHICON(large_icon.get(), large_icon_size));
295 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL)); 299 ASSERT_NE(bitmap.get(), static_cast<SkBitmap*>(NULL));
296 EXPECT_EQ(bitmap->width(), large_icon_size.width()); 300 EXPECT_EQ(bitmap->width(), large_icon_size.width());
297 EXPECT_EQ(bitmap->height(), large_icon_size.height()); 301 EXPECT_EQ(bitmap->height(), large_icon_size.height());
298 EXPECT_EQ(bitmap->colorType(), kN32_SkColorType); 302 EXPECT_EQ(bitmap->colorType(), kN32_SkColorType);
299 ::DestroyIcon(large_icon);
300 } 303 }
301 304
302 // This test case makes sure that when an HICON is created from an SkBitmap, 305 // This test case makes sure that when an HICON is created from an SkBitmap,
303 // the returned handle is valid and refers to an icon with the expected 306 // the returned handle is valid and refers to an icon with the expected
304 // dimensions color depth etc. 307 // dimensions color depth etc.
305 TEST_F(IconUtilTest, TestBasicCreateHICONFromSkBitmap) { 308 TEST_F(IconUtilTest, TestBasicCreateHICONFromSkBitmap) {
306 SkBitmap bitmap = CreateBlackSkBitmap(kSmallIconWidth, kSmallIconHeight); 309 SkBitmap bitmap = CreateBlackSkBitmap(kSmallIconWidth, kSmallIconHeight);
307 HICON icon = IconUtil::CreateHICONFromSkBitmap(bitmap); 310 ScopedHICON icon = IconUtil::CreateHICONFromSkBitmap(bitmap).Pass();
grt (UTC plus 2) 2015/11/10 16:44:43 ScopedHICON icon(IconUtil::CreateHICONFromSkBitmap
308 EXPECT_NE(icon, static_cast<HICON>(NULL)); 311 EXPECT_TRUE(icon.is_valid());
309 ICONINFO icon_info; 312 ICONINFO icon_info;
310 ASSERT_TRUE(::GetIconInfo(icon, &icon_info)); 313 ASSERT_TRUE(GetIconInfo(icon.get(), &icon_info));
311 EXPECT_TRUE(icon_info.fIcon); 314 EXPECT_TRUE(icon_info.fIcon);
312 315
313 // Now that have the icon information, we should obtain the specification of 316 // Now that have the icon information, we should obtain the specification of
314 // the icon's bitmap and make sure it matches the specification of the 317 // the icon's bitmap and make sure it matches the specification of the
315 // SkBitmap we started with. 318 // SkBitmap we started with.
316 // 319 //
317 // The bitmap handle contained in the icon information is a handle to a 320 // The bitmap handle contained in the icon information is a handle to a
318 // compatible bitmap so we need to call ::GetDIBits() in order to retrieve 321 // compatible bitmap so we need to call ::GetDIBits() in order to retrieve
319 // the bitmap's header information. 322 // the bitmap's header information.
320 BITMAPINFO bitmap_info; 323 BITMAPINFO bitmap_info;
321 ::ZeroMemory(&bitmap_info, sizeof(BITMAPINFO)); 324 ::ZeroMemory(&bitmap_info, sizeof(BITMAPINFO));
322 bitmap_info.bmiHeader.biSize = sizeof(BITMAPINFO); 325 bitmap_info.bmiHeader.biSize = sizeof(BITMAPINFO);
323 HDC hdc = ::GetDC(NULL); 326 HDC hdc = ::GetDC(NULL);
324 int result = ::GetDIBits(hdc, 327 int result = ::GetDIBits(hdc,
325 icon_info.hbmColor, 328 icon_info.hbmColor,
326 0, 329 0,
327 kSmallIconWidth, 330 kSmallIconWidth,
328 NULL, 331 NULL,
329 &bitmap_info, 332 &bitmap_info,
330 DIB_RGB_COLORS); 333 DIB_RGB_COLORS);
331 ASSERT_GT(result, 0); 334 ASSERT_GT(result, 0);
332 EXPECT_EQ(bitmap_info.bmiHeader.biWidth, kSmallIconWidth); 335 EXPECT_EQ(bitmap_info.bmiHeader.biWidth, kSmallIconWidth);
333 EXPECT_EQ(bitmap_info.bmiHeader.biHeight, kSmallIconHeight); 336 EXPECT_EQ(bitmap_info.bmiHeader.biHeight, kSmallIconHeight);
334 EXPECT_EQ(bitmap_info.bmiHeader.biPlanes, 1); 337 EXPECT_EQ(bitmap_info.bmiHeader.biPlanes, 1);
335 EXPECT_EQ(bitmap_info.bmiHeader.biBitCount, 32); 338 EXPECT_EQ(bitmap_info.bmiHeader.biBitCount, 32);
336 ::ReleaseDC(NULL, hdc); 339 ::ReleaseDC(NULL, hdc);
337 ::DestroyIcon(icon);
338 } 340 }
339 341
340 // This test case makes sure that CreateIconFileFromImageFamily creates a 342 // This test case makes sure that CreateIconFileFromImageFamily creates a
341 // valid .ico file given an ImageFamily, and appropriately creates all icon 343 // valid .ico file given an ImageFamily, and appropriately creates all icon
342 // sizes from the given input. 344 // sizes from the given input.
343 TEST_F(IconUtilTest, TestCreateIconFileFromImageFamily) { 345 TEST_F(IconUtilTest, TestCreateIconFileFromImageFamily) {
344 gfx::ImageFamily image_family; 346 gfx::ImageFamily image_family;
345 base::FilePath icon_filename = 347 base::FilePath icon_filename =
346 temp_directory_.path().AppendASCII(kTempIconFilename); 348 temp_directory_.path().AppendASCII(kTempIconFilename);
347 349
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 425 }
424 426
425 // This tests that kNumIconDimensionsUpToMediumSize has the correct value. 427 // This tests that kNumIconDimensionsUpToMediumSize has the correct value.
426 TEST_F(IconUtilTest, TestNumIconDimensionsUpToMediumSize) { 428 TEST_F(IconUtilTest, TestNumIconDimensionsUpToMediumSize) {
427 ASSERT_LE(IconUtil::kNumIconDimensionsUpToMediumSize, 429 ASSERT_LE(IconUtil::kNumIconDimensionsUpToMediumSize,
428 IconUtil::kNumIconDimensions); 430 IconUtil::kNumIconDimensions);
429 EXPECT_EQ(IconUtil::kMediumIconSize, 431 EXPECT_EQ(IconUtil::kMediumIconSize,
430 IconUtil::kIconDimensions[ 432 IconUtil::kIconDimensions[
431 IconUtil::kNumIconDimensionsUpToMediumSize - 1]); 433 IconUtil::kNumIconDimensionsUpToMediumSize - 1]);
432 } 434 }
OLDNEW
« ui/gfx/icon_util.cc ('K') | « ui/gfx/icon_util.cc ('k') | ui/gfx/path_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698