OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_info_cache_unittest.h" | 5 #include "chrome/browser/profiles/profile_info_cache_unittest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 EXPECT_EQ(NULL, GetCache()->GetGAIAPictureOfProfileAtIndex(0)); | 375 EXPECT_EQ(NULL, GetCache()->GetGAIAPictureOfProfileAtIndex(0)); |
376 EXPECT_TRUE(gfx::test::IsEqual( | 376 EXPECT_TRUE(gfx::test::IsEqual( |
377 gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(1))); | 377 gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(1))); |
378 // Since we're still using the default avatar, the GAIA image should be | 378 // Since we're still using the default avatar, the GAIA image should be |
379 // preferred over the generic avatar image. | 379 // preferred over the generic avatar image. |
380 EXPECT_TRUE(GetCache()->ProfileIsUsingDefaultAvatarAtIndex(1)); | 380 EXPECT_TRUE(GetCache()->ProfileIsUsingDefaultAvatarAtIndex(1)); |
381 EXPECT_TRUE(GetCache()->IsUsingGAIAPictureOfProfileAtIndex(1)); | 381 EXPECT_TRUE(GetCache()->IsUsingGAIAPictureOfProfileAtIndex(1)); |
382 EXPECT_TRUE(gfx::test::IsEqual( | 382 EXPECT_TRUE(gfx::test::IsEqual( |
383 gaia_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); | 383 gaia_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); |
384 | 384 |
385 // Set another avatar. This should make it preferred over the GAIA image. | 385 // Set a non-default avatar. This should be preferred over the GAIA image. |
386 GetCache()->SetAvatarIconOfProfileAtIndex(1, kOtherAvatarIndex); | 386 GetCache()->SetAvatarIconOfProfileAtIndex(1, kOtherAvatarIndex); |
| 387 GetCache()->SetProfileIsUsingDefaultAvatarAtIndex(1, false); |
387 EXPECT_FALSE(GetCache()->ProfileIsUsingDefaultAvatarAtIndex(1)); | 388 EXPECT_FALSE(GetCache()->ProfileIsUsingDefaultAvatarAtIndex(1)); |
388 EXPECT_FALSE(GetCache()->IsUsingGAIAPictureOfProfileAtIndex(1)); | 389 EXPECT_FALSE(GetCache()->IsUsingGAIAPictureOfProfileAtIndex(1)); |
389 int other_avatar_id = | 390 int other_avatar_id = |
390 profiles::GetDefaultAvatarIconResourceIDAtIndex(kOtherAvatarIndex); | 391 profiles::GetDefaultAvatarIconResourceIDAtIndex(kOtherAvatarIndex); |
391 const gfx::Image& other_avatar_image( | 392 const gfx::Image& other_avatar_image( |
392 ResourceBundle::GetSharedInstance().GetImageNamed(other_avatar_id)); | 393 ResourceBundle::GetSharedInstance().GetImageNamed(other_avatar_id)); |
393 EXPECT_TRUE(gfx::test::IsEqual( | 394 EXPECT_TRUE(gfx::test::IsEqual( |
394 other_avatar_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); | 395 other_avatar_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); |
395 | 396 |
396 // Explicitly setting the GAIA picture should make it preferred again. | 397 // Explicitly setting the GAIA picture should make it preferred again. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 base::RunLoop().RunUntilIdle(); | 579 base::RunLoop().RunUntilIdle(); |
579 | 580 |
580 // Clean up. | 581 // Clean up. |
581 base::FilePath icon_path = | 582 base::FilePath icon_path = |
582 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); | 583 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); |
583 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); | 584 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); |
584 EXPECT_TRUE(base::PathExists(icon_path)); | 585 EXPECT_TRUE(base::PathExists(icon_path)); |
585 EXPECT_TRUE(base::DeleteFile(icon_path, true)); | 586 EXPECT_TRUE(base::DeleteFile(icon_path, true)); |
586 EXPECT_FALSE(base::PathExists(icon_path)); | 587 EXPECT_FALSE(base::PathExists(icon_path)); |
587 } | 588 } |
OLD | NEW |