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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 // Other profile names should not be migrated even if they're the old | 660 // Other profile names should not be migrated even if they're the old |
661 // default cartoon profile names. | 661 // default cartoon profile names. |
662 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( | 662 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( |
663 GetCache()->GetIndexOfProfileWithPath(path_3))); | 663 GetCache()->GetIndexOfProfileWithPath(path_3))); |
664 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( | 664 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( |
665 GetCache()->GetIndexOfProfileWithPath(path_4))); | 665 GetCache()->GetIndexOfProfileWithPath(path_4))); |
666 EXPECT_EQ(name_5, GetCache()->GetNameOfProfileAtIndex( | 666 EXPECT_EQ(name_5, GetCache()->GetNameOfProfileAtIndex( |
667 GetCache()->GetIndexOfProfileWithPath(path_5))); | 667 GetCache()->GetIndexOfProfileWithPath(path_5))); |
668 } | 668 } |
669 #endif | 669 #endif |
670 | |
671 TEST_F(ProfileInfoCacheTest, | |
672 DontMigrateLegacyProfileNamesWithoutNewAvatarMenu) { | |
673 switches::DisableNewAvatarMenuForTesting( | |
msw
2015/05/18 18:28:30
Can you remove this helper, DisableNewAvatarMenuFo
| |
674 base::CommandLine::ForCurrentProcess()); | |
675 | |
676 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); | |
677 | |
678 base::string16 name_1 = ASCIIToUTF16("Default Profile"); | |
679 base::FilePath path_1 = GetProfilePath("path_1"); | |
680 GetCache()->AddProfileToCache(path_1, name_1, | |
681 std::string(), base::string16(), 0, | |
682 std::string()); | |
683 base::string16 name_2 = ASCIIToUTF16("First user"); | |
684 base::FilePath path_2 = GetProfilePath("path_2"); | |
685 GetCache()->AddProfileToCache(path_2, name_2, | |
686 std::string(), base::string16(), 1, | |
687 std::string()); | |
688 base::string16 name_3 = ASCIIToUTF16("Lemonade"); | |
689 base::FilePath path_3 = GetProfilePath("path_3"); | |
690 GetCache()->AddProfileToCache(path_3, name_3, | |
691 std::string(), base::string16(), 2, | |
692 std::string()); | |
693 base::string16 name_4 = ASCIIToUTF16("Batman"); | |
694 base::FilePath path_4 = GetProfilePath("path_4"); | |
695 GetCache()->AddProfileToCache(path_4, name_4, | |
696 std::string(), base::string16(), 3, | |
697 std::string()); | |
698 EXPECT_EQ(4U, GetCache()->GetNumberOfProfiles()); | |
699 | |
700 ResetCache(); | |
701 | |
702 // Profile names should have been preserved. | |
703 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( | |
704 GetCache()->GetIndexOfProfileWithPath(path_1))); | |
705 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( | |
706 GetCache()->GetIndexOfProfileWithPath(path_2))); | |
707 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( | |
708 GetCache()->GetIndexOfProfileWithPath(path_3))); | |
709 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( | |
710 GetCache()->GetIndexOfProfileWithPath(path_4))); | |
711 } | |
OLD | NEW |