OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/scoped_ptr.h" | 5 #include "base/scoped_ptr.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "gfx/gfx_paths.h" | 8 #include "gfx/gfx_paths.h" |
9 #include "gfx/icon_util.h" | 9 #include "gfx/icon_util.h" |
10 #include "gfx/size.h" | 10 #include "gfx/size.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 height, | 42 height, |
43 LR_LOADTRANSPARENT | LR_LOADFROMFILE)); | 43 LR_LOADTRANSPARENT | LR_LOADFROMFILE)); |
44 return icon; | 44 return icon; |
45 } | 45 } |
46 | 46 |
47 protected: | 47 protected: |
48 // The root directory for test files. | 48 // The root directory for test files. |
49 std::wstring test_data_directory_; | 49 std::wstring test_data_directory_; |
50 | 50 |
51 private: | 51 private: |
52 DISALLOW_EVIL_CONSTRUCTORS(IconUtilTest); | 52 DISALLOW_COPY_AND_ASSIGN(IconUtilTest); |
53 }; | 53 }; |
54 }; | 54 }; |
55 | 55 |
56 // The following test case makes sure IconUtil::SkBitmapFromHICON fails | 56 // The following test case makes sure IconUtil::SkBitmapFromHICON fails |
57 // gracefully when called with invalid input parameters. | 57 // gracefully when called with invalid input parameters. |
58 TEST_F(IconUtilTest, TestIconToBitmapInvalidParameters) { | 58 TEST_F(IconUtilTest, TestIconToBitmapInvalidParameters) { |
59 std::wstring icon_filename(test_data_directory_); | 59 std::wstring icon_filename(test_data_directory_); |
60 file_util::AppendToPath(&icon_filename, kSmallIconName); | 60 file_util::AppendToPath(&icon_filename, kSmallIconName); |
61 gfx::Size icon_size(kSmallIconWidth, kSmallIconHeight); | 61 gfx::Size icon_size(kSmallIconWidth, kSmallIconHeight); |
62 HICON icon = LoadIconFromFile(icon_filename, | 62 HICON icon = LoadIconFromFile(icon_filename, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // the .ico file we just created. We don't really check the additional icon | 251 // the .ico file we just created. We don't really check the additional icon |
252 // images created by IconUtil::CreateIconFileFromSkBitmap. | 252 // images created by IconUtil::CreateIconFileFromSkBitmap. |
253 HICON icon = LoadIconFromFile(icon_filename, | 253 HICON icon = LoadIconFromFile(icon_filename, |
254 kSmallIconWidth, | 254 kSmallIconWidth, |
255 kSmallIconHeight); | 255 kSmallIconHeight); |
256 EXPECT_NE(icon, static_cast<HICON>(NULL)); | 256 EXPECT_NE(icon, static_cast<HICON>(NULL)); |
257 if (icon != NULL) { | 257 if (icon != NULL) { |
258 ::DestroyIcon(icon); | 258 ::DestroyIcon(icon); |
259 } | 259 } |
260 } | 260 } |
OLD | NEW |