OLD | NEW |
---|---|
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 "base/test/test_shortcut_win.h" | 10 #include "base/test/test_shortcut_win.h" |
11 #include "base/win/shortcut.h" | 11 #include "base/win/shortcut.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 14 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
15 #include "chrome/installer/util/browser_distribution.h" | 15 #include "chrome/installer/util/browser_distribution.h" |
16 #include "chrome/installer/util/shell_util.h" | 16 #include "chrome/installer/util/shell_util.h" |
17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
18 #include "chrome/test/base/testing_pref_service.h" | 18 #include "chrome/test/base/testing_pref_service.h" |
19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
20 #include "chrome/test/base/testing_profile_manager.h" | 20 #include "chrome/test/base/testing_profile_manager.h" |
21 #include "content/public/test/test_browser_thread.h" | 21 #include "content/public/test/test_browser_thread.h" |
22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
25 | 25 |
26 using content::BrowserThread; | 26 using content::BrowserThread; |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 base::win::VerifyShortcutStatus VerifyProfileShortcut( | 30 // Sets |path| to the path to the shortcut for this profile. |
31 const string16& profile_name) { | 31 // Automatically fails the test on failure to do so. |
32 void GetShortcutPathForProfile(BrowserDistribution* dist, | |
33 const string16& profile_name, | |
34 FilePath* path) { | |
35 string16 shortcut_name; | |
36 if (!ShellUtil::GetDesktopPath(false, path) || | |
37 !ShellUtil::GetChromeShortcutName(dist, false, profile_name, | |
38 &shortcut_name)) { | |
39 FAIL(); | |
robertshield
2012/09/25 21:06:34
Suggest adding a log message to the failure here.
gab
2012/09/25 22:10:00
Done (but with asserts as it should never fail and
| |
40 } | |
41 *path = path->Append(shortcut_name); | |
42 } | |
43 | |
44 // Returns true if the shortcut for this profile exists. | |
45 bool ProfileShortcutExists(BrowserDistribution* dist, | |
46 const string16& profile_name) { | |
47 FilePath shortcut_path; | |
48 GetShortcutPathForProfile(dist, profile_name, &shortcut_path); | |
49 return file_util::PathExists(shortcut_path); | |
50 } | |
51 | |
52 // Calls base::win::ValidateShortcut() with expected properties for | |
53 // |profile_name|'s shortcut. | |
54 void ValidateProfileShortcut(BrowserDistribution* dist, | |
55 const string16& profile_name) { | |
56 EXPECT_TRUE(ProfileShortcutExists(dist, profile_name)); | |
57 | |
32 FilePath exe_path; | 58 FilePath exe_path; |
33 EXPECT_TRUE(PathService::Get(base::FILE_EXE, &exe_path)); | 59 EXPECT_TRUE(PathService::Get(base::FILE_EXE, &exe_path)); |
34 | 60 |
35 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | |
36 | |
37 // Get the desktop path of the current user. | |
38 FilePath shortcut_path; | 61 FilePath shortcut_path; |
39 ShellUtil::GetDesktopPath(false, &shortcut_path); | 62 GetShortcutPathForProfile(dist, profile_name, &shortcut_path); |
40 // Get the name of the shortcut with profile attached | |
41 string16 shortcut_name; | |
42 ShellUtil::GetChromeShortcutName(dist, false, profile_name, | |
43 &shortcut_name); | |
44 shortcut_path = shortcut_path.Append(shortcut_name); | |
45 | 63 |
46 // TODO(hallielaine): With this new struct method for VerifyShortcut you can | 64 // TODO(hallielaine): With this new struct method for VerifyShortcut you can |
47 // now test more properties like: arguments, icon, icon_index, and app_id. | 65 // now test more properties like: arguments, icon, icon_index, and app_id. |
48 base::win::ShortcutProperties expected_properties; | 66 base::win::ShortcutProperties expected_properties; |
49 expected_properties.set_target(exe_path); | 67 expected_properties.set_target(exe_path); |
50 expected_properties.set_description(dist->GetAppDescription()); | 68 expected_properties.set_description(dist->GetAppDescription()); |
51 expected_properties.set_dual_mode(false); | 69 expected_properties.set_dual_mode(false); |
52 return base::win::VerifyShortcut(shortcut_path, expected_properties); | 70 base::win::ValidateShortcut(shortcut_path, expected_properties); |
53 } | 71 } |
54 | 72 |
55 } // namespace | 73 } // namespace |
56 | 74 |
57 class ProfileShortcutManagerTest : public testing::Test { | 75 class ProfileShortcutManagerTest : public testing::Test { |
58 protected: | 76 protected: |
59 ProfileShortcutManagerTest() | 77 ProfileShortcutManagerTest() |
60 : ui_thread_(BrowserThread::UI, &message_loop_), | 78 : ui_thread_(BrowserThread::UI, &message_loop_), |
61 file_thread_(BrowserThread::FILE, &message_loop_) { | 79 file_thread_(BrowserThread::FILE, &message_loop_) { |
62 } | 80 } |
63 | 81 |
64 virtual void SetUp() OVERRIDE { | 82 virtual void SetUp() OVERRIDE { |
83 dist_ = BrowserDistribution::GetDistribution(); | |
84 ASSERT_TRUE(dist_ != NULL); | |
85 | |
65 // Mock the user's Desktop into a temp directory. | 86 // Mock the user's Desktop into a temp directory. |
66 ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir()); | 87 ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir()); |
67 ASSERT_TRUE(PathService::Override(base::DIR_USER_DESKTOP, | 88 ASSERT_TRUE(PathService::Override(base::DIR_USER_DESKTOP, |
68 fake_user_desktop_.path())); | 89 fake_user_desktop_.path())); |
69 | 90 |
70 TestingBrowserProcess* browser_process = | 91 TestingBrowserProcess* browser_process = |
71 static_cast<TestingBrowserProcess*>(g_browser_process); | 92 static_cast<TestingBrowserProcess*>(g_browser_process); |
72 profile_manager_.reset(new TestingProfileManager(browser_process)); | 93 profile_manager_.reset(new TestingProfileManager(browser_process)); |
73 ASSERT_TRUE(profile_manager_->SetUp()); | 94 ASSERT_TRUE(profile_manager_->SetUp()); |
74 | 95 |
(...skipping 23 matching lines...) Expand all Loading... | |
98 profile_manager_->profile_info_cache()->GetPathOfProfileAtIndex(0); | 119 profile_manager_->profile_info_cache()->GetPathOfProfileAtIndex(0); |
99 string16 profile_name; | 120 string16 profile_name; |
100 if (i != num_profiles - 1) { | 121 if (i != num_profiles - 1) { |
101 profile_name = | 122 profile_name = |
102 profile_manager_->profile_info_cache()->GetNameOfProfileAtIndex(0); | 123 profile_manager_->profile_info_cache()->GetNameOfProfileAtIndex(0); |
103 } | 124 } |
104 profile_manager_->profile_info_cache()->DeleteProfileFromCache( | 125 profile_manager_->profile_info_cache()->DeleteProfileFromCache( |
105 profile_path); | 126 profile_path); |
106 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 127 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
107 MessageLoop::current()->Run(); | 128 MessageLoop::current()->Run(); |
108 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 129 ASSERT_FALSE(ProfileShortcutExists(dist_, profile_name)); |
109 VerifyProfileShortcut(profile_name)); | |
110 ASSERT_FALSE(file_util::PathExists(profile_path.Append( | 130 ASSERT_FALSE(file_util::PathExists(profile_path.Append( |
111 FILE_PATH_LITERAL("Google Profile.ico")))); | 131 FILE_PATH_LITERAL("Google Profile.ico")))); |
112 } | 132 } |
113 } | 133 } |
114 | 134 |
115 void SetupDefaultProfileShortcut() { | 135 void SetupDefaultProfileShortcut() { |
116 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 136 ASSERT_FALSE(ProfileShortcutExists(dist_, profile_name_)); |
117 VerifyProfileShortcut(profile_name_)); | |
118 // A non-badged shortcut for chrome is automatically created with the | 137 // A non-badged shortcut for chrome is automatically created with the |
119 // first profile (for the case when the user deletes their only | 138 // first profile (for the case when the user deletes their only |
120 // profile). | 139 // profile). |
121 profile_manager_->profile_info_cache()->AddProfileToCache( | 140 profile_manager_->profile_info_cache()->AddProfileToCache( |
122 dest_path_, profile_name_, string16(), 0); | 141 dest_path_, profile_name_, string16(), 0); |
123 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 142 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
124 MessageLoop::current()->Run(); | 143 MessageLoop::current()->Run(); |
125 // We now have 1 profile, so we expect a new shortcut with no profile | 144 // We now have 1 profile, so we expect a new shortcut with no profile |
126 // information. | 145 // information. |
127 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 146 ValidateProfileShortcut(dist_, string16()); |
128 VerifyProfileShortcut(string16())); | |
129 } | 147 } |
130 | 148 |
131 void SetupAndCreateTwoShortcuts() { | 149 void SetupAndCreateTwoShortcuts() { |
132 ASSERT_EQ(0, profile_manager_->profile_info_cache()->GetNumberOfProfiles()); | 150 ASSERT_EQ(0, profile_manager_->profile_info_cache()->GetNumberOfProfiles()); |
133 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 151 ASSERT_FALSE(ProfileShortcutExists(dist_, profile_name_)); |
134 VerifyProfileShortcut(profile_name_)); | 152 ASSERT_FALSE(ProfileShortcutExists(dist_, second_profile_name_)); |
135 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | |
136 VerifyProfileShortcut(second_profile_name_)); | |
137 | 153 |
138 profile_manager_->profile_info_cache()->AddProfileToCache( | 154 profile_manager_->profile_info_cache()->AddProfileToCache( |
139 dest_path_, profile_name_, string16(), 0); | 155 dest_path_, profile_name_, string16(), 0); |
140 profile_manager_->profile_info_cache()->AddProfileToCache( | 156 profile_manager_->profile_info_cache()->AddProfileToCache( |
141 second_dest_path_, second_profile_name_, string16(), 0); | 157 second_dest_path_, second_profile_name_, string16(), 0); |
142 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 158 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
143 CreateProfileShortcut(second_dest_path_); | 159 CreateProfileShortcut(second_dest_path_); |
144 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 160 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
145 MessageLoop::current()->Run(); | 161 MessageLoop::current()->Run(); |
146 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 162 ValidateProfileShortcut(dist_, profile_name_); |
147 VerifyProfileShortcut(profile_name_)); | 163 ValidateProfileShortcut(dist_, second_profile_name_); |
148 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | |
149 VerifyProfileShortcut(second_profile_name_)); | |
150 } | 164 } |
151 | 165 |
166 BrowserDistribution* dist_; | |
152 MessageLoopForUI message_loop_; | 167 MessageLoopForUI message_loop_; |
153 content::TestBrowserThread ui_thread_; | 168 content::TestBrowserThread ui_thread_; |
154 content::TestBrowserThread file_thread_; | 169 content::TestBrowserThread file_thread_; |
155 scoped_ptr<TestingProfileManager> profile_manager_; | 170 scoped_ptr<TestingProfileManager> profile_manager_; |
156 ScopedTempDir fake_user_desktop_; | 171 ScopedTempDir fake_user_desktop_; |
157 FilePath dest_path_; | 172 FilePath dest_path_; |
158 string16 profile_name_; | 173 string16 profile_name_; |
159 FilePath second_dest_path_; | 174 FilePath second_dest_path_; |
160 string16 second_profile_name_; | 175 string16 second_profile_name_; |
161 }; | 176 }; |
162 | 177 |
163 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreate) { | 178 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreate) { |
164 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 179 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
165 return; | 180 return; |
166 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); | 181 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); |
167 | 182 |
168 profile_manager_->profile_info_cache()->AddProfileToCache( | 183 profile_manager_->profile_info_cache()->AddProfileToCache( |
169 second_dest_path_, second_profile_name_, string16(), 0); | 184 second_dest_path_, second_profile_name_, string16(), 0); |
170 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 185 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
171 CreateProfileShortcut(second_dest_path_); | 186 CreateProfileShortcut(second_dest_path_); |
172 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 187 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
173 MessageLoop::current()->Run(); | 188 MessageLoop::current()->Run(); |
174 | 189 |
175 // We now have 2 profiles, so we expect a new shortcut with profile | 190 // We now have 2 profiles, so we expect a new shortcut with profile |
176 // information for this 2nd profile. | 191 // information for this 2nd profile. |
177 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 192 ValidateProfileShortcut(dist_, second_profile_name_); |
178 VerifyProfileShortcut(second_profile_name_)); | |
179 ASSERT_TRUE(file_util::PathExists(second_dest_path_.Append( | 193 ASSERT_TRUE(file_util::PathExists(second_dest_path_.Append( |
180 FILE_PATH_LITERAL("Google Profile.ico")))); | 194 FILE_PATH_LITERAL("Google Profile.ico")))); |
181 } | 195 } |
182 | 196 |
183 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) { | 197 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) { |
184 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 198 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
185 return; | 199 return; |
186 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); | 200 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); |
187 | 201 |
188 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 202 EXPECT_FALSE(ProfileShortcutExists(dist_, second_profile_name_)); |
189 VerifyProfileShortcut(second_profile_name_)); | |
190 | 203 |
191 profile_manager_->profile_info_cache()->AddProfileToCache( | 204 profile_manager_->profile_info_cache()->AddProfileToCache( |
192 second_dest_path_, second_profile_name_, string16(), 0); | 205 second_dest_path_, second_profile_name_, string16(), 0); |
193 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 206 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
194 CreateProfileShortcut(second_dest_path_); | 207 CreateProfileShortcut(second_dest_path_); |
195 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 208 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
196 MessageLoop::current()->Run(); | 209 MessageLoop::current()->Run(); |
197 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 210 ValidateProfileShortcut(dist_, second_profile_name_); |
198 VerifyProfileShortcut(second_profile_name_)); | |
199 | 211 |
200 // Cause an update in ProfileShortcutManager by modifying the profile info | 212 // Cause an update in ProfileShortcutManager by modifying the profile info |
201 // cache. | 213 // cache. |
202 string16 new_profile_name = ASCIIToUTF16("New Profile Name"); | 214 string16 new_profile_name = ASCIIToUTF16("New Profile Name"); |
203 profile_manager_->profile_info_cache()->SetNameOfProfileAtIndex( | 215 profile_manager_->profile_info_cache()->SetNameOfProfileAtIndex( |
204 profile_manager_->profile_info_cache()->GetIndexOfProfileWithPath( | 216 profile_manager_->profile_info_cache()->GetIndexOfProfileWithPath( |
205 second_dest_path_), | 217 second_dest_path_), |
206 new_profile_name); | 218 new_profile_name); |
207 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 219 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
208 MessageLoop::current()->Run(); | 220 MessageLoop::current()->Run(); |
209 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 221 EXPECT_FALSE(ProfileShortcutExists(dist_, second_profile_name_)); |
210 VerifyProfileShortcut(second_profile_name_)); | 222 ValidateProfileShortcut(dist_, new_profile_name); |
211 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | |
212 VerifyProfileShortcut(new_profile_name)); | |
213 } | 223 } |
214 | 224 |
215 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsDeleteSecondToLast) { | 225 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsDeleteSecondToLast) { |
216 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 226 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
217 return; | 227 return; |
218 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); | 228 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); |
219 | 229 |
220 // Delete one shortcut | 230 // Delete one shortcut |
221 profile_manager_->profile_info_cache()->DeleteProfileFromCache( | 231 profile_manager_->profile_info_cache()->DeleteProfileFromCache( |
222 second_dest_path_); | 232 second_dest_path_); |
223 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 233 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
224 MessageLoop::current()->Run(); | 234 MessageLoop::current()->Run(); |
225 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 235 EXPECT_FALSE(ProfileShortcutExists(dist_, second_profile_name_)); |
226 VerifyProfileShortcut(second_profile_name_)); | |
227 | 236 |
228 // Verify that the profile name has been removed from the remaining shortcut | 237 // Verify that the profile name has been removed from the remaining shortcut |
229 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 238 ValidateProfileShortcut(dist_, string16()); |
230 VerifyProfileShortcut(string16())); | |
231 // Verify that an additional shortcut, with the default profile's name does | 239 // Verify that an additional shortcut, with the default profile's name does |
232 // not exist | 240 // not exist |
233 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 241 EXPECT_FALSE(ProfileShortcutExists(dist_, profile_name_)); |
234 VerifyProfileShortcut(profile_name_)); | |
235 } | 242 } |
236 | 243 |
237 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) { | 244 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) { |
238 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 245 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
239 return; | 246 return; |
240 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); | 247 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); |
241 | 248 |
242 // Delete one shortcut | 249 // Delete one shortcut |
243 profile_manager_->profile_info_cache()->DeleteProfileFromCache( | 250 profile_manager_->profile_info_cache()->DeleteProfileFromCache( |
244 second_dest_path_); | 251 second_dest_path_); |
245 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 252 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
246 MessageLoop::current()->Run(); | 253 MessageLoop::current()->Run(); |
247 | 254 |
248 // Verify that a default shortcut exists (no profile name/avatar) | 255 // Verify that a default shortcut exists (no profile name/avatar) |
249 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 256 ValidateProfileShortcut(dist_, string16()); |
250 VerifyProfileShortcut(string16())); | |
251 // Verify that an additional shortcut, with the default profile's name does | 257 // Verify that an additional shortcut, with the default profile's name does |
252 // not exist | 258 // not exist |
253 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 259 EXPECT_FALSE(ProfileShortcutExists(dist_, profile_name_)); |
254 VerifyProfileShortcut(profile_name_)); | |
255 | 260 |
256 // Create a second profile and shortcut | 261 // Create a second profile and shortcut |
257 profile_manager_->profile_info_cache()->AddProfileToCache( | 262 profile_manager_->profile_info_cache()->AddProfileToCache( |
258 second_dest_path_, second_profile_name_, string16(), 0); | 263 second_dest_path_, second_profile_name_, string16(), 0); |
259 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 264 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
260 CreateProfileShortcut(second_dest_path_); | 265 CreateProfileShortcut(second_dest_path_); |
261 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 266 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
262 MessageLoop::current()->Run(); | 267 MessageLoop::current()->Run(); |
263 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 268 ValidateProfileShortcut(dist_, second_profile_name_); |
264 VerifyProfileShortcut(second_profile_name_)); | |
265 | 269 |
266 // Verify that the original shortcut received the profile's name | 270 // Verify that the original shortcut received the profile's name |
267 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, | 271 ValidateProfileShortcut(dist_, profile_name_); |
268 VerifyProfileShortcut(profile_name_)); | |
269 // Verify that a default shortcut no longer exists | 272 // Verify that a default shortcut no longer exists |
270 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, | 273 EXPECT_FALSE(ProfileShortcutExists(dist_, string16())); |
271 VerifyProfileShortcut(string16())); | |
272 } | 274 } |
273 | |
OLD | NEW |