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

Unified Diff: chrome/browser/profiles/profile_info_cache_unittest.cc

Issue 23528008: Don't use path expansion for profile dictionaries in LocalState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unit Tests Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698