Chromium Code Reviews| Index: chrome/browser/profiles/profile_info_cache_unittest.cc |
| diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc |
| index 51e1fd456e30b63b3f939c6f9fb155abd94be296..fbb2f9fdb70f14bee6695c17954023432126ed4f 100644 |
| --- a/chrome/browser/profiles/profile_info_cache_unittest.cc |
| +++ b/chrome/browser/profiles/profile_info_cache_unittest.cc |
| @@ -4,6 +4,8 @@ |
| #include "chrome/browser/profiles/profile_info_cache_unittest.h" |
| +#include <vector> |
| + |
| #include "base/prefs/testing_pref_service.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -459,4 +461,30 @@ TEST_F(ProfileInfoCacheTest, CreateManagedTestingProfile) { |
| } |
| } |
| +TEST_F(ProfileInfoCacheTest, AddStubProfile) { |
| + EXPECT_EQ(0u, GetCache()->GetNumberOfProfiles()); |
| + |
| + // Add some profiles with and without a '.' in their paths. |
| + for (uint32 i = 0; i < 4; ++i) { |
| + base::FilePath profile_path = |
| + GetProfilePath(base::StringPrintf("path%ctest%u", |
| + i % 2 ? '_' : '.', |
| + i)); |
| + string16 profile_name = ASCIIToUTF16(base::StringPrintf("name_%u", i)); |
|
xiyuan
2013/09/14 18:39:56
nit: It's easier to read if we put the profile_pat
michaelpg
2013/09/14 19:30:24
Done.
|
| + |
| + GetCache()->AddProfileToCache(profile_path, profile_name, string16(), i, |
| + ""); |
| + |
| + EXPECT_EQ(profile_path, GetCache()->GetPathOfProfileAtIndex(i)); |
| + EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(i)); |
| + } |
| + |
| + ASSERT_EQ(4U, GetCache()->GetNumberOfProfiles()); |
| + |
| + // Check that the profiles can be extracted from the local state. |
| + std::vector<string16> names = ProfileInfoCache::GetProfileNames(); |
| + for (size_t i = 0; i < 4; i++) |
| + ASSERT_FALSE(names[i].empty()); |
| +} |
| + |
| } // namespace |