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

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

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 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
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 #include <stddef.h> 6 #include <stddef.h>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/single_thread_task_runner.h"
13 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
14 #include "base/test/scoped_path_override.h" 15 #include "base/test/scoped_path_override.h"
15 #include "base/test/test_shortcut_win.h" 16 #include "base/test/test_shortcut_win.h"
17 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/win/shortcut.h" 18 #include "base/win/shortcut.h"
17 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/profiles/profile_attributes_entry.h" 20 #include "chrome/browser/profiles/profile_attributes_entry.h"
19 #include "chrome/browser/profiles/profile_attributes_storage.h" 21 #include "chrome/browser/profiles/profile_attributes_storage.h"
20 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/browser/profiles/profile_shortcut_manager.h" 23 #include "chrome/browser/profiles/profile_shortcut_manager.h"
22 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" 24 #include "chrome/browser/profiles/profile_shortcut_manager_win.h"
23 #include "chrome/browser/shell_integration_win.h" 25 #include "chrome/browser/shell_integration_win.h"
24 #include "chrome/grit/chromium_strings.h" 26 #include "chrome/grit/chromium_strings.h"
25 #include "chrome/installer/util/browser_distribution.h" 27 #include "chrome/installer/util/browser_distribution.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 87 }
86 88
87 base::FilePath CreateProfileDirectory(const base::string16& profile_name) { 89 base::FilePath CreateProfileDirectory(const base::string16& profile_name) {
88 const base::FilePath profile_path = 90 const base::FilePath profile_path =
89 profile_manager_->profiles_dir().Append(profile_name); 91 profile_manager_->profiles_dir().Append(profile_name);
90 base::CreateDirectory(profile_path); 92 base::CreateDirectory(profile_path);
91 return profile_path; 93 return profile_path;
92 } 94 }
93 95
94 void RunPendingTasks() { 96 void RunPendingTasks() {
95 base::MessageLoop::current()->PostTask( 97 base::ThreadTaskRunnerHandle::Get()->PostTask(
96 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); 98 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
97 base::MessageLoop::current()->Run(); 99 base::MessageLoop::current()->Run();
98 } 100 }
99 101
100 void SetupDefaultProfileShortcut(const tracked_objects::Location& location) { 102 void SetupDefaultProfileShortcut(const tracked_objects::Location& location) {
101 ASSERT_EQ(0u, profile_attributes_storage_->GetNumberOfProfiles()) 103 ASSERT_EQ(0u, profile_attributes_storage_->GetNumberOfProfiles())
102 << location.ToString(); 104 << location.ToString();
103 ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_)) 105 ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_))
104 << location.ToString(); 106 << location.ToString();
105 profile_attributes_storage_->AddProfile(profile_1_path_, profile_1_name_, 107 profile_attributes_storage_->AddProfile(profile_1_path_, profile_1_name_,
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 GetDefaultShortcutPathForProfile(profile_2_name_))); 1029 GetDefaultShortcutPathForProfile(profile_2_name_)));
1028 EXPECT_TRUE(base::PathExists(profile_3_shortcut_path)); 1030 EXPECT_TRUE(base::PathExists(profile_3_shortcut_path));
1029 profile_attributes_storage_->RemoveProfile(profile_2_path_); 1031 profile_attributes_storage_->RemoveProfile(profile_2_path_);
1030 RunPendingTasks(); 1032 RunPendingTasks();
1031 EXPECT_FALSE(base::PathExists( 1033 EXPECT_FALSE(base::PathExists(
1032 GetDefaultShortcutPathForProfile(profile_2_name_))); 1034 GetDefaultShortcutPathForProfile(profile_2_name_)));
1033 // Only profile3 exists. There should be non-profile shortcut only. 1035 // Only profile3 exists. There should be non-profile shortcut only.
1034 EXPECT_FALSE(base::PathExists(profile_3_shortcut_path)); 1036 EXPECT_FALSE(base::PathExists(profile_3_shortcut_path));
1035 ValidateNonProfileShortcut(FROM_HERE); 1037 ValidateNonProfileShortcut(FROM_HERE);
1036 } 1038 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/printing_layout_browsertest.cc ('k') | chrome/browser/profiles/profile_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698