OLD | NEW |
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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 static const char kLargeIconName[] = "icon_util/128_X_128_icon.ico"; | 22 static const char kLargeIconName[] = "icon_util/128_X_128_icon.ico"; |
23 static const char kTempIconFilename[] = "temp_test_icon.ico"; | 23 static const char kTempIconFilename[] = "temp_test_icon.ico"; |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 class IconUtilTest : public testing::Test { | 27 class IconUtilTest : public testing::Test { |
28 public: | 28 public: |
29 void SetUp() override { | 29 void SetUp() override { |
30 gfx::RegisterPathProvider(); | 30 gfx::RegisterPathProvider(); |
31 ASSERT_TRUE(PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_)); | 31 ASSERT_TRUE(PathService::Get(gfx::DIR_TEST_DATA, &test_data_directory_)); |
32 temp_directory_.CreateUniqueTempDir(); | 32 ASSERT_TRUE(temp_directory_.CreateUniqueTempDir()); |
33 } | 33 } |
34 | 34 |
35 static const int kSmallIconWidth = 16; | 35 static const int kSmallIconWidth = 16; |
36 static const int kSmallIconHeight = 16; | 36 static const int kSmallIconHeight = 16; |
37 static const int kLargeIconWidth = 128; | 37 static const int kLargeIconWidth = 128; |
38 static const int kLargeIconHeight = 128; | 38 static const int kLargeIconHeight = 128; |
39 | 39 |
40 // Given a file name for an .ico file and an image dimensions, this | 40 // Given a file name for an .ico file and an image dimensions, this |
41 // function loads the icon and returns an HICON handle. | 41 // function loads the icon and returns an HICON handle. |
42 HICON LoadIconFromFile(const base::FilePath& filename, | 42 HICON LoadIconFromFile(const base::FilePath& filename, |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 } | 423 } |
424 | 424 |
425 // This tests that kNumIconDimensionsUpToMediumSize has the correct value. | 425 // This tests that kNumIconDimensionsUpToMediumSize has the correct value. |
426 TEST_F(IconUtilTest, TestNumIconDimensionsUpToMediumSize) { | 426 TEST_F(IconUtilTest, TestNumIconDimensionsUpToMediumSize) { |
427 ASSERT_LE(IconUtil::kNumIconDimensionsUpToMediumSize, | 427 ASSERT_LE(IconUtil::kNumIconDimensionsUpToMediumSize, |
428 IconUtil::kNumIconDimensions); | 428 IconUtil::kNumIconDimensions); |
429 EXPECT_EQ(IconUtil::kMediumIconSize, | 429 EXPECT_EQ(IconUtil::kMediumIconSize, |
430 IconUtil::kIconDimensions[ | 430 IconUtil::kIconDimensions[ |
431 IconUtil::kNumIconDimensionsUpToMediumSize - 1]); | 431 IconUtil::kNumIconDimensionsUpToMediumSize - 1]); |
432 } | 432 } |
OLD | NEW |