| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 base::FilePath CreateProfileDirectory(const string16& profile_name) { | 80 base::FilePath CreateProfileDirectory(const string16& profile_name) { |
| 81 const base::FilePath profile_path = | 81 const base::FilePath profile_path = |
| 82 profile_info_cache_->GetUserDataDir().Append(profile_name); | 82 profile_info_cache_->GetUserDataDir().Append(profile_name); |
| 83 file_util::CreateDirectoryW(profile_path); | 83 file_util::CreateDirectoryW(profile_path); |
| 84 return profile_path; | 84 return profile_path; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void RunPendingTasks() { | 87 void RunPendingTasks() { |
| 88 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 88 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 89 MessageLoop::current()->Run(); | 89 base::MessageLoop::QuitClosure()); |
| 90 base::MessageLoop::current()->Run(); |
| 90 } | 91 } |
| 91 | 92 |
| 92 void SetupDefaultProfileShortcut(const tracked_objects::Location& location) { | 93 void SetupDefaultProfileShortcut(const tracked_objects::Location& location) { |
| 93 ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_)) | 94 ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_)) |
| 94 << location.ToString(); | 95 << location.ToString(); |
| 95 // A non-badged shortcut for chrome is automatically created with the | 96 // A non-badged shortcut for chrome is automatically created with the |
| 96 // first profile (for the case when the user deletes their only profile). | 97 // first profile (for the case when the user deletes their only profile). |
| 97 profile_info_cache_->AddProfileToCache(profile_1_path_, profile_1_name_, | 98 profile_info_cache_->AddProfileToCache(profile_1_path_, profile_1_name_, |
| 98 string16(), 0, false); | 99 string16(), 0, false); |
| 99 RunPendingTasks(); | 100 RunPendingTasks(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 264 |
| 264 base::FilePath GetSystemShortcutsDirectory() { | 265 base::FilePath GetSystemShortcutsDirectory() { |
| 265 base::FilePath system_shortcuts_directory; | 266 base::FilePath system_shortcuts_directory; |
| 266 EXPECT_TRUE(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, | 267 EXPECT_TRUE(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, |
| 267 GetDistribution(), | 268 GetDistribution(), |
| 268 ShellUtil::SYSTEM_LEVEL, | 269 ShellUtil::SYSTEM_LEVEL, |
| 269 &system_shortcuts_directory)); | 270 &system_shortcuts_directory)); |
| 270 return system_shortcuts_directory; | 271 return system_shortcuts_directory; |
| 271 } | 272 } |
| 272 | 273 |
| 273 MessageLoopForUI message_loop_; | 274 base::MessageLoopForUI message_loop_; |
| 274 content::TestBrowserThread ui_thread_; | 275 content::TestBrowserThread ui_thread_; |
| 275 content::TestBrowserThread file_thread_; | 276 content::TestBrowserThread file_thread_; |
| 276 scoped_ptr<TestingProfileManager> profile_manager_; | 277 scoped_ptr<TestingProfileManager> profile_manager_; |
| 277 scoped_ptr<ProfileShortcutManager> profile_shortcut_manager_; | 278 scoped_ptr<ProfileShortcutManager> profile_shortcut_manager_; |
| 278 ProfileInfoCache* profile_info_cache_; | 279 ProfileInfoCache* profile_info_cache_; |
| 279 base::ScopedPathOverride fake_user_desktop_; | 280 base::ScopedPathOverride fake_user_desktop_; |
| 280 base::ScopedPathOverride fake_system_desktop_; | 281 base::ScopedPathOverride fake_system_desktop_; |
| 281 string16 profile_1_name_; | 282 string16 profile_1_name_; |
| 282 base::FilePath profile_1_path_; | 283 base::FilePath profile_1_path_; |
| 283 string16 profile_2_name_; | 284 string16 profile_2_name_; |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 profile_info_cache_->DeleteProfileFromCache(profile_2_path_); | 767 profile_info_cache_->DeleteProfileFromCache(profile_2_path_); |
| 767 RunPendingTasks(); | 768 RunPendingTasks(); |
| 768 | 769 |
| 769 // Verify that only the system-level shortcut still exists. | 770 // Verify that only the system-level shortcut still exists. |
| 770 EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); | 771 EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); |
| 771 EXPECT_FALSE(file_util::PathExists( | 772 EXPECT_FALSE(file_util::PathExists( |
| 772 GetDefaultShortcutPathForProfile(string16()))); | 773 GetDefaultShortcutPathForProfile(string16()))); |
| 773 EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); | 774 EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); |
| 774 EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); | 775 EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); |
| 775 } | 776 } |
| OLD | NEW |