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

Unified Diff: chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
index 22275dbf8cb7d37920acb58e2039278cd91e6843..ac31a6ae8d42d1d3c7aa6019adf888272970d2fb 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
@@ -73,7 +73,7 @@ class ProfileShortcutManagerTest : public testing::Test {
ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_name));
const base::FilePath icon_path =
profile_path.AppendASCII(profiles::internal::kProfileIconFileName);
- ASSERT_FALSE(file_util::PathExists(icon_path));
+ ASSERT_FALSE(base::PathExists(icon_path));
}
}
@@ -121,7 +121,7 @@ class ProfileShortcutManagerTest : public testing::Test {
// Returns true if the shortcut for this profile exists.
bool ProfileShortcutExistsAtDefaultPath(const string16& profile_name) {
- return file_util::PathExists(
+ return base::PathExists(
GetDefaultShortcutPathForProfile(profile_name));
}
@@ -130,12 +130,12 @@ class ProfileShortcutManagerTest : public testing::Test {
void ValidateProfileShortcutAtPath(const tracked_objects::Location& location,
const base::FilePath& shortcut_path,
const base::FilePath& profile_path) {
- EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString();
+ EXPECT_TRUE(base::PathExists(shortcut_path)) << location.ToString();
// Ensure that the corresponding icon exists.
const base::FilePath icon_path =
profile_path.AppendASCII(profiles::internal::kProfileIconFileName);
- EXPECT_TRUE(file_util::PathExists(icon_path)) << location.ToString();
+ EXPECT_TRUE(base::PathExists(icon_path)) << location.ToString();
base::win::ShortcutProperties expected_properties;
expected_properties.set_app_id(
@@ -161,7 +161,7 @@ class ProfileShortcutManagerTest : public testing::Test {
void ValidateNonProfileShortcutAtPath(
const tracked_objects::Location& location,
const base::FilePath& shortcut_path) {
- EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString();
+ EXPECT_TRUE(base::PathExists(shortcut_path)) << location.ToString();
base::win::ShortcutProperties expected_properties;
expected_properties.set_target(GetExePath());
@@ -197,7 +197,7 @@ class ProfileShortcutManagerTest : public testing::Test {
const string16& shortcut_name) {
const base::FilePath shortcut_path =
GetUserShortcutsDirectory().Append(shortcut_name + installer::kLnkExt);
- EXPECT_FALSE(file_util::PathExists(shortcut_path)) << location.ToString();
+ EXPECT_FALSE(base::PathExists(shortcut_path)) << location.ToString();
installer::Product product(GetDistribution());
ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER);
@@ -206,7 +206,7 @@ class ProfileShortcutManagerTest : public testing::Test {
EXPECT_TRUE(ShellUtil::CreateOrUpdateShortcut(
ShellUtil::SHORTCUT_LOCATION_DESKTOP, GetDistribution(), properties,
ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)) << location.ToString();
- EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString();
+ EXPECT_TRUE(base::PathExists(shortcut_path)) << location.ToString();
return shortcut_path;
}
@@ -223,7 +223,7 @@ class ProfileShortcutManagerTest : public testing::Test {
const base::FilePath system_level_shortcut_path =
GetSystemShortcutsDirectory().Append(
distribution->GetAppShortCutName() + installer::kLnkExt);
- EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path))
+ EXPECT_TRUE(base::PathExists(system_level_shortcut_path))
<< location.ToString();
return system_level_shortcut_path;
}
@@ -392,8 +392,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithoutShortcut) {
// Delete the shortcut for the first profile, but keep the one for the 2nd.
ASSERT_TRUE(base::Delete(profile_1_shortcut_path, false));
- ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_1_shortcut_path));
+ ASSERT_TRUE(base::PathExists(profile_2_shortcut_path));
// Delete the profile that doesn't have a shortcut.
profile_info_cache_->DeleteProfileFromCache(profile_1_path_);
@@ -402,8 +402,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithoutShortcut) {
// Verify that the remaining shortcut does not have a profile name.
ValidateNonProfileShortcut(FROM_HERE);
// Verify that shortcuts with profile names do not exist.
- EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_1_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path));
}
TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) {
@@ -416,8 +416,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) {
// Delete the shortcut for the first profile, but keep the one for the 2nd.
ASSERT_TRUE(base::Delete(profile_1_shortcut_path, false));
- ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_1_shortcut_path));
+ ASSERT_TRUE(base::PathExists(profile_2_shortcut_path));
// Delete the profile that has a shortcut.
profile_info_cache_->DeleteProfileFromCache(profile_2_path_);
@@ -426,8 +426,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) {
// Verify that the remaining shortcut does not have a profile name.
ValidateNonProfileShortcut(FROM_HERE);
// Verify that shortcuts with profile names do not exist.
- EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_1_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path));
}
TEST_F(ProfileShortcutManagerTest, DeleteOnlyProfileWithShortcuts) {
@@ -448,19 +448,19 @@ TEST_F(ProfileShortcutManagerTest, DeleteOnlyProfileWithShortcuts) {
ASSERT_TRUE(base::Delete(profile_2_shortcut_path, false));
// Only the shortcut to the third profile should exist.
- ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- ASSERT_FALSE(file_util::PathExists(profile_2_shortcut_path));
- ASSERT_FALSE(file_util::PathExists(non_profile_shortcut_path));
- ASSERT_TRUE(file_util::PathExists(profile_3_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_1_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_2_shortcut_path));
+ ASSERT_FALSE(base::PathExists(non_profile_shortcut_path));
+ ASSERT_TRUE(base::PathExists(profile_3_shortcut_path));
// Delete the third profile and check that its shortcut is gone and no
// shortcuts have been re-created.
profile_info_cache_->DeleteProfileFromCache(profile_3_path_);
RunPendingTasks();
- ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- ASSERT_FALSE(file_util::PathExists(profile_2_shortcut_path));
- ASSERT_FALSE(file_util::PathExists(profile_3_shortcut_path));
- ASSERT_FALSE(file_util::PathExists(non_profile_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_1_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_2_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_3_shortcut_path));
+ ASSERT_FALSE(base::PathExists(non_profile_shortcut_path));
}
TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) {
@@ -504,7 +504,7 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) {
// Delete the renamed shortcut and try to create it again, which should work.
ASSERT_TRUE(base::Delete(profile_2_shortcut_path_2, false));
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_2));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_2));
profile_shortcut_manager_->CreateProfileShortcut(profile_2_path_);
RunPendingTasks();
ValidateProfileShortcut(FROM_HERE, profile_2_name_, profile_2_path_);
@@ -531,13 +531,13 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsGetDeleted) {
ASSERT_TRUE(base::CopyFile(
GetDefaultShortcutPathForProfile(profile_1_name_),
preserved_profile_1_shortcut_path));
- EXPECT_TRUE(file_util::PathExists(preserved_profile_1_shortcut_path));
+ EXPECT_TRUE(base::PathExists(preserved_profile_1_shortcut_path));
// Delete the profile and ensure both shortcuts were also deleted.
profile_info_cache_->DeleteProfileFromCache(profile_2_path_);
RunPendingTasks();
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_1));
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_2));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_1));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_2));
ValidateNonProfileShortcutAtPath(FROM_HERE,
preserved_profile_1_shortcut_path);
}
@@ -563,7 +563,7 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsAfterProfileRename) {
// The original shortcut should be renamed but the copied shortcut should
// keep its name.
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_1));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_1));
ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_2,
profile_2_path_);
ValidateProfileShortcut(FROM_HERE, new_profile_2_name, profile_2_path_);
@@ -583,7 +583,7 @@ TEST_F(ProfileShortcutManagerTest, UpdateShortcutWithNoFlags) {
// Add another profile and check that the shortcut was replaced with
// a badged shortcut with the right command line for the profile
CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_);
- EXPECT_FALSE(file_util::PathExists(regular_shortcut_path));
+ EXPECT_FALSE(base::PathExists(regular_shortcut_path));
ValidateProfileShortcut(FROM_HERE, profile_1_name_, profile_1_path_);
}
@@ -603,7 +603,7 @@ TEST_F(ProfileShortcutManagerTest, UpdateTwoShortcutsWithNoFlags) {
// Add another profile and check that one shortcut was renamed and that the
// other shortcut was updated but kept the same name.
CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_);
- EXPECT_FALSE(file_util::PathExists(regular_shortcut_path));
+ EXPECT_FALSE(base::PathExists(regular_shortcut_path));
ValidateProfileShortcutAtPath(FROM_HERE, customized_regular_shortcut_path,
profile_1_path_);
ValidateProfileShortcut(FROM_HERE, profile_1_name_, profile_1_path_);
@@ -636,8 +636,8 @@ TEST_F(ProfileShortcutManagerTest, RemoveProfileShortcuts) {
// shortcuts for profile 2 were kept.
profile_shortcut_manager_->RemoveProfileShortcuts(profile_1_path_);
RunPendingTasks();
- EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path_1));
- EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path_2));
+ EXPECT_FALSE(base::PathExists(profile_1_shortcut_path_1));
+ EXPECT_FALSE(base::PathExists(profile_1_shortcut_path_2));
ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_1,
profile_2_path_);
ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_2,
@@ -665,7 +665,7 @@ TEST_F(ProfileShortcutManagerTest, HasProfileShortcuts) {
const base::FilePath profile_2_shortcut_path =
GetDefaultShortcutPathForProfile(profile_2_name_);
ASSERT_TRUE(base::Delete(profile_2_shortcut_path, false));
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path));
profile_shortcut_manager_->HasProfileShortcuts(profile_2_path_, callback);
RunPendingTasks();
EXPECT_FALSE(result.has_shortcuts);
@@ -682,8 +682,8 @@ TEST_F(ProfileShortcutManagerTest, ProfileShortcutsWithSystemLevelShortcut) {
ASSERT_EQ(1U, profile_info_cache_->GetNumberOfProfiles());
// Ensure system-level continues to exist and user-level was not created.
- EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path));
- EXPECT_FALSE(file_util::PathExists(
+ EXPECT_TRUE(base::PathExists(system_level_shortcut_path));
+ EXPECT_FALSE(base::PathExists(
GetDefaultShortcutPathForProfile(string16())));
// Create another profile with a shortcut and ensure both profiles receive
@@ -691,7 +691,7 @@ TEST_F(ProfileShortcutManagerTest, ProfileShortcutsWithSystemLevelShortcut) {
CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_);
ValidateProfileShortcut(FROM_HERE, profile_1_name_, profile_1_path_);
ValidateProfileShortcut(FROM_HERE, profile_2_name_, profile_2_path_);
- EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path));
+ EXPECT_TRUE(base::PathExists(system_level_shortcut_path));
// Create a third profile without a shortcut and ensure it doesn't get one.
profile_info_cache_->AddProfileToCache(profile_3_path_, profile_3_name_,
@@ -736,7 +736,7 @@ TEST_F(ProfileShortcutManagerTest,
profile_info_cache_->DeleteProfileFromCache(profile_1_path_);
RunPendingTasks();
- EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path));
+ EXPECT_TRUE(base::PathExists(system_level_shortcut_path));
EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(string16()));
EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_));
EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_2_name_));
@@ -753,8 +753,8 @@ TEST_F(ProfileShortcutManagerTest,
// Delete the shortcut for the first profile, but keep the one for the 2nd.
ASSERT_TRUE(base::Delete(profile_1_shortcut_path, false));
- ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path));
+ ASSERT_FALSE(base::PathExists(profile_1_shortcut_path));
+ ASSERT_TRUE(base::PathExists(profile_2_shortcut_path));
const base::FilePath system_level_shortcut_path =
CreateRegularSystemLevelShortcut(FROM_HERE);
@@ -766,9 +766,9 @@ TEST_F(ProfileShortcutManagerTest,
RunPendingTasks();
// Verify that only the system-level shortcut still exists.
- EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path));
- EXPECT_FALSE(file_util::PathExists(
+ EXPECT_TRUE(base::PathExists(system_level_shortcut_path));
+ EXPECT_FALSE(base::PathExists(
GetDefaultShortcutPathForProfile(string16())));
- EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path));
- EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_1_shortcut_path));
+ EXPECT_FALSE(base::PathExists(profile_2_shortcut_path));
}
« no previous file with comments | « chrome/browser/profiles/profile_manager_unittest.cc ('k') | chrome/browser/profiles/profile_shortcut_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698