OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/profiles/profile_info_util.h" |
| 6 |
| 7 #include "grit/generated_resources.h" |
| 8 #include "grit/theme_resources.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/image/image_unittest_util.h" |
| 12 |
| 13 namespace { |
| 14 |
| 15 TEST(ProfileInfoUtilTest, MenuIcon) { |
| 16 // Test that an avatar icon isn't changed. |
| 17 const gfx::Image& profile_image( |
| 18 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); |
| 19 gfx::Image result = profiles::GetAvatarIconForMenu(profile_image, false); |
| 20 EXPECT_FALSE(gfx::test::IsEmpty(result)); |
| 21 EXPECT_TRUE(gfx::test::IsEqual(profile_image, result)); |
| 22 |
| 23 // Test that a GAIA picture is changed. |
| 24 gfx::Image gaia_picture(gfx::test::CreateImage()); |
| 25 gfx::Image result2 = profiles::GetAvatarIconForMenu(gaia_picture, true); |
| 26 EXPECT_FALSE(gfx::test::IsEmpty(result2)); |
| 27 EXPECT_FALSE(gfx::test::IsEqual(gaia_picture, result2)); |
| 28 } |
| 29 |
| 30 TEST(ProfileInfoUtilTest, TitleBarIcon) { |
| 31 // Test that an avatar icon isn't changed. |
| 32 const gfx::Image& profile_image( |
| 33 ResourceBundle::GetSharedInstance().GetImageNamed(IDR_PROFILE_AVATAR_0)); |
| 34 gfx::Image result = profiles::GetAvatarIconForTitleBar( |
| 35 profile_image, false, 100, 40); |
| 36 EXPECT_FALSE(gfx::test::IsEmpty(result)); |
| 37 EXPECT_TRUE(gfx::test::IsEqual(profile_image, result)); |
| 38 |
| 39 // Test that a GAIA picture is changed. |
| 40 gfx::Image gaia_picture(gfx::test::CreateImage()); |
| 41 gfx::Image result2 = profiles::GetAvatarIconForTitleBar( |
| 42 gaia_picture, true, 100, 40); |
| 43 EXPECT_FALSE(gfx::test::IsEmpty(result2)); |
| 44 EXPECT_FALSE(gfx::test::IsEqual(gaia_picture, result2)); |
| 45 } |
| 46 |
| 47 } // namespace |
OLD | NEW |