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 <objbase.h> // For CoInitialize(). | 5 #include <objbase.h> // For CoInitialize(). |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(string16())); | 485 EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(string16())); |
486 } | 486 } |
487 | 487 |
488 TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) { | 488 TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) { |
489 SetupAndCreateTwoShortcuts(FROM_HERE); | 489 SetupAndCreateTwoShortcuts(FROM_HERE); |
490 | 490 |
491 const base::FilePath profile_2_shortcut_path_1 = | 491 const base::FilePath profile_2_shortcut_path_1 = |
492 GetDefaultShortcutPathForProfile(profile_2_name_); | 492 GetDefaultShortcutPathForProfile(profile_2_name_); |
493 const base::FilePath profile_2_shortcut_path_2 = | 493 const base::FilePath profile_2_shortcut_path_2 = |
494 GetUserShortcutsDirectory().Append(L"MyChrome.lnk"); | 494 GetUserShortcutsDirectory().Append(L"MyChrome.lnk"); |
495 ASSERT_TRUE(file_util::Move(profile_2_shortcut_path_1, | 495 ASSERT_TRUE(base::Move(profile_2_shortcut_path_1, |
496 profile_2_shortcut_path_2)); | 496 profile_2_shortcut_path_2)); |
497 | 497 |
498 // Ensure that a new shortcut does not get made if the old one was renamed. | 498 // Ensure that a new shortcut does not get made if the old one was renamed. |
499 profile_shortcut_manager_->CreateProfileShortcut(profile_2_path_); | 499 profile_shortcut_manager_->CreateProfileShortcut(profile_2_path_); |
500 RunPendingTasks(); | 500 RunPendingTasks(); |
501 EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_2_name_)); | 501 EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_2_name_)); |
502 ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_2, | 502 ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_2, |
503 profile_2_path_); | 503 profile_2_path_); |
504 | 504 |
505 // Delete the renamed shortcut and try to create it again, which should work. | 505 // Delete the renamed shortcut and try to create it again, which should work. |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 profile_info_cache_->DeleteProfileFromCache(profile_2_path_); | 765 profile_info_cache_->DeleteProfileFromCache(profile_2_path_); |
766 RunPendingTasks(); | 766 RunPendingTasks(); |
767 | 767 |
768 // Verify that only the system-level shortcut still exists. | 768 // Verify that only the system-level shortcut still exists. |
769 EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); | 769 EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); |
770 EXPECT_FALSE(file_util::PathExists( | 770 EXPECT_FALSE(file_util::PathExists( |
771 GetDefaultShortcutPathForProfile(string16()))); | 771 GetDefaultShortcutPathForProfile(string16()))); |
772 EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); | 772 EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); |
773 EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); | 773 EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); |
774 } | 774 } |
OLD | NEW |