| 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/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 EXPECT_TRUE(profile_info_cache.GetHighResAvatarOfProfileAtIndex(0)); | 602 EXPECT_TRUE(profile_info_cache.GetHighResAvatarOfProfileAtIndex(0)); |
| 603 EXPECT_EQ(profile_info_cache.cached_avatar_images_[file_name], | 603 EXPECT_EQ(profile_info_cache.cached_avatar_images_[file_name], |
| 604 profile_info_cache.GetHighResAvatarOfProfileAtIndex(0)); | 604 profile_info_cache.GetHighResAvatarOfProfileAtIndex(0)); |
| 605 | 605 |
| 606 // Make sure everything has completed, and the file has been written to disk. | 606 // Make sure everything has completed, and the file has been written to disk. |
| 607 base::RunLoop().RunUntilIdle(); | 607 base::RunLoop().RunUntilIdle(); |
| 608 | 608 |
| 609 // Clean up. | 609 // Clean up. |
| 610 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); | 610 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); |
| 611 EXPECT_TRUE(base::PathExists(icon_path)); | 611 EXPECT_TRUE(base::PathExists(icon_path)); |
| 612 EXPECT_TRUE(base::DeleteFile(icon_path, true)); | 612 EXPECT_TRUE(base::DeleteFile(icon_path, false)); |
| 613 EXPECT_FALSE(base::PathExists(icon_path)); | 613 EXPECT_FALSE(base::PathExists(icon_path)); |
| 614 } | 614 } |
| 615 | 615 |
| 616 TEST_F(ProfileInfoCacheTest, NothingToDownloadHighResAvatarTest) { | 616 TEST_F(ProfileInfoCacheTest, NothingToDownloadHighResAvatarTest) { |
| 617 // The TestingProfileManager's ProfileInfoCache doesn't download avatars. | 617 // The TestingProfileManager's ProfileInfoCache doesn't download avatars. |
| 618 ProfileInfoCache profile_info_cache( | 618 ProfileInfoCache profile_info_cache( |
| 619 g_browser_process->local_state(), | 619 g_browser_process->local_state(), |
| 620 testing_profile_manager_.profile_manager()->user_data_dir()); | 620 testing_profile_manager_.profile_manager()->user_data_dir()); |
| 621 | 621 |
| 622 const size_t kIconIndex = profiles::GetPlaceholderAvatarIndex(); | 622 const size_t kIconIndex = profiles::GetPlaceholderAvatarIndex(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( | 718 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( |
| 719 GetCache()->GetIndexOfProfileWithPath(path_1))); | 719 GetCache()->GetIndexOfProfileWithPath(path_1))); |
| 720 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( | 720 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( |
| 721 GetCache()->GetIndexOfProfileWithPath(path_2))); | 721 GetCache()->GetIndexOfProfileWithPath(path_2))); |
| 722 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( | 722 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( |
| 723 GetCache()->GetIndexOfProfileWithPath(path_3))); | 723 GetCache()->GetIndexOfProfileWithPath(path_3))); |
| 724 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( | 724 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( |
| 725 GetCache()->GetIndexOfProfileWithPath(path_4))); | 725 GetCache()->GetIndexOfProfileWithPath(path_4))); |
| 726 } | 726 } |
| 727 #endif | 727 #endif |
| OLD | NEW |