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

Side by Side Diff: chrome/installer/util/shell_util_unittest.cc

Issue 22867002: ShellUtilShortcutTest's test_properties_ doesn't need to be a ptr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix wrapping Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/installer/util/shell_util.h" 5 #include "chrome/installer/util/shell_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/base_paths_win.h" 10 #include "base/base_paths_win.h"
(...skipping 15 matching lines...) Expand all
26 26
27 namespace { 27 namespace {
28 28
29 const wchar_t kManganeseExe[] = L"manganese.exe"; 29 const wchar_t kManganeseExe[] = L"manganese.exe";
30 30
31 // TODO(huangs): Separate this into generic shortcut tests and Chrome-specific 31 // TODO(huangs): Separate this into generic shortcut tests and Chrome-specific
32 // tests. Specifically, we should not overly rely on getting shortcut properties 32 // tests. Specifically, we should not overly rely on getting shortcut properties
33 // from product_->AddDefaultShortcutProperties(). 33 // from product_->AddDefaultShortcutProperties().
34 class ShellUtilShortcutTest : public testing::Test { 34 class ShellUtilShortcutTest : public testing::Test {
35 protected: 35 protected:
36 ShellUtilShortcutTest() : test_properties_(ShellUtil::CURRENT_USER) {}
37
36 virtual void SetUp() OVERRIDE { 38 virtual void SetUp() OVERRIDE {
37 dist_ = BrowserDistribution::GetDistribution(); 39 dist_ = BrowserDistribution::GetDistribution();
38 ASSERT_TRUE(dist_ != NULL); 40 ASSERT_TRUE(dist_ != NULL);
39 product_.reset(new installer::Product(dist_)); 41 product_.reset(new installer::Product(dist_));
40 42
41 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 43 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
42 chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe); 44 chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe);
43 EXPECT_EQ(0, file_util::WriteFile(chrome_exe_, "", 0)); 45 EXPECT_EQ(0, file_util::WriteFile(chrome_exe_, "", 0));
44 46
45 manganese_exe_ = temp_dir_.path().Append(kManganeseExe); 47 manganese_exe_ = temp_dir_.path().Append(kManganeseExe);
(...skipping 19 matching lines...) Expand all
65 fake_default_user_quick_launch_.path())); 67 fake_default_user_quick_launch_.path()));
66 start_menu_override_.reset( 68 start_menu_override_.reset(
67 new base::ScopedPathOverride(base::DIR_START_MENU, 69 new base::ScopedPathOverride(base::DIR_START_MENU,
68 fake_start_menu_.path())); 70 fake_start_menu_.path()));
69 common_start_menu_override_.reset( 71 common_start_menu_override_.reset(
70 new base::ScopedPathOverride(base::DIR_COMMON_START_MENU, 72 new base::ScopedPathOverride(base::DIR_COMMON_START_MENU,
71 fake_common_start_menu_.path())); 73 fake_common_start_menu_.path()));
72 74
73 base::FilePath icon_path; 75 base::FilePath icon_path;
74 file_util::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path); 76 file_util::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path);
75 test_properties_.reset( 77 test_properties_.set_target(chrome_exe_);
76 new ShellUtil::ShortcutProperties(ShellUtil::CURRENT_USER)); 78 test_properties_.set_arguments(L"--test --chrome");
77 test_properties_->set_target(chrome_exe_); 79 test_properties_.set_description(L"Makes polar bears dance.");
78 test_properties_->set_arguments(L"--test --chrome"); 80 test_properties_.set_icon(icon_path, 0);
79 test_properties_->set_description(L"Makes polar bears dance."); 81 test_properties_.set_app_id(L"Polar.Bear");
80 test_properties_->set_icon(icon_path, 0); 82 test_properties_.set_dual_mode(true);
81 test_properties_->set_app_id(L"Polar.Bear");
82 test_properties_->set_dual_mode(true);
83 } 83 }
84 84
85 // Validates that the shortcut at |location| matches |properties| (and 85 // Validates that the shortcut at |location| matches |properties| (and
86 // implicit default properties) for |dist|. 86 // implicit default properties) for |dist|.
87 // Note: This method doesn't verify the |pin_to_taskbar| property as it 87 // Note: This method doesn't verify the |pin_to_taskbar| property as it
88 // implies real (non-mocked) state which is flaky to test. 88 // implies real (non-mocked) state which is flaky to test.
89 void ValidateChromeShortcut( 89 void ValidateChromeShortcut(
90 ShellUtil::ShortcutLocation location, 90 ShellUtil::ShortcutLocation location,
91 BrowserDistribution* dist, 91 BrowserDistribution* dist,
92 const ShellUtil::ShortcutProperties& properties) { 92 const ShellUtil::ShortcutProperties& properties) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 else 157 else
158 expected_properties.set_dual_mode(false); 158 expected_properties.set_dual_mode(false);
159 159
160 base::win::ValidateShortcut(expected_path, expected_properties); 160 base::win::ValidateShortcut(expected_path, expected_properties);
161 } 161 }
162 162
163 BrowserDistribution* dist_; 163 BrowserDistribution* dist_;
164 scoped_ptr<installer::Product> product_; 164 scoped_ptr<installer::Product> product_;
165 165
166 // A ShellUtil::ShortcutProperties object with common properties set already. 166 // A ShellUtil::ShortcutProperties object with common properties set already.
167 scoped_ptr<ShellUtil::ShortcutProperties> test_properties_; 167 ShellUtil::ShortcutProperties test_properties_;
168 168
169 base::ScopedTempDir temp_dir_; 169 base::ScopedTempDir temp_dir_;
170 base::ScopedTempDir fake_user_desktop_; 170 base::ScopedTempDir fake_user_desktop_;
171 base::ScopedTempDir fake_common_desktop_; 171 base::ScopedTempDir fake_common_desktop_;
172 base::ScopedTempDir fake_user_quick_launch_; 172 base::ScopedTempDir fake_user_quick_launch_;
173 base::ScopedTempDir fake_default_user_quick_launch_; 173 base::ScopedTempDir fake_default_user_quick_launch_;
174 base::ScopedTempDir fake_start_menu_; 174 base::ScopedTempDir fake_start_menu_;
175 base::ScopedTempDir fake_common_start_menu_; 175 base::ScopedTempDir fake_common_start_menu_;
176 scoped_ptr<base::ScopedPathOverride> user_desktop_override_; 176 scoped_ptr<base::ScopedPathOverride> user_desktop_override_;
177 scoped_ptr<base::ScopedPathOverride> common_desktop_override_; 177 scoped_ptr<base::ScopedPathOverride> common_desktop_override_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); 213 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER);
214 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); 214 product_->AddDefaultShortcutProperties(chrome_exe_, &properties);
215 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 215 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
216 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties, 216 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties,
217 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 217 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
218 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 218 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
219 properties); 219 properties);
220 } 220 }
221 221
222 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { 222 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) {
223 test_properties_->set_shortcut_name(L"Bobo le shortcut"); 223 test_properties_.set_shortcut_name(L"Bobo le shortcut");
224 test_properties_->level = ShellUtil::SYSTEM_LEVEL; 224 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
225 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 225 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
226 ShellUtil::SHORTCUT_LOCATION_START_MENU, 226 ShellUtil::SHORTCUT_LOCATION_START_MENU,
227 dist_, *test_properties_, 227 dist_, test_properties_,
228 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 228 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
229 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 229 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_,
230 *test_properties_); 230 test_properties_);
231 } 231 }
232 232
233 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) { 233 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) {
234 test_properties_->level = ShellUtil::SYSTEM_LEVEL; 234 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
235 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 235 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
236 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 236 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
237 dist_, *test_properties_, 237 dist_, test_properties_,
238 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 238 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
239 239
240 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL); 240 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL);
241 product_->AddDefaultShortcutProperties(chrome_exe_, &new_properties); 241 product_->AddDefaultShortcutProperties(chrome_exe_, &new_properties);
242 new_properties.set_description(L"New description"); 242 new_properties.set_description(L"New description");
243 new_properties.set_arguments(L"--new-arguments"); 243 new_properties.set_arguments(L"--new-arguments");
244 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 244 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
245 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 245 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
246 dist_, new_properties, 246 dist_, new_properties,
247 ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING)); 247 ShellUtil::SHELL_SHORTCUT_REPLACE_EXISTING));
248 248
249 // Expect the properties set in |new_properties| to be set as above and 249 // Expect the properties set in |new_properties| to be set as above and
250 // properties that don't have a default value to be set back to their default 250 // properties that don't have a default value to be set back to their default
251 // (as validated in ValidateChromeShortcut()) or unset if they don't . 251 // (as validated in ValidateChromeShortcut()) or unset if they don't .
252 ShellUtil::ShortcutProperties expected_properties(new_properties); 252 ShellUtil::ShortcutProperties expected_properties(new_properties);
253 expected_properties.set_dual_mode(false); 253 expected_properties.set_dual_mode(false);
254 254
255 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, 255 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
256 expected_properties); 256 expected_properties);
257 } 257 }
258 258
259 TEST_F(ShellUtilShortcutTest, UpdateQuickLaunchShortcutArguments) { 259 TEST_F(ShellUtilShortcutTest, UpdateQuickLaunchShortcutArguments) {
260 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 260 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
261 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 261 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
262 dist_, *test_properties_, 262 dist_, test_properties_,
263 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 263 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
264 264
265 // Only changing one property, don't need all the defaults. 265 // Only changing one property, don't need all the defaults.
266 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); 266 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
267 updated_properties.set_arguments(L"--updated --arguments"); 267 updated_properties.set_arguments(L"--updated --arguments");
268 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 268 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
269 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 269 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
270 dist_, updated_properties, 270 dist_, updated_properties,
271 ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); 271 ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING));
272 272
273 // Expect the properties set in |updated_properties| to be set as above and 273 // Expect the properties set in |updated_properties| to be set as above and
274 // all other properties to remain unchanged. 274 // all other properties to remain unchanged.
275 ShellUtil::ShortcutProperties expected_properties(*test_properties_); 275 ShellUtil::ShortcutProperties expected_properties(test_properties_);
276 expected_properties.set_arguments(updated_properties.arguments); 276 expected_properties.set_arguments(updated_properties.arguments);
277 277
278 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, 278 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
279 expected_properties); 279 expected_properties);
280 } 280 }
281 281
282 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) { 282 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) {
283 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); 283 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER);
284 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); 284 product_->AddDefaultShortcutProperties(chrome_exe_, &properties);
285 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 285 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
286 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, properties, 286 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, properties,
287 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 287 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
288 288
289 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER); 289 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER);
290 added_properties.set_dual_mode(true); 290 added_properties.set_dual_mode(true);
291 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 291 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
292 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 292 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_,
293 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); 293 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING));
294 294
295 ShellUtil::ShortcutProperties expected_properties(properties); 295 ShellUtil::ShortcutProperties expected_properties(properties);
296 expected_properties.set_dual_mode(true); 296 expected_properties.set_dual_mode(true);
297 297
298 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 298 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_,
299 expected_properties); 299 expected_properties);
300 } 300 }
301 301
302 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { 302 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) {
303 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 303 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
304 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 304 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
305 *test_properties_,
306 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); 305 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL));
307 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 306 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
308 *test_properties_); 307 test_properties_);
309 } 308 }
310 309
311 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) { 310 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) {
312 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 311 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
313 312
314 test_properties_->level = ShellUtil::SYSTEM_LEVEL; 313 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
315 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 314 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
316 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 315 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
317 *test_properties_,
318 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 316 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
319 ASSERT_TRUE(base::PathExists( 317 ASSERT_TRUE(base::PathExists(
320 fake_common_desktop_.path().Append(shortcut_name))); 318 fake_common_desktop_.path().Append(shortcut_name)));
321 319
322 test_properties_->level = ShellUtil::CURRENT_USER; 320 test_properties_.level = ShellUtil::CURRENT_USER;
323 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 321 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
324 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 322 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
325 *test_properties_,
326 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); 323 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL));
327 ASSERT_FALSE(base::PathExists( 324 ASSERT_FALSE(base::PathExists(
328 fake_user_desktop_.path().Append(shortcut_name))); 325 fake_user_desktop_.path().Append(shortcut_name)));
329 } 326 }
330 327
331 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { 328 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) {
332 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 329 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
333 ShellUtil::SHORTCUT_LOCATION_START_MENU, 330 ShellUtil::SHORTCUT_LOCATION_START_MENU,
334 dist_, *test_properties_, 331 dist_, test_properties_,
335 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); 332 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL));
336 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 333 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_,
337 *test_properties_); 334 test_properties_);
338 } 335 }
339 336
340 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { 337 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) {
341 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 338 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
342 339
343 test_properties_->level = ShellUtil::SYSTEM_LEVEL; 340 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
344 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 341 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
345 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 342 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
346 *test_properties_,
347 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 343 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
348 ASSERT_TRUE(base::PathExists( 344 ASSERT_TRUE(base::PathExists(
349 fake_common_desktop_.path().Append(shortcut_name))); 345 fake_common_desktop_.path().Append(shortcut_name)));
350 346
351 test_properties_->level = ShellUtil::CURRENT_USER; 347 test_properties_.level = ShellUtil::CURRENT_USER;
352 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 348 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
353 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 349 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
354 *test_properties_,
355 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 350 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
356 ASSERT_TRUE(base::PathExists( 351 ASSERT_TRUE(base::PathExists(
357 fake_user_desktop_.path().Append(shortcut_name))); 352 fake_user_desktop_.path().Append(shortcut_name)));
358 } 353 }
359 354
360 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { 355 TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) {
361 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 356 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
362 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 357 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
363 *test_properties_,
364 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 358 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
365 359
366 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 360 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
367 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); 361 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name));
368 ASSERT_TRUE(base::PathExists(shortcut_path)); 362 ASSERT_TRUE(base::PathExists(shortcut_path));
369 363
370 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 364 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
371 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, 365 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
372 chrome_exe_)); 366 chrome_exe_));
373 ASSERT_FALSE(base::PathExists(shortcut_path)); 367 ASSERT_FALSE(base::PathExists(shortcut_path));
374 ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); 368 ASSERT_TRUE(base::PathExists(shortcut_path.DirName()));
375 } 369 }
376 370
377 TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { 371 TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) {
378 test_properties_->level = ShellUtil::SYSTEM_LEVEL; 372 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
379 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 373 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
380 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 374 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
381 *test_properties_,
382 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 375 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
383 376
384 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 377 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
385 base::FilePath shortcut_path( 378 base::FilePath shortcut_path(
386 fake_common_desktop_.path().Append(shortcut_name)); 379 fake_common_desktop_.path().Append(shortcut_name));
387 ASSERT_TRUE(base::PathExists(shortcut_path)); 380 ASSERT_TRUE(base::PathExists(shortcut_path));
388 381
389 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 382 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
390 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, 383 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL,
391 chrome_exe_)); 384 chrome_exe_));
392 ASSERT_FALSE(base::PathExists(shortcut_path)); 385 ASSERT_FALSE(base::PathExists(shortcut_path));
393 ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); 386 ASSERT_TRUE(base::PathExists(shortcut_path.DirName()));
394 } 387 }
395 388
396 TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { 389 TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) {
397 const wchar_t kShortcutName1[] = L"Chrome 1"; 390 const wchar_t kShortcutName1[] = L"Chrome 1";
398 const wchar_t kShortcutName2[] = L"Chrome 2"; 391 const wchar_t kShortcutName2[] = L"Chrome 2";
399 392
400 test_properties_->set_shortcut_name(kShortcutName1); 393 test_properties_.set_shortcut_name(kShortcutName1);
401 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 394 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
402 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 395 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
403 *test_properties_,
404 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 396 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
405 string16 shortcut1_name( 397 string16 shortcut1_name(
406 string16(kShortcutName1).append(installer::kLnkExt)); 398 string16(kShortcutName1).append(installer::kLnkExt));
407 base::FilePath shortcut1_path( 399 base::FilePath shortcut1_path(
408 fake_user_desktop_.path().Append(shortcut1_name)); 400 fake_user_desktop_.path().Append(shortcut1_name));
409 ASSERT_TRUE(base::PathExists(shortcut1_path)); 401 ASSERT_TRUE(base::PathExists(shortcut1_path));
410 402
411 test_properties_->set_shortcut_name(kShortcutName2); 403 test_properties_.set_shortcut_name(kShortcutName2);
412 test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); 404 test_properties_.set_arguments(L"--profile-directory=\"Profile 2\"");
413 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 405 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
414 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 406 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
415 *test_properties_,
416 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 407 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
417 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); 408 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt));
418 base::FilePath shortcut2_path( 409 base::FilePath shortcut2_path(
419 fake_user_desktop_.path().Append(shortcut2_name)); 410 fake_user_desktop_.path().Append(shortcut2_name));
420 ASSERT_TRUE(base::PathExists(shortcut2_path)); 411 ASSERT_TRUE(base::PathExists(shortcut2_path));
421 412
422 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 413 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
423 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, 414 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
424 chrome_exe_)); 415 chrome_exe_));
425 ASSERT_FALSE(base::PathExists(shortcut1_path)); 416 ASSERT_FALSE(base::PathExists(shortcut1_path));
426 ASSERT_FALSE(base::PathExists(shortcut2_path)); 417 ASSERT_FALSE(base::PathExists(shortcut2_path));
427 ASSERT_TRUE(base::PathExists(shortcut1_path.DirName())); 418 ASSERT_TRUE(base::PathExists(shortcut1_path.DirName()));
428 } 419 }
429 420
430 TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { 421 TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) {
431 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 422 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
432 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 423 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
433 *test_properties_,
434 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 424 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
435 425
436 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 426 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
437 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); 427 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name));
438 ASSERT_TRUE(base::PathExists(shortcut_path)); 428 ASSERT_TRUE(base::PathExists(shortcut_path));
439 429
440 base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe); 430 base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
441 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); 431 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
442 updated_properties.set_target(new_exe); 432 updated_properties.set_target(new_exe);
443 433
444 ASSERT_TRUE(ShellUtil::UpdateShortcuts( 434 ASSERT_TRUE(ShellUtil::UpdateShortcuts(
445 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, 435 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
446 chrome_exe_, updated_properties)); 436 chrome_exe_, updated_properties));
447 437
448 ShellUtil::ShortcutProperties expected_properties(*test_properties_); 438 ShellUtil::ShortcutProperties expected_properties(test_properties_);
449 expected_properties.set_target(new_exe); 439 expected_properties.set_target(new_exe);
450 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 440 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
451 expected_properties); 441 expected_properties);
452 } 442 }
453 443
454 TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { 444 TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) {
455 test_properties_->level = ShellUtil::SYSTEM_LEVEL; 445 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
456 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 446 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
457 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 447 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
458 *test_properties_,
459 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 448 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
460 449
461 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 450 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
462 base::FilePath shortcut_path( 451 base::FilePath shortcut_path(
463 fake_common_desktop_.path().Append(shortcut_name)); 452 fake_common_desktop_.path().Append(shortcut_name));
464 ASSERT_TRUE(base::PathExists(shortcut_path)); 453 ASSERT_TRUE(base::PathExists(shortcut_path));
465 454
466 base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe); 455 base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
467 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); 456 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
468 updated_properties.set_target(new_exe); 457 updated_properties.set_target(new_exe);
469 458
470 ASSERT_TRUE(ShellUtil::UpdateShortcuts( 459 ASSERT_TRUE(ShellUtil::UpdateShortcuts(
471 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, 460 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL,
472 chrome_exe_, updated_properties)); 461 chrome_exe_, updated_properties));
473 462
474 ShellUtil::ShortcutProperties expected_properties(*test_properties_); 463 ShellUtil::ShortcutProperties expected_properties(test_properties_);
475 expected_properties.set_target(new_exe); 464 expected_properties.set_target(new_exe);
476 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 465 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
477 expected_properties); 466 expected_properties);
478 } 467 }
479 468
480 TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { 469 TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) {
481 const wchar_t kShortcutName1[] = L"Chrome 1"; 470 const wchar_t kShortcutName1[] = L"Chrome 1";
482 const wchar_t kShortcutName2[] = L"Chrome 2"; 471 const wchar_t kShortcutName2[] = L"Chrome 2";
483 472
484 // Setup shortcut 1. 473 // Setup shortcut 1.
485 test_properties_->set_shortcut_name(kShortcutName1); 474 test_properties_.set_shortcut_name(kShortcutName1);
486 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 475 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
487 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 476 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
488 *test_properties_,
489 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 477 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
490 string16 shortcut1_name( 478 string16 shortcut1_name(
491 string16(kShortcutName1).append(installer::kLnkExt)); 479 string16(kShortcutName1).append(installer::kLnkExt));
492 base::FilePath shortcut1_path( 480 base::FilePath shortcut1_path(
493 fake_user_desktop_.path().Append(shortcut1_name)); 481 fake_user_desktop_.path().Append(shortcut1_name));
494 ShellUtil::ShortcutProperties expected_properties1(*test_properties_); 482 ShellUtil::ShortcutProperties expected_properties1(test_properties_);
495 483
496 // Setup shortcut 2, which also has arguments. 484 // Setup shortcut 2, which also has arguments.
497 string16 shortcut2_args = L"--profile-directory=\"Profile 2\""; 485 string16 shortcut2_args = L"--profile-directory=\"Profile 2\"";
498 test_properties_->set_shortcut_name(kShortcutName2); 486 test_properties_.set_shortcut_name(kShortcutName2);
499 test_properties_->set_arguments(shortcut2_args); 487 test_properties_.set_arguments(shortcut2_args);
500 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 488 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
501 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 489 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
502 *test_properties_,
503 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 490 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
504 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); 491 string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt));
505 base::FilePath shortcut2_path( 492 base::FilePath shortcut2_path(
506 fake_user_desktop_.path().Append(shortcut2_name)); 493 fake_user_desktop_.path().Append(shortcut2_name));
507 ASSERT_TRUE(base::PathExists(shortcut2_path)); 494 ASSERT_TRUE(base::PathExists(shortcut2_path));
508 ShellUtil::ShortcutProperties expected_properties2(*test_properties_); 495 ShellUtil::ShortcutProperties expected_properties2(test_properties_);
509 496
510 // Update shortcuts: target "manganese.exe" instead of "chrome.exe". 497 // Update shortcuts: target "manganese.exe" instead of "chrome.exe".
511 base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe); 498 base::FilePath new_exe = temp_dir_.path().Append(kManganeseExe);
512 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); 499 ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER);
513 updated_properties.set_target(new_exe); 500 updated_properties.set_target(new_exe);
514 ASSERT_TRUE(ShellUtil::UpdateShortcuts( 501 ASSERT_TRUE(ShellUtil::UpdateShortcuts(
515 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, 502 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER,
516 chrome_exe_, updated_properties)); 503 chrome_exe_, updated_properties));
517 504
518 // Verify shortcut 1. 505 // Verify shortcut 1.
519 expected_properties1.set_target(new_exe); 506 expected_properties1.set_target(new_exe);
520 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 507 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
521 expected_properties1); 508 expected_properties1);
522 509
523 // Verify shortcut 2. 510 // Verify shortcut 2.
524 expected_properties2.set_target(new_exe); 511 expected_properties2.set_target(new_exe);
525 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 512 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
526 expected_properties2); 513 expected_properties2);
527 } 514 }
528 515
529 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { 516 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) {
530 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 517 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
531 ShellUtil::SHORTCUT_LOCATION_START_MENU, 518 ShellUtil::SHORTCUT_LOCATION_START_MENU,
532 dist_, *test_properties_, 519 dist_, test_properties_,
533 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 520 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
534 test_properties_->set_shortcut_name(L"A second shortcut"); 521 test_properties_.set_shortcut_name(L"A second shortcut");
535 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 522 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
536 ShellUtil::SHORTCUT_LOCATION_START_MENU, 523 ShellUtil::SHORTCUT_LOCATION_START_MENU,
537 dist_, *test_properties_, 524 dist_, test_properties_,
538 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 525 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
539 526
540 base::FilePath shortcut_folder( 527 base::FilePath shortcut_folder(
541 fake_start_menu_.path().Append(dist_->GetAppShortCutName())); 528 fake_start_menu_.path().Append(dist_->GetAppShortCutName()));
542 base::FileEnumerator file_counter(shortcut_folder, false, 529 base::FileEnumerator file_counter(shortcut_folder, false,
543 base::FileEnumerator::FILES); 530 base::FileEnumerator::FILES);
544 int count = 0; 531 int count = 0;
545 while (!file_counter.Next().empty()) 532 while (!file_counter.Next().empty())
546 ++count; 533 ++count;
547 EXPECT_EQ(2, count); 534 EXPECT_EQ(2, count);
548 535
549 ASSERT_TRUE(base::PathExists(shortcut_folder)); 536 ASSERT_TRUE(base::PathExists(shortcut_folder));
550 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 537 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
551 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, 538 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER,
552 chrome_exe_)); 539 chrome_exe_));
553 ASSERT_FALSE(base::PathExists(shortcut_folder)); 540 ASSERT_FALSE(base::PathExists(shortcut_folder));
554 } 541 }
555 542
556 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { 543 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) {
557 base::ScopedTempDir other_exe_dir; 544 base::ScopedTempDir other_exe_dir;
558 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir()); 545 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir());
559 base::FilePath other_chrome_exe = 546 base::FilePath other_chrome_exe =
560 other_exe_dir.path().Append(installer::kChromeExe); 547 other_exe_dir.path().Append(installer::kChromeExe);
561 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0)); 548 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0));
562 549
563 test_properties_->set_target(other_chrome_exe); 550 test_properties_.set_target(other_chrome_exe);
564 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 551 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
565 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 552 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
566 *test_properties_,
567 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 553 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
568 554
569 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); 555 string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt);
570 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); 556 base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name));
571 ASSERT_TRUE(base::PathExists(shortcut_path)); 557 ASSERT_TRUE(base::PathExists(shortcut_path));
572 558
573 // The shortcut shouldn't be removed as it was installed pointing to 559 // The shortcut shouldn't be removed as it was installed pointing to
574 // |other_chrome_exe| and RemoveChromeShortcut() is being told that the 560 // |other_chrome_exe| and RemoveChromeShortcut() is being told that the
575 // removed shortcut should point to |chrome_exe_|. 561 // removed shortcut should point to |chrome_exe_|.
576 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 562 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 637
652 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", 638 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ",
653 L"MZXW6YTB", L"MZXW6YTBOI"}; 639 L"MZXW6YTB", L"MZXW6YTBOI"};
654 640
655 // Run the tests, with one more letter in the input every pass. 641 // Run the tests, with one more letter in the input every pass.
656 for (int i = 0; i < arraysize(expected); ++i) { 642 for (int i = 0; i < arraysize(expected); ++i) {
657 ASSERT_EQ(expected[i], 643 ASSERT_EQ(expected[i],
658 ShellUtil::ByteArrayToBase32(test_array, i)); 644 ShellUtil::ByteArrayToBase32(test_array, i));
659 } 645 }
660 } 646 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698