Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 base::FilePath CreateProfileDirectory(const string16& profile_name) { 81 base::FilePath CreateProfileDirectory(const string16& profile_name) {
82 const base::FilePath profile_path = 82 const base::FilePath profile_path =
83 profile_info_cache_->GetUserDataDir().Append(profile_name); 83 profile_info_cache_->GetUserDataDir().Append(profile_name);
84 file_util::CreateDirectoryW(profile_path); 84 file_util::CreateDirectoryW(profile_path);
85 return profile_path; 85 return profile_path;
86 } 86 }
87 87
88 void RunPendingTasks() { 88 void RunPendingTasks() {
89 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 89 base::MessageLoop::current()->PostTask(FROM_HERE,
90 MessageLoop::current()->Run(); 90 base::MessageLoop::QuitClosure());
91 base::MessageLoop::current()->Run();
91 } 92 }
92 93
93 void SetupDefaultProfileShortcut(const tracked_objects::Location& location) { 94 void SetupDefaultProfileShortcut(const tracked_objects::Location& location) {
94 ASSERT_EQ(0, profile_info_cache_->GetNumberOfProfiles()) 95 ASSERT_EQ(0, profile_info_cache_->GetNumberOfProfiles())
95 << location.ToString(); 96 << location.ToString();
96 ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_)) 97 ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_))
97 << location.ToString(); 98 << location.ToString();
98 profile_info_cache_->AddProfileToCache(profile_1_path_, profile_1_name_, 99 profile_info_cache_->AddProfileToCache(profile_1_path_, profile_1_name_,
99 string16(), 0, false); 100 string16(), 0, false);
100 // Also create a non-badged shortcut for Chrome, which is conveniently done 101 // Also create a non-badged shortcut for Chrome, which is conveniently done
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 263
263 base::FilePath GetSystemShortcutsDirectory() { 264 base::FilePath GetSystemShortcutsDirectory() {
264 base::FilePath system_shortcuts_directory; 265 base::FilePath system_shortcuts_directory;
265 EXPECT_TRUE(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP, 266 EXPECT_TRUE(ShellUtil::GetShortcutPath(ShellUtil::SHORTCUT_LOCATION_DESKTOP,
266 GetDistribution(), 267 GetDistribution(),
267 ShellUtil::SYSTEM_LEVEL, 268 ShellUtil::SYSTEM_LEVEL,
268 &system_shortcuts_directory)); 269 &system_shortcuts_directory));
269 return system_shortcuts_directory; 270 return system_shortcuts_directory;
270 } 271 }
271 272
272 MessageLoopForUI message_loop_; 273 base::MessageLoopForUI message_loop_;
273 content::TestBrowserThread ui_thread_; 274 content::TestBrowserThread ui_thread_;
274 content::TestBrowserThread file_thread_; 275 content::TestBrowserThread file_thread_;
275 scoped_ptr<TestingProfileManager> profile_manager_; 276 scoped_ptr<TestingProfileManager> profile_manager_;
276 scoped_ptr<ProfileShortcutManager> profile_shortcut_manager_; 277 scoped_ptr<ProfileShortcutManager> profile_shortcut_manager_;
277 ProfileInfoCache* profile_info_cache_; 278 ProfileInfoCache* profile_info_cache_;
278 base::ScopedPathOverride fake_user_desktop_; 279 base::ScopedPathOverride fake_user_desktop_;
279 base::ScopedPathOverride fake_system_desktop_; 280 base::ScopedPathOverride fake_system_desktop_;
280 string16 profile_1_name_; 281 string16 profile_1_name_;
281 base::FilePath profile_1_path_; 282 base::FilePath profile_1_path_;
282 string16 profile_2_name_; 283 string16 profile_2_name_;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 profile_info_cache_->DeleteProfileFromCache(profile_2_path_); 766 profile_info_cache_->DeleteProfileFromCache(profile_2_path_);
766 RunPendingTasks(); 767 RunPendingTasks();
767 768
768 // Verify that only the system-level shortcut still exists. 769 // Verify that only the system-level shortcut still exists.
769 EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); 770 EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path));
770 EXPECT_FALSE(file_util::PathExists( 771 EXPECT_FALSE(file_util::PathExists(
771 GetDefaultShortcutPathForProfile(string16()))); 772 GetDefaultShortcutPathForProfile(string16())));
772 EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); 773 EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path));
773 EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); 774 EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path));
774 } 775 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698