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/test/scoped_path_override.h" | 8 #include "base/test/scoped_path_override.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/test/test_shortcut_win.h" | 10 #include "base/test/test_shortcut_win.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 second_dest_path_ = | 96 second_dest_path_ = |
97 profile_manager_->profile_info_cache()->GetUserDataDir(); | 97 profile_manager_->profile_info_cache()->GetUserDataDir(); |
98 second_dest_path_ = | 98 second_dest_path_ = |
99 second_dest_path_.Append(FILE_PATH_LITERAL("My profile 2")); | 99 second_dest_path_.Append(FILE_PATH_LITERAL("My profile 2")); |
100 file_util::CreateDirectoryW(second_dest_path_); | 100 file_util::CreateDirectoryW(second_dest_path_); |
101 second_profile_name_ = ASCIIToUTF16("My profile 2"); | 101 second_profile_name_ = ASCIIToUTF16("My profile 2"); |
102 } | 102 } |
103 | 103 |
104 virtual void TearDown() OVERRIDE { | 104 virtual void TearDown() OVERRIDE { |
105 message_loop_.RunAllPending(); | 105 message_loop_.RunUntilIdle(); |
106 | 106 |
107 int num_profiles = | 107 int num_profiles = |
108 profile_manager_->profile_info_cache()->GetNumberOfProfiles(); | 108 profile_manager_->profile_info_cache()->GetNumberOfProfiles(); |
109 | 109 |
110 // Remove all shortcuts except the last (since it will no longer have | 110 // Remove all shortcuts except the last (since it will no longer have |
111 // an appended name). | 111 // an appended name). |
112 for (int i = 0; i < num_profiles; ++i) { | 112 for (int i = 0; i < num_profiles; ++i) { |
113 const FilePath profile_path = | 113 const FilePath profile_path = |
114 profile_manager_->profile_info_cache()->GetPathOfProfileAtIndex(0); | 114 profile_manager_->profile_info_cache()->GetPathOfProfileAtIndex(0); |
115 string16 profile_name; | 115 string16 profile_name; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 CreateProfileShortcut(second_dest_path_); | 260 CreateProfileShortcut(second_dest_path_); |
261 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 261 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
262 MessageLoop::current()->Run(); | 262 MessageLoop::current()->Run(); |
263 ValidateProfileShortcut(dist_, second_profile_name_); | 263 ValidateProfileShortcut(dist_, second_profile_name_); |
264 | 264 |
265 // Verify that the original shortcut received the profile's name | 265 // Verify that the original shortcut received the profile's name |
266 ValidateProfileShortcut(dist_, profile_name_); | 266 ValidateProfileShortcut(dist_, profile_name_); |
267 // Verify that a default shortcut no longer exists | 267 // Verify that a default shortcut no longer exists |
268 EXPECT_FALSE(ProfileShortcutExists(dist_, string16())); | 268 EXPECT_FALSE(ProfileShortcutExists(dist_, string16())); |
269 } | 269 } |
OLD | NEW |