| 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 525 } |
| 526 | 526 |
| 527 ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); | 527 ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); |
| 528 | 528 |
| 529 // Check that the profiles can be extracted from the local state. | 529 // Check that the profiles can be extracted from the local state. |
| 530 std::vector<base::string16> names = ProfileInfoCache::GetProfileNames(); | 530 std::vector<base::string16> names = ProfileInfoCache::GetProfileNames(); |
| 531 for (size_t i = 0; i < 4; i++) | 531 for (size_t i = 0; i < 4; i++) |
| 532 ASSERT_FALSE(names[i].empty()); | 532 ASSERT_FALSE(names[i].empty()); |
| 533 } | 533 } |
| 534 | 534 |
| 535 // High res avatar downloading is only supported on desktop. |
| 536 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) |
| 535 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { | 537 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { |
| 536 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); | 538 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); |
| 537 | 539 |
| 538 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); | 540 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); |
| 539 base::FilePath path_1 = GetProfilePath("path_1"); | 541 base::FilePath path_1 = GetProfilePath("path_1"); |
| 540 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), | 542 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), |
| 541 base::string16(), 0, std::string()); | 543 base::string16(), 0, std::string()); |
| 542 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); | 544 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); |
| 543 | 545 |
| 544 // We haven't downloaded any high-res avatars yet. | 546 // We haven't downloaded any high-res avatars yet. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 base::RunLoop().RunUntilIdle(); | 580 base::RunLoop().RunUntilIdle(); |
| 579 | 581 |
| 580 // Clean up. | 582 // Clean up. |
| 581 base::FilePath icon_path = | 583 base::FilePath icon_path = |
| 582 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); | 584 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); |
| 583 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); | 585 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); |
| 584 EXPECT_TRUE(base::PathExists(icon_path)); | 586 EXPECT_TRUE(base::PathExists(icon_path)); |
| 585 EXPECT_TRUE(base::DeleteFile(icon_path, true)); | 587 EXPECT_TRUE(base::DeleteFile(icon_path, true)); |
| 586 EXPECT_FALSE(base::PathExists(icon_path)); | 588 EXPECT_FALSE(base::PathExists(icon_path)); |
| 587 } | 589 } |
| 590 #endif |
| OLD | NEW |