| 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..1d5e6df7d0119a42ab26f372121b4fd412b5cb3a 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,37 @@ TEST_F(ProfileInfoCacheTest, CreateManagedTestingProfile) {
|
| }
|
| }
|
|
|
| +TEST_F(ProfileInfoCacheTest, AddStubProfile) {
|
| + EXPECT_EQ(0u, GetCache()->GetNumberOfProfiles());
|
| +
|
| + // Add some profiles with and without a '.' in their paths.
|
| + const struct {
|
| + const char* profile_path;
|
| + const char* profile_name;
|
| + } kTestCases[] = {
|
| + { "path.test0", "name_0" },
|
| + { "path_test1", "name_1" },
|
| + { "path.test2", "name_2" },
|
| + { "path_test3", "name_3" },
|
| + };
|
| +
|
| + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) {
|
| + base::FilePath profile_path = GetProfilePath(kTestCases[i].profile_path);
|
| + string16 profile_name = ASCIIToUTF16(kTestCases[i].profile_name);
|
| +
|
| + 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
|
|
|