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

Side by Side Diff: chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc

Issue 10837352: Update profile desktop shortcuts (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 unified diff | Download patch
OLDNEW
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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/scoped_temp_dir.h" 8 #include "base/scoped_temp_dir.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 gfx::Image& avatar = ResourceBundle::GetSharedInstance(). 55 gfx::Image& avatar = ResourceBundle::GetSharedInstance().
56 GetNativeImageNamed(IDR_PROFILE_AVATAR_0); 56 GetNativeImageNamed(IDR_PROFILE_AVATAR_0);
57 57
58 profile_shortcut_manager->CreateChromeDesktopShortcut(dest_path, 58 profile_shortcut_manager->CreateChromeDesktopShortcut(dest_path,
59 profile_name, avatar); 59 profile_name, avatar);
60 60
61 ASSERT_TRUE(file_util::PathExists(dest_path.Append( 61 ASSERT_TRUE(file_util::PathExists(dest_path.Append(
62 (FILE_PATH_LITERAL("Google Profile.ico"))))); 62 (FILE_PATH_LITERAL("Google Profile.ico")))));
63 63
64 profile_shortcut_manager->DeleteChromeDesktopShortcut(dest_path); 64 profile_shortcut_manager->DeleteChromeDesktopShortcut(dest_path,
65 profile_name);
65 66
66 // TODO(hallielaine): Verify shortcut deletion 67 // TODO(hallielaine): Verify shortcut deletion
67 } 68 }
68 69
69 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsLnk) { 70 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsLnk) {
70 // Profile shortcut manager will be NULL for non-windows platforms 71 // Profile shortcut manager will be NULL for non-windows platforms
71 ProfileShortcutManager* profile_shortcut_manager = 72 ProfileShortcutManager* profile_shortcut_manager =
72 ProfileShortcutManager::Create(); 73 ProfileShortcutManager::Create();
73 74
74 if (!profile_shortcut_manager) 75 if (!profile_shortcut_manager)
75 return; 76 return;
76 77
78 string16 profile_name = ASCIIToUTF16("My Profile");
79
77 FilePath dest_path = temp_dir_.path(); 80 FilePath dest_path = temp_dir_.path();
78 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile 1")); 81 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile 1"));
79 82
80 gfx::Image& avatar = ResourceBundle::GetSharedInstance(). 83 gfx::Image& avatar = ResourceBundle::GetSharedInstance().
81 GetNativeImageNamed(IDR_PROFILE_AVATAR_0); 84 GetNativeImageNamed(IDR_PROFILE_AVATAR_0);
82 85
83 profile_shortcut_manager->CreateChromeDesktopShortcut(dest_path, 86 profile_shortcut_manager->CreateChromeDesktopShortcut(dest_path,
84 ASCIIToUTF16("My Profile"), avatar); 87 profile_name, avatar);
85 88
86 FilePath exe_path; 89 FilePath exe_path;
87 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &exe_path)); 90 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &exe_path));
88 91
89 FilePath shortcut; 92 FilePath shortcut;
90 string16 shortcut_name; 93 string16 shortcut_name;
91 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 94 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
92 95
93 // Get the desktop path of the current user 96 // Get the desktop path of the current user
94 ShellUtil::GetDesktopPath(false, &shortcut); 97 ShellUtil::GetDesktopPath(false, &shortcut);
95 // Get the name of the shortcut with profile attached 98 // Get the name of the shortcut with profile attached
96 ShellUtil::GetChromeShortcutName(dist, false, ASCIIToUTF16("My Profile"), 99 ShellUtil::GetChromeShortcutName(dist, false, profile_name,
97 &shortcut_name); 100 &shortcut_name);
98 shortcut = shortcut.Append(shortcut_name); 101 shortcut = shortcut.Append(shortcut_name);
99 102
100 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, 103 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS,
101 ShellUtil::VerifyChromeShortcut(exe_path.value(), 104 ShellUtil::VerifyChromeShortcut(exe_path.value(),
102 shortcut.value(), dist->GetAppDescription(), 0)); 105 shortcut.value(), dist->GetAppDescription(), 0));
103 106
104 profile_shortcut_manager->DeleteChromeDesktopShortcut(dest_path); 107 profile_shortcut_manager->DeleteChromeDesktopShortcut(dest_path,
108 profile_name);
105 } 109 }
110
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698