| 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 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 | 524 |
| 525 ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); | 525 ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); |
| 526 | 526 |
| 527 // Check that the profiles can be extracted from the local state. | 527 // Check that the profiles can be extracted from the local state. |
| 528 std::vector<base::string16> names = ProfileInfoCache::GetProfileNames(); | 528 std::vector<base::string16> names = ProfileInfoCache::GetProfileNames(); |
| 529 for (size_t i = 0; i < 4; i++) | 529 for (size_t i = 0; i < 4; i++) |
| 530 ASSERT_FALSE(names[i].empty()); | 530 ASSERT_FALSE(names[i].empty()); |
| 531 } | 531 } |
| 532 | 532 |
| 533 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { | 533 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { |
| 534 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kNewAvatarMenu); | |
| 535 | |
| 536 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); | 534 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); |
| 537 base::FilePath path_1 = GetProfilePath("path_1"); | 535 base::FilePath path_1 = GetProfilePath("path_1"); |
| 538 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), | 536 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), |
| 539 base::string16(), 0, std::string()); | 537 base::string16(), 0, std::string()); |
| 540 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); | 538 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); |
| 541 | 539 |
| 542 // We haven't downloaded any high-res avatars yet. | 540 // We haven't downloaded any high-res avatars yet. |
| 543 EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size()); | 541 EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size()); |
| 544 | 542 |
| 545 // After adding a new profile, the download of high-res avatar will be | 543 // After adding a new profile, the download of high-res avatar will be |
| (...skipping 30 matching lines...) Expand all Loading... |
| 576 base::RunLoop().RunUntilIdle(); | 574 base::RunLoop().RunUntilIdle(); |
| 577 | 575 |
| 578 // Clean up. | 576 // Clean up. |
| 579 base::FilePath icon_path = | 577 base::FilePath icon_path = |
| 580 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); | 578 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); |
| 581 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); | 579 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); |
| 582 EXPECT_TRUE(base::PathExists(icon_path)); | 580 EXPECT_TRUE(base::PathExists(icon_path)); |
| 583 EXPECT_TRUE(base::DeleteFile(icon_path, true)); | 581 EXPECT_TRUE(base::DeleteFile(icon_path, true)); |
| 584 EXPECT_FALSE(base::PathExists(icon_path)); | 582 EXPECT_FALSE(base::PathExists(icon_path)); |
| 585 } | 583 } |
| OLD | NEW |