Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: chrome/browser/profiles/profile_info_cache_unittest.cc

Issue 1307093004: Remove references to IsNewAvatarMenu since the flag was removed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 names.push_back(name); 544 names.push_back(name);
545 } 545 }
546 546
547 for (size_t i = 0; i < 4; i++) 547 for (size_t i = 0; i < 4; i++)
548 ASSERT_FALSE(names[i].empty()); 548 ASSERT_FALSE(names[i].empty());
549 } 549 }
550 550
551 // High res avatar downloading is only supported on desktop. 551 // High res avatar downloading is only supported on desktop.
552 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) 552 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
553 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { 553 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) {
554 switches::EnableNewAvatarMenuForTesting(
555 base::CommandLine::ForCurrentProcess());
556
557 // The TestingProfileManager's ProfileInfoCache doesn't download avatars. 554 // The TestingProfileManager's ProfileInfoCache doesn't download avatars.
558 ProfileInfoCache profile_info_cache(g_browser_process->local_state(), 555 ProfileInfoCache profile_info_cache(g_browser_process->local_state(),
559 testing_profile_manager_.profile_manager()->user_data_dir()); 556 testing_profile_manager_.profile_manager()->user_data_dir());
560 557
561 // Make sure there are no avatars already on disk. 558 // Make sure there are no avatars already on disk.
562 const size_t kIconIndex = 0; 559 const size_t kIconIndex = 0;
563 base::FilePath icon_path = 560 base::FilePath icon_path =
564 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex); 561 profiles::GetPathOfHighResAvatarAtIndex(kIconIndex);
565 EXPECT_FALSE(base::PathExists(icon_path)); 562 EXPECT_FALSE(base::PathExists(icon_path));
566 563
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 base::RunLoop().RunUntilIdle(); 607 base::RunLoop().RunUntilIdle();
611 608
612 // Clean up. 609 // Clean up.
613 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name)); 610 EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name));
614 EXPECT_TRUE(base::PathExists(icon_path)); 611 EXPECT_TRUE(base::PathExists(icon_path));
615 EXPECT_TRUE(base::DeleteFile(icon_path, true)); 612 EXPECT_TRUE(base::DeleteFile(icon_path, true));
616 EXPECT_FALSE(base::PathExists(icon_path)); 613 EXPECT_FALSE(base::PathExists(icon_path));
617 } 614 }
618 615
619 TEST_F(ProfileInfoCacheTest, NothingToDownloadHighResAvatarTest) { 616 TEST_F(ProfileInfoCacheTest, NothingToDownloadHighResAvatarTest) {
620 switches::EnableNewAvatarMenuForTesting(
621 base::CommandLine::ForCurrentProcess());
622
623 // The TestingProfileManager's ProfileInfoCache doesn't download avatars. 617 // The TestingProfileManager's ProfileInfoCache doesn't download avatars.
624 ProfileInfoCache profile_info_cache( 618 ProfileInfoCache profile_info_cache(
625 g_browser_process->local_state(), 619 g_browser_process->local_state(),
626 testing_profile_manager_.profile_manager()->user_data_dir()); 620 testing_profile_manager_.profile_manager()->user_data_dir());
627 621
628 const size_t kIconIndex = profiles::GetPlaceholderAvatarIndex(); 622 const size_t kIconIndex = profiles::GetPlaceholderAvatarIndex();
629 623
630 EXPECT_EQ(0U, profile_info_cache.GetNumberOfProfiles()); 624 EXPECT_EQ(0U, profile_info_cache.GetNumberOfProfiles());
631 base::FilePath path_1 = GetProfilePath("path_1"); 625 base::FilePath path_1 = GetProfilePath("path_1");
632 profile_info_cache.AddProfileToCache(path_1, ASCIIToUTF16("name_1"), 626 profile_info_cache.AddProfileToCache(path_1, ASCIIToUTF16("name_1"),
633 std::string(), base::string16(), 627 std::string(), base::string16(),
634 kIconIndex, std::string()); 628 kIconIndex, std::string());
635 EXPECT_EQ(1U, profile_info_cache.GetNumberOfProfiles()); 629 EXPECT_EQ(1U, profile_info_cache.GetNumberOfProfiles());
636 base::RunLoop().RunUntilIdle(); 630 base::RunLoop().RunUntilIdle();
637 631
638 // We haven't tried to download any high-res avatars as the specified icon is 632 // We haven't tried to download any high-res avatars as the specified icon is
639 // just a placeholder. 633 // just a placeholder.
640 EXPECT_EQ(0U, profile_info_cache.cached_avatar_images_.size()); 634 EXPECT_EQ(0U, profile_info_cache.cached_avatar_images_.size());
641 EXPECT_EQ(0U, profile_info_cache.avatar_images_downloads_in_progress_.size()); 635 EXPECT_EQ(0U, profile_info_cache.avatar_images_downloads_in_progress_.size());
642 } 636 }
643 637
644 TEST_F(ProfileInfoCacheTest, MigrateLegacyProfileNamesWithNewAvatarMenu) { 638 TEST_F(ProfileInfoCacheTest, MigrateLegacyProfileNamesWithNewAvatarMenu) {
645 switches::EnableNewAvatarMenuForTesting(
646 base::CommandLine::ForCurrentProcess());
647 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); 639 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles());
648 640
649 base::FilePath path_1 = GetProfilePath("path_1"); 641 base::FilePath path_1 = GetProfilePath("path_1");
650 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("Default Profile"), 642 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("Default Profile"),
651 std::string(), base::string16(), 0, 643 std::string(), base::string16(), 0,
652 std::string()); 644 std::string());
653 base::FilePath path_2 = GetProfilePath("path_2"); 645 base::FilePath path_2 = GetProfilePath("path_2");
654 GetCache()->AddProfileToCache(path_2, ASCIIToUTF16("First user"), 646 GetCache()->AddProfileToCache(path_2, ASCIIToUTF16("First user"),
655 std::string(), base::string16(), 1, 647 std::string(), base::string16(), 1,
656 std::string()); 648 std::string());
(...skipping 29 matching lines...) Expand all
686 // default cartoon profile names. 678 // default cartoon profile names.
687 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( 679 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex(
688 GetCache()->GetIndexOfProfileWithPath(path_3))); 680 GetCache()->GetIndexOfProfileWithPath(path_3)));
689 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( 681 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex(
690 GetCache()->GetIndexOfProfileWithPath(path_4))); 682 GetCache()->GetIndexOfProfileWithPath(path_4)));
691 EXPECT_EQ(name_5, GetCache()->GetNameOfProfileAtIndex( 683 EXPECT_EQ(name_5, GetCache()->GetNameOfProfileAtIndex(
692 GetCache()->GetIndexOfProfileWithPath(path_5))); 684 GetCache()->GetIndexOfProfileWithPath(path_5)));
693 } 685 }
694 #endif 686 #endif
695 687
688 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_IOS)
696 TEST_F(ProfileInfoCacheTest, 689 TEST_F(ProfileInfoCacheTest,
697 DontMigrateLegacyProfileNamesWithoutNewAvatarMenu) { 690 DontMigrateLegacyProfileNamesWithoutNewAvatarMenu) {
698 switches::DisableNewAvatarMenuForTesting(
699 base::CommandLine::ForCurrentProcess());
700
701 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); 691 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles());
702 692
703 base::string16 name_1 = ASCIIToUTF16("Default Profile"); 693 base::string16 name_1 = ASCIIToUTF16("Default Profile");
704 base::FilePath path_1 = GetProfilePath("path_1"); 694 base::FilePath path_1 = GetProfilePath("path_1");
705 GetCache()->AddProfileToCache(path_1, name_1, 695 GetCache()->AddProfileToCache(path_1, name_1,
706 std::string(), base::string16(), 0, 696 std::string(), base::string16(), 0,
707 std::string()); 697 std::string());
708 base::string16 name_2 = ASCIIToUTF16("First user"); 698 base::string16 name_2 = ASCIIToUTF16("First user");
709 base::FilePath path_2 = GetProfilePath("path_2"); 699 base::FilePath path_2 = GetProfilePath("path_2");
710 GetCache()->AddProfileToCache(path_2, name_2, 700 GetCache()->AddProfileToCache(path_2, name_2,
(...skipping 16 matching lines...) Expand all
727 // Profile names should have been preserved. 717 // Profile names should have been preserved.
728 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( 718 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex(
729 GetCache()->GetIndexOfProfileWithPath(path_1))); 719 GetCache()->GetIndexOfProfileWithPath(path_1)));
730 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( 720 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex(
731 GetCache()->GetIndexOfProfileWithPath(path_2))); 721 GetCache()->GetIndexOfProfileWithPath(path_2)));
732 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( 722 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex(
733 GetCache()->GetIndexOfProfileWithPath(path_3))); 723 GetCache()->GetIndexOfProfileWithPath(path_3)));
734 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( 724 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex(
735 GetCache()->GetIndexOfProfileWithPath(path_4))); 725 GetCache()->GetIndexOfProfileWithPath(path_4)));
736 } 726 }
727 #endif
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_list_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698