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); | 534 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); |
535 | 535 |
536 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); | 536 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); |
537 base::FilePath path_1 = GetProfilePath("path_1"); | 537 base::FilePath path_1 = GetProfilePath("path_1"); |
538 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), | 538 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), |
539 base::string16(), 0, std::string()); | 539 base::string16(), 0, std::string()); |
540 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); | 540 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); |
541 | 541 |
542 // We haven't downloaded any high-res avatars yet. | 542 // We haven't downloaded any high-res avatars yet. |
543 EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size()); | 543 EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size()); |
544 | 544 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 base::RunLoop().RunUntilIdle(); | 576 base::RunLoop().RunUntilIdle(); |
577 | 577 |
578 // Clean up. | 578 // Clean up. |
579 base::FilePath icon_path = | 579 base::FilePath icon_path = |
580 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); | 580 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); |
581 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); | 581 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); |
582 EXPECT_TRUE(base::PathExists(icon_path)); | 582 EXPECT_TRUE(base::PathExists(icon_path)); |
583 EXPECT_TRUE(base::DeleteFile(icon_path, true)); | 583 EXPECT_TRUE(base::DeleteFile(icon_path, true)); |
584 EXPECT_FALSE(base::PathExists(icon_path)); | 584 EXPECT_FALSE(base::PathExists(icon_path)); |
585 } | 585 } |
OLD | NEW |