OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/profiles/profile_avatar_icon_util.h" | 5 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
6 | 6 |
7 #include "grit/generated_resources.h" | 7 #include "grit/generated_resources.h" |
8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 canvas2.DrawImageInt(image_skia, 15, 10); | 32 canvas2.DrawImageInt(image_skia, 15, 10); |
33 EXPECT_TRUE(image.ToImageSkia()->HasRepresentation(2.0f)); | 33 EXPECT_TRUE(image.ToImageSkia()->HasRepresentation(2.0f)); |
34 } | 34 } |
35 | 35 |
36 TEST(ProfileInfoUtilTest, SizedMenuIcon) { | 36 TEST(ProfileInfoUtilTest, SizedMenuIcon) { |
37 // Test that an avatar icon isn't changed. | 37 // Test that an avatar icon isn't changed. |
38 const gfx::Image& profile_image( | 38 const gfx::Image& profile_image( |
39 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); | 39 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); |
40 gfx::Image result = | 40 gfx::Image result = |
41 profiles::GetSizedAvatarIconWithBorder(profile_image, false, 50, 50); | 41 profiles::GetSizedAvatarIcon(profile_image, false, 50, 50); |
42 | 42 |
43 EXPECT_FALSE(gfx::test::IsEmpty(result)); | 43 EXPECT_FALSE(gfx::test::IsEmpty(result)); |
44 EXPECT_TRUE(gfx::test::IsEqual(profile_image, result)); | 44 EXPECT_TRUE(gfx::test::IsEqual(profile_image, result)); |
45 | 45 |
46 // Test that a rectangular picture (e.g., GAIA image) is changed. | 46 // Test that a rectangular picture (e.g., GAIA image) is changed. |
47 gfx::Image rect_picture(gfx::test::CreateImage()); | 47 gfx::Image rect_picture(gfx::test::CreateImage()); |
48 | 48 |
49 gfx::Size size(30, 20); | 49 gfx::Size size(30, 20); |
50 gfx::Image result2 = | 50 gfx::Image result2 = profiles::GetSizedAvatarIcon( |
51 profiles::GetSizedAvatarIconWithBorder( | 51 rect_picture, true, size.width(), size.height()); |
52 rect_picture, true, size.width(), size.height()); | |
53 | 52 |
54 VerifyScaling(result2, size); | 53 VerifyScaling(result2, size); |
55 } | 54 } |
56 | 55 |
57 TEST(ProfileInfoUtilTest, MenuIcon) { | 56 TEST(ProfileInfoUtilTest, MenuIcon) { |
58 // Test that an avatar icon isn't changed. | 57 // Test that an avatar icon isn't changed. |
59 const gfx::Image& profile_image( | 58 const gfx::Image& profile_image( |
60 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); | 59 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); |
61 gfx::Image result = profiles::GetAvatarIconForMenu(profile_image, false); | 60 gfx::Image result = profiles::GetAvatarIconForMenu(profile_image, false); |
62 EXPECT_FALSE(gfx::test::IsEmpty(result)); | 61 EXPECT_FALSE(gfx::test::IsEmpty(result)); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 gfx::Image rect_picture(gfx::test::CreateImage()); | 101 gfx::Image rect_picture(gfx::test::CreateImage()); |
103 | 102 |
104 gfx::Size size(width, height); | 103 gfx::Size size(width, height); |
105 gfx::Image result2 = profiles::GetAvatarIconForTitleBar( | 104 gfx::Image result2 = profiles::GetAvatarIconForTitleBar( |
106 rect_picture, true, width, height); | 105 rect_picture, true, width, height); |
107 | 106 |
108 VerifyScaling(result2, size); | 107 VerifyScaling(result2, size); |
109 } | 108 } |
110 | 109 |
111 } // namespace | 110 } // namespace |
OLD | NEW |