| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "base/test/test_shortcut_win.h" |
| 11 #include "base/win/shortcut.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/profiles/profile_shortcut_manager.h" | 14 #include "chrome/browser/profiles/profile_shortcut_manager.h" |
| 13 #include "chrome/installer/util/browser_distribution.h" | 15 #include "chrome/installer/util/browser_distribution.h" |
| 14 #include "chrome/installer/util/shell_util.h" | 16 #include "chrome/installer/util/shell_util.h" |
| 15 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 16 #include "chrome/test/base/testing_pref_service.h" | 18 #include "chrome/test/base/testing_pref_service.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
| 18 #include "chrome/test/base/testing_profile_manager.h" | 20 #include "chrome/test/base/testing_profile_manager.h" |
| 19 #include "content/public/test/test_browser_thread.h" | 21 #include "content/public/test/test_browser_thread.h" |
| 20 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
| 23 | 25 |
| 24 using content::BrowserThread; | 26 using content::BrowserThread; |
| 25 | 27 |
| 26 namespace { | 28 namespace { |
| 27 | 29 |
| 28 ShellUtil::VerifyShortcutStatus VerifyProfileShortcut( | 30 base::win::VerifyShortcutStatus VerifyProfileShortcut( |
| 29 const string16& profile_name) { | 31 const string16& profile_name) { |
| 30 FilePath exe_path; | 32 FilePath exe_path; |
| 31 CHECK(PathService::Get(base::FILE_EXE, &exe_path)); | 33 EXPECT_TRUE(PathService::Get(base::FILE_EXE, &exe_path)); |
| 32 | 34 |
| 33 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 35 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
| 34 | 36 |
| 35 // Get the desktop path of the current user. | 37 // Get the desktop path of the current user. |
| 36 FilePath shortcut_path; | 38 FilePath shortcut_path; |
| 37 ShellUtil::GetDesktopPath(false, &shortcut_path); | 39 ShellUtil::GetDesktopPath(false, &shortcut_path); |
| 38 // Get the name of the shortcut with profile attached | 40 // Get the name of the shortcut with profile attached |
| 39 string16 shortcut_name; | 41 string16 shortcut_name; |
| 40 ShellUtil::GetChromeShortcutName(dist, false, profile_name, | 42 ShellUtil::GetChromeShortcutName(dist, false, profile_name, |
| 41 &shortcut_name); | 43 &shortcut_name); |
| 42 shortcut_path = shortcut_path.Append(shortcut_name); | 44 shortcut_path = shortcut_path.Append(shortcut_name); |
| 43 | 45 |
| 44 return ShellUtil::VerifyChromeShortcut( | 46 // TODO(hallielaine): With this new struct method for VerifyShortcut you can |
| 45 exe_path.value(), shortcut_path.value(), dist->GetAppDescription(), | 47 // now test more properties like: arguments, icon, icon_index, and app_id. |
| 46 0); | 48 base::win::ShortcutProperties expected_properties; |
| 49 expected_properties.set_target(exe_path); |
| 50 expected_properties.set_description(dist->GetAppDescription()); |
| 51 expected_properties.set_dual_mode(false); |
| 52 return base::win::VerifyShortcut(shortcut_path, expected_properties); |
| 47 } | 53 } |
| 48 | 54 |
| 49 } // namespace | 55 } // namespace |
| 50 | 56 |
| 51 class ProfileShortcutManagerTest : public testing::Test { | 57 class ProfileShortcutManagerTest : public testing::Test { |
| 52 protected: | 58 protected: |
| 53 ProfileShortcutManagerTest() | 59 ProfileShortcutManagerTest() |
| 54 : ui_thread_(BrowserThread::UI, &message_loop_), | 60 : ui_thread_(BrowserThread::UI, &message_loop_), |
| 55 file_thread_(BrowserThread::FILE, &message_loop_) { | 61 file_thread_(BrowserThread::FILE, &message_loop_) { |
| 56 } | 62 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 87 profile_manager_->profile_info_cache()->GetPathOfProfileAtIndex(0); | 93 profile_manager_->profile_info_cache()->GetPathOfProfileAtIndex(0); |
| 88 string16 profile_name; | 94 string16 profile_name; |
| 89 if (i != num_profiles - 1) { | 95 if (i != num_profiles - 1) { |
| 90 profile_name = | 96 profile_name = |
| 91 profile_manager_->profile_info_cache()->GetNameOfProfileAtIndex(0); | 97 profile_manager_->profile_info_cache()->GetNameOfProfileAtIndex(0); |
| 92 } | 98 } |
| 93 profile_manager_->profile_info_cache()->DeleteProfileFromCache( | 99 profile_manager_->profile_info_cache()->DeleteProfileFromCache( |
| 94 profile_path); | 100 profile_path); |
| 95 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 101 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 96 MessageLoop::current()->Run(); | 102 MessageLoop::current()->Run(); |
| 97 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 103 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 98 VerifyProfileShortcut(profile_name)); | 104 VerifyProfileShortcut(profile_name)); |
| 99 ASSERT_FALSE(file_util::PathExists(profile_path.Append( | 105 ASSERT_FALSE(file_util::PathExists(profile_path.Append( |
| 100 FILE_PATH_LITERAL("Google Profile.ico")))); | 106 FILE_PATH_LITERAL("Google Profile.ico")))); |
| 101 } | 107 } |
| 102 } | 108 } |
| 103 | 109 |
| 104 void SetupDefaultProfileShortcut() { | 110 void SetupDefaultProfileShortcut() { |
| 105 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 111 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 106 VerifyProfileShortcut(profile_name_)); | 112 VerifyProfileShortcut(profile_name_)); |
| 107 | 113 |
| 108 profile_manager_->profile_info_cache()->AddProfileToCache( | 114 profile_manager_->profile_info_cache()->AddProfileToCache( |
| 109 dest_path_, profile_name_, string16(), 0); | 115 dest_path_, profile_name_, string16(), 0); |
| 110 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 116 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
| 111 CreateProfileShortcut(dest_path_); | 117 CreateProfileShortcut(dest_path_); |
| 112 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 118 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 113 MessageLoop::current()->Run(); | 119 MessageLoop::current()->Run(); |
| 114 // We now have 1 profile, so we expect a new shortcut with no profile | 120 // We now have 1 profile, so we expect a new shortcut with no profile |
| 115 // information. | 121 // information. |
| 116 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 122 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 117 VerifyProfileShortcut(string16())); | 123 VerifyProfileShortcut(string16())); |
| 118 } | 124 } |
| 119 | 125 |
| 120 void SetupAndCreateTwoShortcuts() { | 126 void SetupAndCreateTwoShortcuts() { |
| 121 ASSERT_EQ(0, profile_manager_->profile_info_cache()->GetNumberOfProfiles()); | 127 ASSERT_EQ(0, profile_manager_->profile_info_cache()->GetNumberOfProfiles()); |
| 122 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 128 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 123 VerifyProfileShortcut(profile_name_)); | 129 VerifyProfileShortcut(profile_name_)); |
| 124 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 130 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 125 VerifyProfileShortcut(second_profile_name_)); | 131 VerifyProfileShortcut(second_profile_name_)); |
| 126 | 132 |
| 127 profile_manager_->profile_info_cache()->AddProfileToCache( | 133 profile_manager_->profile_info_cache()->AddProfileToCache( |
| 128 dest_path_, profile_name_, string16(), 0); | 134 dest_path_, profile_name_, string16(), 0); |
| 129 profile_manager_->profile_info_cache()->AddProfileToCache( | 135 profile_manager_->profile_info_cache()->AddProfileToCache( |
| 130 second_dest_path_, second_profile_name_, string16(), 0); | 136 second_dest_path_, second_profile_name_, string16(), 0); |
| 131 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 137 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
| 132 CreateProfileShortcut(dest_path_); | 138 CreateProfileShortcut(dest_path_); |
| 133 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 139 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
| 134 CreateProfileShortcut(second_dest_path_); | 140 CreateProfileShortcut(second_dest_path_); |
| 135 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 141 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 136 MessageLoop::current()->Run(); | 142 MessageLoop::current()->Run(); |
| 137 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 143 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 138 VerifyProfileShortcut(profile_name_)); | 144 VerifyProfileShortcut(profile_name_)); |
| 139 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 145 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 140 VerifyProfileShortcut(second_profile_name_)); | 146 VerifyProfileShortcut(second_profile_name_)); |
| 141 } | 147 } |
| 142 | 148 |
| 143 MessageLoopForUI message_loop_; | 149 MessageLoopForUI message_loop_; |
| 144 content::TestBrowserThread ui_thread_; | 150 content::TestBrowserThread ui_thread_; |
| 145 content::TestBrowserThread file_thread_; | 151 content::TestBrowserThread file_thread_; |
| 146 scoped_ptr<TestingProfileManager> profile_manager_; | 152 scoped_ptr<TestingProfileManager> profile_manager_; |
| 147 FilePath dest_path_; | 153 FilePath dest_path_; |
| 148 string16 profile_name_; | 154 string16 profile_name_; |
| 149 FilePath second_dest_path_; | 155 FilePath second_dest_path_; |
| 150 string16 second_profile_name_; | 156 string16 second_profile_name_; |
| 151 }; | 157 }; |
| 152 | 158 |
| 153 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreate) { | 159 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreate) { |
| 154 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 160 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
| 155 return; | 161 return; |
| 156 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); | 162 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); |
| 157 | 163 |
| 158 profile_manager_->profile_info_cache()->AddProfileToCache( | 164 profile_manager_->profile_info_cache()->AddProfileToCache( |
| 159 second_dest_path_, second_profile_name_, string16(), 0); | 165 second_dest_path_, second_profile_name_, string16(), 0); |
| 160 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 166 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
| 161 CreateProfileShortcut(second_dest_path_); | 167 CreateProfileShortcut(second_dest_path_); |
| 162 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 168 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 163 MessageLoop::current()->Run(); | 169 MessageLoop::current()->Run(); |
| 164 | 170 |
| 165 // We now have 2 profiles, so we expect a new shortcut with profile | 171 // We now have 2 profiles, so we expect a new shortcut with profile |
| 166 // information for this 2nd profile. | 172 // information for this 2nd profile. |
| 167 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 173 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 168 VerifyProfileShortcut(second_profile_name_)); | 174 VerifyProfileShortcut(second_profile_name_)); |
| 169 ASSERT_TRUE(file_util::PathExists(second_dest_path_.Append( | 175 ASSERT_TRUE(file_util::PathExists(second_dest_path_.Append( |
| 170 FILE_PATH_LITERAL("Google Profile.ico")))); | 176 FILE_PATH_LITERAL("Google Profile.ico")))); |
| 171 } | 177 } |
| 172 | 178 |
| 173 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) { | 179 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsUpdate) { |
| 174 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 180 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
| 175 return; | 181 return; |
| 176 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); | 182 ProfileShortcutManagerTest::SetupDefaultProfileShortcut(); |
| 177 | 183 |
| 178 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 184 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 179 VerifyProfileShortcut(second_profile_name_)); | 185 VerifyProfileShortcut(second_profile_name_)); |
| 180 | 186 |
| 181 profile_manager_->profile_info_cache()->AddProfileToCache( | 187 profile_manager_->profile_info_cache()->AddProfileToCache( |
| 182 second_dest_path_, second_profile_name_, string16(), 0); | 188 second_dest_path_, second_profile_name_, string16(), 0); |
| 183 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 189 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
| 184 CreateProfileShortcut(second_dest_path_); | 190 CreateProfileShortcut(second_dest_path_); |
| 185 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 191 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 186 MessageLoop::current()->Run(); | 192 MessageLoop::current()->Run(); |
| 187 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 193 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 188 VerifyProfileShortcut(second_profile_name_)); | 194 VerifyProfileShortcut(second_profile_name_)); |
| 189 | 195 |
| 190 // Cause an update in ProfileShortcutManager by modifying the profile info | 196 // Cause an update in ProfileShortcutManager by modifying the profile info |
| 191 // cache. | 197 // cache. |
| 192 string16 new_profile_name = ASCIIToUTF16("New Profile Name"); | 198 string16 new_profile_name = ASCIIToUTF16("New Profile Name"); |
| 193 profile_manager_->profile_info_cache()->SetNameOfProfileAtIndex( | 199 profile_manager_->profile_info_cache()->SetNameOfProfileAtIndex( |
| 194 profile_manager_->profile_info_cache()->GetIndexOfProfileWithPath( | 200 profile_manager_->profile_info_cache()->GetIndexOfProfileWithPath( |
| 195 second_dest_path_), | 201 second_dest_path_), |
| 196 new_profile_name); | 202 new_profile_name); |
| 197 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 203 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 198 MessageLoop::current()->Run(); | 204 MessageLoop::current()->Run(); |
| 199 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 205 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 200 VerifyProfileShortcut(second_profile_name_)); | 206 VerifyProfileShortcut(second_profile_name_)); |
| 201 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 207 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 202 VerifyProfileShortcut(new_profile_name)); | 208 VerifyProfileShortcut(new_profile_name)); |
| 203 } | 209 } |
| 204 | 210 |
| 205 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsDeleteSecondToLast) { | 211 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsDeleteSecondToLast) { |
| 206 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 212 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
| 207 return; | 213 return; |
| 208 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); | 214 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); |
| 209 | 215 |
| 210 // Delete one shortcut | 216 // Delete one shortcut |
| 211 profile_manager_->profile_info_cache()->DeleteProfileFromCache( | 217 profile_manager_->profile_info_cache()->DeleteProfileFromCache( |
| 212 second_dest_path_); | 218 second_dest_path_); |
| 213 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 219 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 214 MessageLoop::current()->Run(); | 220 MessageLoop::current()->Run(); |
| 215 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 221 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 216 VerifyProfileShortcut(second_profile_name_)); | 222 VerifyProfileShortcut(second_profile_name_)); |
| 217 | 223 |
| 218 // Verify that the profile name has been removed from the remaining shortcut | 224 // Verify that the profile name has been removed from the remaining shortcut |
| 219 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 225 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 220 VerifyProfileShortcut(string16())); | 226 VerifyProfileShortcut(string16())); |
| 221 // Verify that an additional shortcut, with the default profile's name does | 227 // Verify that an additional shortcut, with the default profile's name does |
| 222 // not exist | 228 // not exist |
| 223 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 229 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 224 VerifyProfileShortcut(profile_name_)); | 230 VerifyProfileShortcut(profile_name_)); |
| 225 } | 231 } |
| 226 | 232 |
| 227 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) { | 233 TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) { |
| 228 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) | 234 if (!profile_manager_->profile_manager()->profile_shortcut_manager()) |
| 229 return; | 235 return; |
| 230 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); | 236 ProfileShortcutManagerTest::SetupAndCreateTwoShortcuts(); |
| 231 | 237 |
| 232 // Delete one shortcut | 238 // Delete one shortcut |
| 233 profile_manager_->profile_info_cache()->DeleteProfileFromCache( | 239 profile_manager_->profile_info_cache()->DeleteProfileFromCache( |
| 234 second_dest_path_); | 240 second_dest_path_); |
| 235 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 241 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 236 MessageLoop::current()->Run(); | 242 MessageLoop::current()->Run(); |
| 237 | 243 |
| 238 // Verify that a default shortcut exists (no profile name/avatar) | 244 // Verify that a default shortcut exists (no profile name/avatar) |
| 239 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 245 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 240 VerifyProfileShortcut(string16())); | 246 VerifyProfileShortcut(string16())); |
| 241 // Verify that an additional shortcut, with the default profile's name does | 247 // Verify that an additional shortcut, with the default profile's name does |
| 242 // not exist | 248 // not exist |
| 243 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 249 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 244 VerifyProfileShortcut(profile_name_)); | 250 VerifyProfileShortcut(profile_name_)); |
| 245 | 251 |
| 246 // Create a second profile and shortcut | 252 // Create a second profile and shortcut |
| 247 profile_manager_->profile_info_cache()->AddProfileToCache( | 253 profile_manager_->profile_info_cache()->AddProfileToCache( |
| 248 second_dest_path_, second_profile_name_, string16(), 0); | 254 second_dest_path_, second_profile_name_, string16(), 0); |
| 249 profile_manager_->profile_manager()->profile_shortcut_manager()-> | 255 profile_manager_->profile_manager()->profile_shortcut_manager()-> |
| 250 CreateProfileShortcut(second_dest_path_); | 256 CreateProfileShortcut(second_dest_path_); |
| 251 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 257 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| 252 MessageLoop::current()->Run(); | 258 MessageLoop::current()->Run(); |
| 253 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 259 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 254 VerifyProfileShortcut(second_profile_name_)); | 260 VerifyProfileShortcut(second_profile_name_)); |
| 255 | 261 |
| 256 // Verify that the original shortcut received the profile's name | 262 // Verify that the original shortcut received the profile's name |
| 257 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_SUCCESS, | 263 EXPECT_EQ(base::win::VERIFY_SHORTCUT_SUCCESS, |
| 258 VerifyProfileShortcut(profile_name_)); | 264 VerifyProfileShortcut(profile_name_)); |
| 259 // Verify that a default shortcut no longer exists | 265 // Verify that a default shortcut no longer exists |
| 260 EXPECT_EQ(ShellUtil::VERIFY_SHORTCUT_FAILURE_UNEXPECTED, | 266 EXPECT_EQ(base::win::VERIFY_SHORTCUT_FAILURE_FILE_NOT_FOUND, |
| 261 VerifyProfileShortcut(string16())); | 267 VerifyProfileShortcut(string16())); |
| 262 } | 268 } |
| 263 | 269 |
| OLD | NEW |