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

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

Issue 11786008: Sanitize the profile's name when used to create a shortcut. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_shortcut_manager_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
index 47bda74704d155139e45d553db64f2464a22ac0b..d1477246ada8498a165f5ad526738e393938a97f 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
@@ -236,6 +236,26 @@ TEST_F(ProfileShortcutManagerTest, ShortcutFilename) {
distribution_));
}
+TEST_F(ProfileShortcutManagerTest, ShortcutLongFilenameIsTrimmed) {
+ const string16 kLongProfileName = L"Harry Harry Harry Harry Harry Harry Harry"
+ L"Harry Harry Harry Harry Harry Harry Harry Harry Harry Harry Harry"
+ L"Harry Harry Harry Harry Harry Harry Harry Harry Harry Harry Harry";
+ string16 file_name =
+ profiles::internal::GetShortcutFilenameForProfile(
+ kLongProfileName, distribution_);
+ EXPECT_LT(file_name.size(), kLongProfileName.size());
+}
+
+TEST_F(ProfileShortcutManagerTest, ShortcutFilenameStripsReservedCharacters) {
+ const string16 kProfileName = L"<Harry/>";
+ const string16 kSanitizedProfileName = L"Harry";
+ const string16 expected_name = kSanitizedProfileName + L" - " +
+ distribution_->GetAppShortCutName() + installer::kLnkExt;
+ EXPECT_EQ(expected_name,
+ profiles::internal::GetShortcutFilenameForProfile(kProfileName,
+ distribution_));
+}
+
TEST_F(ProfileShortcutManagerTest, UnbadgedShortcutFilename) {
EXPECT_EQ(distribution_->GetAppShortCutName() + installer::kLnkExt,
profiles::internal::GetShortcutFilenameForProfile(string16(),
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_shortcut_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698