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 "chrome/installer/setup/install.h" | 5 #include "chrome/installer/setup/install.h" |
6 | 6 |
7 #include <objbase.h> | 7 #include <objbase.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 class CreateVisualElementsManifestTest : public testing::Test { | 46 class CreateVisualElementsManifestTest : public testing::Test { |
47 protected: | 47 protected: |
48 void SetUp() override { | 48 void SetUp() override { |
49 // Create a temp directory for testing. | 49 // Create a temp directory for testing. |
50 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 50 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
51 | 51 |
52 version_ = base::Version("0.0.0.0"); | 52 version_ = base::Version("0.0.0.0"); |
53 | 53 |
54 version_dir_ = test_dir_.path().AppendASCII(version_.GetString()); | 54 version_dir_ = test_dir_.GetPath().AppendASCII(version_.GetString()); |
55 ASSERT_TRUE(base::CreateDirectory(version_dir_)); | 55 ASSERT_TRUE(base::CreateDirectory(version_dir_)); |
56 | 56 |
57 manifest_path_ = | 57 manifest_path_ = |
58 test_dir_.path().Append(installer::kVisualElementsManifest); | 58 test_dir_.GetPath().Append(installer::kVisualElementsManifest); |
59 } | 59 } |
60 | 60 |
61 void TearDown() override { | 61 void TearDown() override { |
62 // Clean up test directory manually so we can fail if it leaks. | 62 // Clean up test directory manually so we can fail if it leaks. |
63 ASSERT_TRUE(test_dir_.Delete()); | 63 ASSERT_TRUE(test_dir_.Delete()); |
64 } | 64 } |
65 | 65 |
66 // The temporary directory used to contain the test operations. | 66 // The temporary directory used to contain the test operations. |
67 base::ScopedTempDir test_dir_; | 67 base::ScopedTempDir test_dir_; |
68 | 68 |
(...skipping 23 matching lines...) Expand all Loading... |
92 }; | 92 }; |
93 | 93 |
94 void SetUp() override { | 94 void SetUp() override { |
95 EXPECT_EQ(S_OK, CoInitialize(NULL)); | 95 EXPECT_EQ(S_OK, CoInitialize(NULL)); |
96 | 96 |
97 dist_ = BrowserDistribution::GetDistribution(); | 97 dist_ = BrowserDistribution::GetDistribution(); |
98 ASSERT_TRUE(dist_ != NULL); | 98 ASSERT_TRUE(dist_ != NULL); |
99 product_.reset(new installer::Product(dist_)); | 99 product_.reset(new installer::Product(dist_)); |
100 | 100 |
101 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 101 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
102 chrome_exe_ = temp_dir_.path().Append(installer::kChromeExe); | 102 chrome_exe_ = temp_dir_.GetPath().Append(installer::kChromeExe); |
103 EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0)); | 103 EXPECT_EQ(0, base::WriteFile(chrome_exe_, "", 0)); |
104 | 104 |
105 ShellUtil::ShortcutProperties chrome_properties(ShellUtil::CURRENT_USER); | 105 ShellUtil::ShortcutProperties chrome_properties(ShellUtil::CURRENT_USER); |
106 product_->AddDefaultShortcutProperties(chrome_exe_, &chrome_properties); | 106 product_->AddDefaultShortcutProperties(chrome_exe_, &chrome_properties); |
107 | 107 |
108 expected_properties_.set_target(chrome_exe_); | 108 expected_properties_.set_target(chrome_exe_); |
109 expected_properties_.set_icon(chrome_properties.icon, | 109 expected_properties_.set_icon(chrome_properties.icon, |
110 chrome_properties.icon_index); | 110 chrome_properties.icon_index); |
111 expected_properties_.set_app_id(chrome_properties.app_id); | 111 expected_properties_.set_app_id(chrome_properties.app_id); |
112 expected_properties_.set_description(chrome_properties.description); | 112 expected_properties_.set_description(chrome_properties.description); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 // path of these shortcuts to |new_target_path_relative| using | 199 // path of these shortcuts to |new_target_path_relative| using |
200 // UpdatePerUserShortcutsInLocation(). Verifies that the right shortcuts have | 200 // UpdatePerUserShortcutsInLocation(). Verifies that the right shortcuts have |
201 // been updated. | 201 // been updated. |
202 void TestUpdateShortcuts(const UpdateShortcutsTestCase* test_cases, | 202 void TestUpdateShortcuts(const UpdateShortcutsTestCase* test_cases, |
203 size_t num_test_cases, | 203 size_t num_test_cases, |
204 const base::FilePath& new_target_path_relative) { | 204 const base::FilePath& new_target_path_relative) { |
205 // Create shortcuts. | 205 // Create shortcuts. |
206 for (size_t i = 0; i < num_test_cases; ++i) { | 206 for (size_t i = 0; i < num_test_cases; ++i) { |
207 // Make sure that the target exists. | 207 // Make sure that the target exists. |
208 const base::FilePath target_path = | 208 const base::FilePath target_path = |
209 temp_dir_.path().Append(test_cases[i].target_path); | 209 temp_dir_.GetPath().Append(test_cases[i].target_path); |
210 if (!base::PathExists(target_path)) { | 210 if (!base::PathExists(target_path)) { |
211 ASSERT_TRUE(base::CreateDirectory(target_path.DirName())); | 211 ASSERT_TRUE(base::CreateDirectory(target_path.DirName())); |
212 base::File file(target_path, base::File::FLAG_CREATE_ALWAYS | | 212 base::File file(target_path, base::File::FLAG_CREATE_ALWAYS | |
213 base::File::FLAG_WRITE); | 213 base::File::FLAG_WRITE); |
214 ASSERT_TRUE(file.IsValid()); | 214 ASSERT_TRUE(file.IsValid()); |
215 static const char kDummyData[] = "dummy"; | 215 static const char kDummyData[] = "dummy"; |
216 ASSERT_EQ(arraysize(kDummyData), | 216 ASSERT_EQ(arraysize(kDummyData), |
217 static_cast<size_t>(file.WriteAtCurrentPos( | 217 static_cast<size_t>(file.WriteAtCurrentPos( |
218 kDummyData, arraysize(kDummyData)))); | 218 kDummyData, arraysize(kDummyData)))); |
219 } | 219 } |
220 | 220 |
221 // Create the shortcut. | 221 // Create the shortcut. |
222 base::win::ShortcutProperties properties; | 222 base::win::ShortcutProperties properties; |
223 properties.set_target(target_path); | 223 properties.set_target(target_path); |
224 properties.set_icon(temp_dir_.path().Append(test_cases[i].icon_path), 1); | 224 properties.set_icon(temp_dir_.GetPath().Append(test_cases[i].icon_path), |
| 225 1); |
225 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 226 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
226 user_desktop_shortcut_.InsertBeforeExtension( | 227 user_desktop_shortcut_.InsertBeforeExtension( |
227 base::SizeTToString16(i)), | 228 base::SizeTToString16(i)), |
228 properties, base::win::SHORTCUT_CREATE_ALWAYS)); | 229 properties, base::win::SHORTCUT_CREATE_ALWAYS)); |
229 } | 230 } |
230 | 231 |
231 // Update shortcuts. | 232 // Update shortcuts. |
232 const base::FilePath new_target_path = | 233 const base::FilePath new_target_path = |
233 temp_dir_.path().Append(new_target_path_relative); | 234 temp_dir_.GetPath().Append(new_target_path_relative); |
234 installer::UpdatePerUserShortcutsInLocation( | 235 installer::UpdatePerUserShortcutsInLocation( |
235 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, | 236 ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, |
236 new_target_path.DirName().DirName(), new_target_path.BaseName(), | 237 new_target_path.DirName().DirName(), new_target_path.BaseName(), |
237 new_target_path); | 238 new_target_path); |
238 | 239 |
239 // Verify that shortcuts were updated correctly. | 240 // Verify that shortcuts were updated correctly. |
240 for (size_t i = 0; i < num_test_cases; ++i) { | 241 for (size_t i = 0; i < num_test_cases; ++i) { |
241 base::FilePath target_path; | 242 base::FilePath target_path; |
242 ASSERT_TRUE(base::win::ResolveShortcut( | 243 ASSERT_TRUE(base::win::ResolveShortcut( |
243 user_desktop_shortcut_.InsertBeforeExtension( | 244 user_desktop_shortcut_.InsertBeforeExtension( |
244 base::SizeTToString16(i)), | 245 base::SizeTToString16(i)), |
245 &target_path, nullptr)); | 246 &target_path, nullptr)); |
246 | 247 |
247 if (test_cases[i].should_update) { | 248 if (test_cases[i].should_update) { |
248 EXPECT_EQ(GetNormalizedFilePath(new_target_path), | 249 EXPECT_EQ(GetNormalizedFilePath(new_target_path), |
249 GetNormalizedFilePath(target_path)); | 250 GetNormalizedFilePath(target_path)); |
250 } else { | 251 } else { |
251 EXPECT_EQ(GetNormalizedFilePath( | 252 EXPECT_EQ(GetNormalizedFilePath( |
252 temp_dir_.path().Append(test_cases[i].target_path)), | 253 temp_dir_.GetPath().Append(test_cases[i].target_path)), |
253 GetNormalizedFilePath(target_path)); | 254 GetNormalizedFilePath(target_path)); |
254 } | 255 } |
255 } | 256 } |
256 } | 257 } |
257 | 258 |
258 base::win::ShortcutProperties expected_properties_; | 259 base::win::ShortcutProperties expected_properties_; |
259 base::win::ShortcutProperties expected_start_menu_properties_; | 260 base::win::ShortcutProperties expected_start_menu_properties_; |
260 | 261 |
261 BrowserDistribution* dist_; | 262 BrowserDistribution* dist_; |
262 base::FilePath chrome_exe_; | 263 base::FilePath chrome_exe_; |
(...skipping 20 matching lines...) Expand all Loading... |
283 base::FilePath system_start_menu_shortcut_; | 284 base::FilePath system_start_menu_shortcut_; |
284 base::FilePath system_start_menu_subdir_shortcut_; | 285 base::FilePath system_start_menu_subdir_shortcut_; |
285 }; | 286 }; |
286 | 287 |
287 } // namespace | 288 } // namespace |
288 | 289 |
289 // Test that VisualElementsManifest.xml is not created when VisualElements are | 290 // Test that VisualElementsManifest.xml is not created when VisualElements are |
290 // not present. | 291 // not present. |
291 TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestNotCreated) { | 292 TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestNotCreated) { |
292 ASSERT_TRUE( | 293 ASSERT_TRUE( |
293 installer::CreateVisualElementsManifest(test_dir_.path(), version_)); | 294 installer::CreateVisualElementsManifest(test_dir_.GetPath(), version_)); |
294 ASSERT_FALSE(base::PathExists(manifest_path_)); | 295 ASSERT_FALSE(base::PathExists(manifest_path_)); |
295 } | 296 } |
296 | 297 |
297 // Test that VisualElementsManifest.xml is created with the correct content when | 298 // Test that VisualElementsManifest.xml is created with the correct content when |
298 // VisualElements are present. | 299 // VisualElements are present. |
299 TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestCreated) { | 300 TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestCreated) { |
300 ASSERT_TRUE(base::CreateDirectory( | 301 ASSERT_TRUE(base::CreateDirectory( |
301 version_dir_.Append(installer::kVisualElements))); | 302 version_dir_.Append(installer::kVisualElements))); |
302 ASSERT_TRUE( | 303 ASSERT_TRUE( |
303 installer::CreateVisualElementsManifest(test_dir_.path(), version_)); | 304 installer::CreateVisualElementsManifest(test_dir_.GetPath(), version_)); |
304 ASSERT_TRUE(base::PathExists(manifest_path_)); | 305 ASSERT_TRUE(base::PathExists(manifest_path_)); |
305 | 306 |
306 std::string read_manifest; | 307 std::string read_manifest; |
307 ASSERT_TRUE(base::ReadFileToString(manifest_path_, &read_manifest)); | 308 ASSERT_TRUE(base::ReadFileToString(manifest_path_, &read_manifest)); |
308 | 309 |
309 static const char kExpectedManifest[] = | 310 static const char kExpectedManifest[] = |
310 "<Application xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\r\n" | 311 "<Application xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\r\n" |
311 " <VisualElements\r\n" | 312 " <VisualElements\r\n" |
312 " ShowNameOnSquare150x150Logo='on'\r\n" | 313 " ShowNameOnSquare150x150Logo='on'\r\n" |
313 " Square150x150Logo='0.0.0.0\\VisualElements\\Logo.png'\r\n" | 314 " Square150x150Logo='0.0.0.0\\VisualElements\\Logo.png'\r\n" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 installer::INSTALL_SHORTCUT_CREATE_ALL); | 366 installer::INSTALL_SHORTCUT_CREATE_ALL); |
366 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); | 367 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); |
367 ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); | 368 ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); |
368 base::win::ValidateShortcut(user_start_menu_shortcut_, | 369 base::win::ValidateShortcut(user_start_menu_shortcut_, |
369 expected_start_menu_properties_); | 370 expected_start_menu_properties_); |
370 } | 371 } |
371 | 372 |
372 TEST_F(InstallShortcutTest, ReplaceAll) { | 373 TEST_F(InstallShortcutTest, ReplaceAll) { |
373 base::win::ShortcutProperties dummy_properties; | 374 base::win::ShortcutProperties dummy_properties; |
374 base::FilePath dummy_target; | 375 base::FilePath dummy_target; |
375 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); | 376 ASSERT_TRUE( |
| 377 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &dummy_target)); |
376 dummy_properties.set_target(dummy_target); | 378 dummy_properties.set_target(dummy_target); |
377 dummy_properties.set_working_dir(fake_user_desktop_.path()); | 379 dummy_properties.set_working_dir(fake_user_desktop_.path()); |
378 dummy_properties.set_arguments(L"--dummy --args"); | 380 dummy_properties.set_arguments(L"--dummy --args"); |
379 dummy_properties.set_app_id(L"El.Dummiest"); | 381 dummy_properties.set_app_id(L"El.Dummiest"); |
380 | 382 |
381 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 383 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
382 user_desktop_shortcut_, dummy_properties, | 384 user_desktop_shortcut_, dummy_properties, |
383 base::win::SHORTCUT_CREATE_ALWAYS)); | 385 base::win::SHORTCUT_CREATE_ALWAYS)); |
384 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 386 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
385 user_quick_launch_shortcut_, dummy_properties, | 387 user_quick_launch_shortcut_, dummy_properties, |
386 base::win::SHORTCUT_CREATE_ALWAYS)); | 388 base::win::SHORTCUT_CREATE_ALWAYS)); |
387 ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); | 389 ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); |
388 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 390 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
389 user_start_menu_shortcut_, dummy_properties, | 391 user_start_menu_shortcut_, dummy_properties, |
390 base::win::SHORTCUT_CREATE_ALWAYS)); | 392 base::win::SHORTCUT_CREATE_ALWAYS)); |
391 | 393 |
392 installer::CreateOrUpdateShortcuts( | 394 installer::CreateOrUpdateShortcuts( |
393 chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, | 395 chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, |
394 installer::INSTALL_SHORTCUT_REPLACE_EXISTING); | 396 installer::INSTALL_SHORTCUT_REPLACE_EXISTING); |
395 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); | 397 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); |
396 base::win::ValidateShortcut(user_quick_launch_shortcut_, | 398 base::win::ValidateShortcut(user_quick_launch_shortcut_, |
397 expected_properties_); | 399 expected_properties_); |
398 base::win::ValidateShortcut(user_start_menu_shortcut_, | 400 base::win::ValidateShortcut(user_start_menu_shortcut_, |
399 expected_start_menu_properties_); | 401 expected_start_menu_properties_); |
400 } | 402 } |
401 | 403 |
402 TEST_F(InstallShortcutTest, ReplaceExisting) { | 404 TEST_F(InstallShortcutTest, ReplaceExisting) { |
403 base::win::ShortcutProperties dummy_properties; | 405 base::win::ShortcutProperties dummy_properties; |
404 base::FilePath dummy_target; | 406 base::FilePath dummy_target; |
405 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); | 407 ASSERT_TRUE( |
| 408 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &dummy_target)); |
406 dummy_properties.set_target(dummy_target); | 409 dummy_properties.set_target(dummy_target); |
407 dummy_properties.set_working_dir(fake_user_desktop_.path()); | 410 dummy_properties.set_working_dir(fake_user_desktop_.path()); |
408 dummy_properties.set_arguments(L"--dummy --args"); | 411 dummy_properties.set_arguments(L"--dummy --args"); |
409 dummy_properties.set_app_id(L"El.Dummiest"); | 412 dummy_properties.set_app_id(L"El.Dummiest"); |
410 | 413 |
411 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 414 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
412 user_desktop_shortcut_, dummy_properties, | 415 user_desktop_shortcut_, dummy_properties, |
413 base::win::SHORTCUT_CREATE_ALWAYS)); | 416 base::win::SHORTCUT_CREATE_ALWAYS)); |
414 ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); | 417 ASSERT_TRUE(base::CreateDirectory(user_start_menu_shortcut_.DirName())); |
415 | 418 |
(...skipping 18 matching lines...) Expand all Loading... |
434 const installer::InstallShortcutOperation shortcut_operation_; | 437 const installer::InstallShortcutOperation shortcut_operation_; |
435 const installer::InstallShortcutLevel shortcut_level_; | 438 const installer::InstallShortcutLevel shortcut_level_; |
436 | 439 |
437 private: | 440 private: |
438 DISALLOW_COPY_AND_ASSIGN(MigrateShortcutTest); | 441 DISALLOW_COPY_AND_ASSIGN(MigrateShortcutTest); |
439 }; | 442 }; |
440 | 443 |
441 TEST_P(MigrateShortcutTest, MigrateAwayFromDeprecatedStartMenuTest) { | 444 TEST_P(MigrateShortcutTest, MigrateAwayFromDeprecatedStartMenuTest) { |
442 base::win::ShortcutProperties dummy_properties; | 445 base::win::ShortcutProperties dummy_properties; |
443 base::FilePath dummy_target; | 446 base::FilePath dummy_target; |
444 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); | 447 ASSERT_TRUE( |
| 448 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &dummy_target)); |
445 dummy_properties.set_target(expected_properties_.target); | 449 dummy_properties.set_target(expected_properties_.target); |
446 dummy_properties.set_working_dir(fake_user_desktop_.path()); | 450 dummy_properties.set_working_dir(fake_user_desktop_.path()); |
447 dummy_properties.set_arguments(L"--dummy --args"); | 451 dummy_properties.set_arguments(L"--dummy --args"); |
448 dummy_properties.set_app_id(L"El.Dummiest"); | 452 dummy_properties.set_app_id(L"El.Dummiest"); |
449 | 453 |
450 base::FilePath start_menu_shortcut; | 454 base::FilePath start_menu_shortcut; |
451 base::FilePath start_menu_subdir_shortcut; | 455 base::FilePath start_menu_subdir_shortcut; |
452 if (shortcut_level_ == installer::CURRENT_USER) { | 456 if (shortcut_level_ == installer::CURRENT_USER) { |
453 start_menu_shortcut = user_start_menu_shortcut_; | 457 start_menu_shortcut = user_start_menu_shortcut_; |
454 start_menu_subdir_shortcut = user_start_menu_subdir_shortcut_; | 458 start_menu_subdir_shortcut = user_start_menu_subdir_shortcut_; |
(...skipping 25 matching lines...) Expand all Loading... |
480 installer::INSTALL_SHORTCUT_REPLACE_EXISTING, | 484 installer::INSTALL_SHORTCUT_REPLACE_EXISTING, |
481 installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL, | 485 installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL, |
482 installer::INSTALL_SHORTCUT_CREATE_ALL), | 486 installer::INSTALL_SHORTCUT_CREATE_ALL), |
483 testing::Values( | 487 testing::Values( |
484 installer::CURRENT_USER, | 488 installer::CURRENT_USER, |
485 installer::ALL_USERS))); | 489 installer::ALL_USERS))); |
486 | 490 |
487 TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { | 491 TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { |
488 base::win::ShortcutProperties dummy_properties; | 492 base::win::ShortcutProperties dummy_properties; |
489 base::FilePath dummy_target; | 493 base::FilePath dummy_target; |
490 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); | 494 ASSERT_TRUE( |
| 495 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &dummy_target)); |
491 dummy_properties.set_target(dummy_target); | 496 dummy_properties.set_target(dummy_target); |
492 | 497 |
493 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 498 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
494 system_desktop_shortcut_, dummy_properties, | 499 system_desktop_shortcut_, dummy_properties, |
495 base::win::SHORTCUT_CREATE_ALWAYS)); | 500 base::win::SHORTCUT_CREATE_ALWAYS)); |
496 ASSERT_TRUE(base::CreateDirectory( | 501 ASSERT_TRUE(base::CreateDirectory( |
497 system_start_menu_shortcut_.DirName())); | 502 system_start_menu_shortcut_.DirName())); |
498 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 503 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
499 system_start_menu_shortcut_, dummy_properties, | 504 system_start_menu_shortcut_, dummy_properties, |
500 base::win::SHORTCUT_CREATE_ALWAYS)); | 505 base::win::SHORTCUT_CREATE_ALWAYS)); |
(...skipping 15 matching lines...) Expand all Loading... |
516 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); | 521 base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); |
517 base::win::ValidateShortcut(user_quick_launch_shortcut_, | 522 base::win::ValidateShortcut(user_quick_launch_shortcut_, |
518 expected_properties_); | 523 expected_properties_); |
519 base::win::ValidateShortcut(user_start_menu_shortcut_, | 524 base::win::ValidateShortcut(user_start_menu_shortcut_, |
520 expected_start_menu_properties_); | 525 expected_start_menu_properties_); |
521 } | 526 } |
522 | 527 |
523 TEST_F(InstallShortcutTest, CreateIfNoSystemLevelSomeSystemShortcutsExist) { | 528 TEST_F(InstallShortcutTest, CreateIfNoSystemLevelSomeSystemShortcutsExist) { |
524 base::win::ShortcutProperties dummy_properties; | 529 base::win::ShortcutProperties dummy_properties; |
525 base::FilePath dummy_target; | 530 base::FilePath dummy_target; |
526 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); | 531 ASSERT_TRUE( |
| 532 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &dummy_target)); |
527 dummy_properties.set_target(dummy_target); | 533 dummy_properties.set_target(dummy_target); |
528 | 534 |
529 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( | 535 ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( |
530 system_desktop_shortcut_, dummy_properties, | 536 system_desktop_shortcut_, dummy_properties, |
531 base::win::SHORTCUT_CREATE_ALWAYS)); | 537 base::win::SHORTCUT_CREATE_ALWAYS)); |
532 | 538 |
533 installer::CreateOrUpdateShortcuts( | 539 installer::CreateOrUpdateShortcuts( |
534 chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, | 540 chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, |
535 installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); | 541 installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); |
536 ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); | 542 ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 820 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
815 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 821 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
816 } | 822 } |
817 | 823 |
818 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { | 824 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { |
819 base::string16 val(L"Google Chrome"); | 825 base::string16 val(L"Google Chrome"); |
820 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; | 826 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; |
821 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 827 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
822 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 828 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
823 } | 829 } |
OLD | NEW |