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

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

Issue 13864015: Move app launcher and chrome apps shortcut strings into the installer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_app_id_fix
Patch Set: fix win compile, change LOG(INFO)s to VLOG(1) Created 7 years 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
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 switch (location) { 94 switch (location) {
95 case ShellUtil::SHORTCUT_LOCATION_DESKTOP: 95 case ShellUtil::SHORTCUT_LOCATION_DESKTOP:
96 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? 96 expected_path = (properties.level == ShellUtil::CURRENT_USER) ?
97 fake_user_desktop_.path() : fake_common_desktop_.path(); 97 fake_user_desktop_.path() : fake_common_desktop_.path();
98 break; 98 break;
99 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH: 99 case ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH:
100 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? 100 expected_path = (properties.level == ShellUtil::CURRENT_USER) ?
101 fake_user_quick_launch_.path() : 101 fake_user_quick_launch_.path() :
102 fake_default_user_quick_launch_.path(); 102 fake_default_user_quick_launch_.path();
103 break; 103 break;
104 case ShellUtil::SHORTCUT_LOCATION_START_MENU: 104 case ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR:
105 expected_path = (properties.level == ShellUtil::CURRENT_USER) ? 105 expected_path = (properties.level == ShellUtil::CURRENT_USER) ?
106 fake_start_menu_.path() : fake_common_start_menu_.path(); 106 fake_start_menu_.path() : fake_common_start_menu_.path();
107 expected_path = expected_path.Append( 107 expected_path = expected_path.Append(
108 dist_->GetStartMenuShortcutSubfolder( 108 dist_->GetStartMenuShortcutSubfolder(
109 BrowserDistribution::SUBFOLDER_CHROME)); 109 BrowserDistribution::SUBFOLDER_CHROME));
110 break; 110 break;
111 default: 111 default:
112 ADD_FAILURE() << "Unknown location"; 112 ADD_FAILURE() << "Unknown location";
113 return; 113 return;
114 } 114 }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 EXPECT_EQ(fake_common_desktop_.path(), path); 200 EXPECT_EQ(fake_common_desktop_.path(), path);
201 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, 201 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
202 ShellUtil::CURRENT_USER, &path); 202 ShellUtil::CURRENT_USER, &path);
203 EXPECT_EQ(fake_user_quick_launch_.path(), path); 203 EXPECT_EQ(fake_user_quick_launch_.path(), path);
204 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, 204 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
205 ShellUtil::SYSTEM_LEVEL, &path); 205 ShellUtil::SYSTEM_LEVEL, &path);
206 EXPECT_EQ(fake_default_user_quick_launch_.path(), path); 206 EXPECT_EQ(fake_default_user_quick_launch_.path(), path);
207 string16 start_menu_subfolder = 207 string16 start_menu_subfolder =
208 dist_->GetStartMenuShortcutSubfolder( 208 dist_->GetStartMenuShortcutSubfolder(
209 BrowserDistribution::SUBFOLDER_CHROME); 209 BrowserDistribution::SUBFOLDER_CHROME);
210 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 210 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
211 ShellUtil::CURRENT_USER, &path); 211 dist_, ShellUtil::CURRENT_USER, &path);
212 EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder), 212 EXPECT_EQ(fake_start_menu_.path().Append(start_menu_subfolder),
213 path); 213 path);
214 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 214 ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
215 ShellUtil::SYSTEM_LEVEL, &path); 215 dist_, ShellUtil::SYSTEM_LEVEL, &path);
216 EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder), 216 EXPECT_EQ(fake_common_start_menu_.path().Append(start_menu_subfolder),
217 path); 217 path);
218 } 218 }
219 219
220 TEST_F(ShellUtilShortcutTest, CreateChromeExeShortcutWithDefaultProperties) { 220 TEST_F(ShellUtilShortcutTest, CreateChromeExeShortcutWithDefaultProperties) {
221 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); 221 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER);
222 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); 222 product_->AddDefaultShortcutProperties(chrome_exe_, &properties);
223 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 223 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
224 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties, 224 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, properties,
225 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 225 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
226 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 226 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
227 properties); 227 properties);
228 } 228 }
229 229
230 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) { 230 TEST_F(ShellUtilShortcutTest, CreateStartMenuShortcutWithAllProperties) {
231 test_properties_.set_shortcut_name(L"Bobo le shortcut"); 231 test_properties_.set_shortcut_name(L"Bobo le shortcut");
232 test_properties_.level = ShellUtil::SYSTEM_LEVEL; 232 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
233 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 233 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
234 ShellUtil::SHORTCUT_LOCATION_START_MENU, 234 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
235 dist_, test_properties_, 235 dist_, test_properties_,
236 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 236 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
237 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 237 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
238 test_properties_); 238 dist_, test_properties_);
239 } 239 }
240 240
241 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) { 241 TEST_F(ShellUtilShortcutTest, ReplaceSystemLevelQuickLaunchShortcut) {
242 test_properties_.level = ShellUtil::SYSTEM_LEVEL; 242 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
243 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 243 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
244 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, 244 ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH,
245 dist_, test_properties_, 245 dist_, test_properties_,
246 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 246 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
247 247
248 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL); 248 ShellUtil::ShortcutProperties new_properties(ShellUtil::SYSTEM_LEVEL);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 expected_properties.set_arguments(updated_properties.arguments); 284 expected_properties.set_arguments(updated_properties.arguments);
285 285
286 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_, 286 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_QUICK_LAUNCH, dist_,
287 expected_properties); 287 expected_properties);
288 } 288 }
289 289
290 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) { 290 TEST_F(ShellUtilShortcutTest, UpdateAddDualModeToStartMenuShortcut) {
291 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); 291 ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER);
292 product_->AddDefaultShortcutProperties(chrome_exe_, &properties); 292 product_->AddDefaultShortcutProperties(chrome_exe_, &properties);
293 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 293 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
294 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, properties, 294 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_,
295 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 295 properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
296 296
297 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER); 297 ShellUtil::ShortcutProperties added_properties(ShellUtil::CURRENT_USER);
298 added_properties.set_dual_mode(true); 298 added_properties.set_dual_mode(true);
299 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 299 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
300 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 300 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_,
301 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING)); 301 added_properties, ShellUtil::SHELL_SHORTCUT_UPDATE_EXISTING));
302 302
303 ShellUtil::ShortcutProperties expected_properties(properties); 303 ShellUtil::ShortcutProperties expected_properties(properties);
304 expected_properties.set_dual_mode(true); 304 expected_properties.set_dual_mode(true);
305 305
306 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 306 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
307 expected_properties); 307 dist_, expected_properties);
308 } 308 }
309 309
310 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) { 310 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevel) {
311 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 311 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
312 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, 312 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
313 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); 313 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL));
314 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 314 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
315 test_properties_); 315 test_properties_);
316 } 316 }
317 317
(...skipping 12 matching lines...) Expand all
330 test_properties_.level = ShellUtil::CURRENT_USER; 330 test_properties_.level = ShellUtil::CURRENT_USER;
331 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 331 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
332 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, 332 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
333 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); 333 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL));
334 ASSERT_FALSE(base::PathExists( 334 ASSERT_FALSE(base::PathExists(
335 fake_user_desktop_.path().Append(shortcut_name))); 335 fake_user_desktop_.path().Append(shortcut_name)));
336 } 336 }
337 337
338 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) { 338 TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelStartMenu) {
339 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 339 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
340 ShellUtil::SHORTCUT_LOCATION_START_MENU, 340 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
341 dist_, test_properties_, 341 dist_, test_properties_,
342 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); 342 ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL));
343 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, 343 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
344 test_properties_); 344 dist_, test_properties_);
345 } 345 }
346 346
347 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { 347 TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) {
348 string16 shortcut_name( 348 string16 shortcut_name(
349 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) + 349 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) +
350 installer::kLnkExt); 350 installer::kLnkExt);
351 351
352 test_properties_.level = ShellUtil::SYSTEM_LEVEL; 352 test_properties_.level = ShellUtil::SYSTEM_LEVEL;
353 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 353 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
354 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_, 354 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, test_properties_,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 529 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
530 expected_properties1); 530 expected_properties1);
531 // Verify shortcut 2. 531 // Verify shortcut 2.
532 expected_properties2.set_target(new_exe); 532 expected_properties2.set_target(new_exe);
533 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, 533 ValidateChromeShortcut(ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_,
534 expected_properties2); 534 expected_properties2);
535 } 535 }
536 536
537 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { 537 TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) {
538 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 538 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
539 ShellUtil::SHORTCUT_LOCATION_START_MENU, 539 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
540 dist_, test_properties_,
541 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
542 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
543 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR,
540 dist_, test_properties_, 544 dist_, test_properties_,
541 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 545 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
542 test_properties_.set_shortcut_name(L"A second shortcut"); 546 test_properties_.set_shortcut_name(L"A second shortcut");
543 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut( 547 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
544 ShellUtil::SHORTCUT_LOCATION_START_MENU, 548 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR,
549 dist_, test_properties_,
550 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
551 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
552 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR,
545 dist_, test_properties_, 553 dist_, test_properties_,
546 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); 554 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
547 555
548 base::FilePath shortcut_folder( 556 base::FilePath chrome_shortcut_folder(
549 fake_start_menu_.path().Append( 557 fake_start_menu_.path().Append(
550 dist_->GetStartMenuShortcutSubfolder( 558 dist_->GetStartMenuShortcutSubfolder(
551 BrowserDistribution::SUBFOLDER_CHROME))); 559 BrowserDistribution::SUBFOLDER_CHROME)));
552 base::FileEnumerator file_counter(shortcut_folder, false, 560 base::FilePath chrome_apps_shortcut_folder(
553 base::FileEnumerator::FILES); 561 fake_start_menu_.path().Append(
562 dist_->GetStartMenuShortcutSubfolder(
563 BrowserDistribution::SUBFOLDER_APPS)));
564
565 base::FileEnumerator chrome_file_counter(chrome_shortcut_folder, false,
566 base::FileEnumerator::FILES);
554 int count = 0; 567 int count = 0;
555 while (!file_counter.Next().empty()) 568 while (!chrome_file_counter.Next().empty())
556 ++count; 569 ++count;
557 EXPECT_EQ(2, count); 570 EXPECT_EQ(2, count);
558 571
559 ASSERT_TRUE(base::PathExists(shortcut_folder)); 572 base::FileEnumerator chrome_apps_file_counter(chrome_apps_shortcut_folder,
573 false,
574 base::FileEnumerator::FILES);
575 count = 0;
576 while (!chrome_apps_file_counter.Next().empty())
577 ++count;
578 EXPECT_EQ(2, count);
579
580 ASSERT_TRUE(base::PathExists(chrome_shortcut_folder));
560 ASSERT_TRUE(ShellUtil::RemoveShortcuts( 581 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
561 ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, 582 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR, dist_,
562 chrome_exe_)); 583 ShellUtil::CURRENT_USER, chrome_exe_));
563 ASSERT_FALSE(base::PathExists(shortcut_folder)); 584 ASSERT_FALSE(base::PathExists(chrome_shortcut_folder));
585
586 ASSERT_TRUE(base::PathExists(chrome_apps_shortcut_folder));
587 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
588 ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR, dist_,
589 ShellUtil::CURRENT_USER, chrome_exe_));
590 ASSERT_FALSE(base::PathExists(chrome_apps_shortcut_folder));
591 }
592
593 TEST_F(ShellUtilShortcutTest,
594 DeleteStartMenuRootShortcutWithoutRemovingFolder) {
595 ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
596 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT,
597 dist_, test_properties_,
598 ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS));
599
600 string16 shortcut_name(
601 dist_->GetShortcutName(BrowserDistribution::SHORTCUT_CHROME) +
602 installer::kLnkExt);
603 base::FilePath shortcut_path(
604 fake_start_menu_.path().Append(shortcut_name));
605
606 ASSERT_TRUE(base::PathExists(fake_start_menu_.path()));
607 ASSERT_TRUE(base::PathExists(shortcut_path));
608 ASSERT_TRUE(ShellUtil::RemoveShortcuts(
609 ShellUtil::SHORTCUT_LOCATION_START_MENU_ROOT, dist_,
610 ShellUtil::CURRENT_USER, chrome_exe_));
611 // The shortcut should be removed but the "Start Menu" root directory should
612 // remain.
613 ASSERT_TRUE(base::PathExists(fake_start_menu_.path()));
614 ASSERT_FALSE(base::PathExists(shortcut_path));
564 } 615 }
565 616
566 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { 617 TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) {
567 base::ScopedTempDir other_exe_dir; 618 base::ScopedTempDir other_exe_dir;
568 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir()); 619 ASSERT_TRUE(other_exe_dir.CreateUniqueTempDir());
569 base::FilePath other_chrome_exe = 620 base::FilePath other_chrome_exe =
570 other_exe_dir.path().Append(installer::kChromeExe); 621 other_exe_dir.path().Append(installer::kChromeExe);
571 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0)); 622 EXPECT_EQ(0, file_util::WriteFile(other_chrome_exe, "", 0));
572 623
573 test_properties_.set_target(other_chrome_exe); 624 test_properties_.set_target(other_chrome_exe);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 713
663 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ", 714 const string16 expected[] = { L"", L"MY", L"MZXQ", L"MZXW6", L"MZXW6YQ",
664 L"MZXW6YTB", L"MZXW6YTBOI"}; 715 L"MZXW6YTB", L"MZXW6YTBOI"};
665 716
666 // Run the tests, with one more letter in the input every pass. 717 // Run the tests, with one more letter in the input every pass.
667 for (int i = 0; i < arraysize(expected); ++i) { 718 for (int i = 0; i < arraysize(expected); ++i) {
668 ASSERT_EQ(expected[i], 719 ASSERT_EQ(expected[i],
669 ShellUtil::ByteArrayToBase32(test_array, i)); 720 ShellUtil::ByteArrayToBase32(test_array, i));
670 } 721 }
671 } 722 }
OLDNEW
« no previous file with comments | « chrome/installer/util/shell_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698