diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 17:36:07 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 17:36:07 +0000 |
commit | 7567484144da059e2c2c2a818b06660a5459052f (patch) | |
tree | a4ceafc7e890051c25dbdd54b170d0f5794dd229 /chrome/installer | |
parent | 8a25d54d6eb190a8b82479b5309a892c1080a372 (diff) | |
download | chromium_src-7567484144da059e2c2c2a818b06660a5459052f.zip chromium_src-7567484144da059e2c2c2a818b06660a5459052f.tar.gz chromium_src-7567484144da059e2c2c2a818b06660a5459052f.tar.bz2 |
Move PathExists to base namespace.
BUG=
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/18286004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
31 files changed, 398 insertions, 398 deletions
diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc index 181007d..09a65b3 100644 --- a/chrome/installer/launcher_support/chrome_launcher_support.cc +++ b/chrome/installer/launcher_support/chrome_launcher_support.cc @@ -50,7 +50,7 @@ base::FilePath GetDevelopmentExe(const wchar_t* exe_file) { base::FilePath current_directory; if (PathService::Get(base::DIR_EXE, ¤t_directory)) { base::FilePath chrome_exe_path(current_directory.Append(exe_file)); - if (file_util::PathExists(chrome_exe_path)) + if (base::PathExists(chrome_exe_path)) return chrome_exe_path; } return base::FilePath(); @@ -113,7 +113,7 @@ base::FilePath GetSetupExeFromRegistry(InstallationLevel level, string16 uninstall; if (GetClientStateValue(level, app_guid, kUninstallStringField, &uninstall)) { base::FilePath setup_exe_path(uninstall); - if (file_util::PathExists(setup_exe_path)) + if (base::PathExists(setup_exe_path)) return setup_exe_path; } return base::FilePath(); @@ -130,12 +130,12 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path, // name) and look for chrome.exe from there. base::FilePath exe_path( setup_exe_path.DirName().DirName().DirName().Append(exe_file)); - if (file_util::PathExists(exe_path)) + if (base::PathExists(exe_path)) return exe_path; // By way of mild future proofing, look up one to see if there's a // |exe_file| in the version directory exe_path = setup_exe_path.DirName().DirName().Append(exe_file); - if (file_util::PathExists(exe_path)) + if (base::PathExists(exe_path)) return exe_path; } return base::FilePath(); diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 6897373..43750d1 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -201,7 +201,7 @@ installer::InstallStatus InstallNewVersion( if (!install_list->Do()) { installer_state.UpdateStage(installer::ROLLINGBACK); installer::InstallStatus result = - file_util::PathExists(new_chrome_exe) && current_version->get() && + base::PathExists(new_chrome_exe) && current_version->get() && new_version.Equals(*current_version->get()) ? installer::SAME_VERSION_REPAIR_FAILED : installer::INSTALL_FAILED; @@ -226,7 +226,7 @@ installer::InstallStatus InstallNewVersion( } if (new_version.CompareTo(**current_version) > 0) { - if (file_util::PathExists(new_chrome_exe)) { + if (base::PathExists(new_chrome_exe)) { VLOG(1) << "Version updated to " << new_version.GetString() << " while running " << (*current_version)->GetString(); return installer::IN_USE_UPDATED; @@ -302,7 +302,7 @@ bool CreateVisualElementsManifest(const base::FilePath& src_path, // Some distributions of Chromium may not include visual elements. Only // proceed if this distribution does. - if (!file_util::PathExists(src_path.Append(elements_dir))) { + if (!base::PathExists(src_path.Append(elements_dir))) { VLOG(1) << "No visual elements found, not writing " << installer::kVisualElementsManifest << " to " << src_path.value(); return true; @@ -673,7 +673,7 @@ void HandleActiveSetupForBrowser(const base::FilePath& installation_root, // shortcuts; if the decision is to create them, only shortcuts whose matching // all-users shortcut isn't present on the system will be created. InstallShortcutOperation install_operation = - (!force && file_util::PathExists(first_run_sentinel) ? + (!force && base::PathExists(first_run_sentinel) ? INSTALL_SHORTCUT_REPLACE_EXISTING : INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index f8e5e83..e992aa9 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -215,7 +215,7 @@ class InstallShortcutTest : public testing::Test { TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestNotCreated) { ASSERT_TRUE( installer::CreateVisualElementsManifest(test_dir_.path(), version_)); - ASSERT_FALSE(file_util::PathExists(manifest_path_)); + ASSERT_FALSE(base::PathExists(manifest_path_)); } // Test that VisualElementsManifest.xml is created with the correct content when @@ -225,7 +225,7 @@ TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestCreated) { version_dir_.Append(installer::kVisualElements))); ASSERT_TRUE( installer::CreateVisualElementsManifest(test_dir_.path(), version_)); - ASSERT_TRUE(file_util::PathExists(manifest_path_)); + ASSERT_TRUE(base::PathExists(manifest_path_)); std::string read_manifest; ASSERT_TRUE(file_util::ReadFileToString(manifest_path_, &read_manifest)); @@ -289,7 +289,7 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButDesktopShortcut) { installer::CreateOrUpdateShortcuts( chrome_exe_, *product_, *prefs_no_desktop, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_ALL); - ASSERT_FALSE(file_util::PathExists(user_desktop_shortcut_)); + ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); base::win::ValidateShortcut(user_quick_launch_shortcut_, expected_properties_); base::win::ValidateShortcut(user_start_menu_shortcut_, @@ -303,7 +303,7 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButQuickLaunchShortcut) { chrome_exe_, *product_, *prefs_no_ql, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_ALL); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); - ASSERT_FALSE(file_util::PathExists(user_quick_launch_shortcut_)); + ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); base::win::ValidateShortcut(user_start_menu_shortcut_, expected_start_menu_properties_); } @@ -358,8 +358,8 @@ TEST_F(InstallShortcutTest, ReplaceExisting) { chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_REPLACE_EXISTING); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); - ASSERT_FALSE(file_util::PathExists(user_quick_launch_shortcut_)); - ASSERT_FALSE(file_util::PathExists(user_start_menu_shortcut_)); + ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); + ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); } TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { @@ -384,9 +384,9 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { installer::CreateOrUpdateShortcuts( chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); - ASSERT_FALSE(file_util::PathExists(user_desktop_shortcut_)); - ASSERT_FALSE(file_util::PathExists(user_quick_launch_shortcut_)); - ASSERT_FALSE(file_util::PathExists(user_start_menu_shortcut_)); + ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); + ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); + ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); } TEST_F(InstallShortcutTest, CreateIfNoSystemLevelNoSystemShortcutsExist) { @@ -414,7 +414,7 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelSomeSystemShortcutsExist) { installer::CreateOrUpdateShortcuts( chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); - ASSERT_FALSE(file_util::PathExists(user_desktop_shortcut_)); + ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); base::win::ValidateShortcut(user_quick_launch_shortcut_, expected_properties_); base::win::ValidateShortcut(user_start_menu_shortcut_, diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index f9f19fa..b625954 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -518,7 +518,7 @@ void AddChromeWorkItems(const InstallationState& original_state, // Install kVisualElementsManifest if it is present in |src_path|. No need to // make this a conditional work item as if the file is not there now, it will // never be. - if (file_util::PathExists( + if (base::PathExists( src_path.Append(installer::kVisualElementsManifest))) { install_list->AddMoveTreeWorkItem( src_path.Append(installer::kVisualElementsManifest).value(), diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 7259c4d..36eb491 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -121,7 +121,7 @@ DWORD UnPackArchive(const base::FilePath& archive, // Check if this is differential update and if it is, patch it to the // installer archive that should already be on the machine. We assume // it is a differential installer if chrome.7z is not found. - if (!file_util::PathExists(uncompressed_archive)) { + if (!base::PathExists(uncompressed_archive)) { *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; VLOG(1) << "Differential patch found. Applying to existing archive."; if (!archive_version.get()) { @@ -683,7 +683,7 @@ installer::InstallStatus InstallProductsHelper( // We want to keep uncompressed archive (chrome.7z) that we get after // uncompressing and binary patching. Get the location for this file. base::FilePath archive_to_copy; - if (file_util::PathExists(archive)) { + if (base::PathExists(archive)) { VLOG(1) << "Archive found to install Chrome " << archive.value(); if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path, archive_type)) { @@ -701,7 +701,7 @@ installer::InstallStatus InstallProductsHelper( base::FilePath uncompressed_archive(cmd_line.GetProgram().DirName().Append( installer::kChromeArchive)); - if (file_util::PathExists(uncompressed_archive)) { + if (base::PathExists(uncompressed_archive)) { VLOG(1) << "Uncompressed archive found to install Chrome " << uncompressed_archive.value(); *archive_type = installer::FULL_ARCHIVE_TYPE; @@ -1057,7 +1057,7 @@ installer::InstallStatus UninstallProducts( base::FilePath first_run_sentinel; InstallUtil::GetSentinelFilePath( chrome::kFirstRunSentinel, dist, &first_run_sentinel); - if (file_util::PathExists(first_run_sentinel)) { + if (base::PathExists(first_run_sentinel)) { // If the Chrome being self-destructed has already undergone First Run, // trigger Active Setup and make sure the system-level Chrome doesn't go // through first run. @@ -1204,7 +1204,7 @@ installer::InstallStatus RegisterDevChrome( chrome_exe = base::MakeAbsoluteFilePath(chrome_exe); installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS; - if (file_util::PathExists(chrome_exe)) { + if (base::PathExists(chrome_exe)) { Product chrome(chrome_dist); // Create the Start menu shortcut and pin it to the taskbar. diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index ce3e13c..5cc08b1 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -29,7 +29,7 @@ class SetupUtilTestWithDir : public testing::Test { virtual void SetUp() { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); data_dir_ = data_dir_.AppendASCII("installer"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); + ASSERT_TRUE(base::PathExists(data_dir_)); // Create a temp directory for testing. ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); @@ -98,9 +98,9 @@ bool CurrentProcessHasPrivilege(const wchar_t* privilege_name) { TEST_F(SetupUtilTestWithDir, ApplyDiffPatchTest) { base::FilePath work_dir(test_dir_.path()); work_dir = work_dir.AppendASCII("ApplyDiffPatchTest"); - ASSERT_FALSE(file_util::PathExists(work_dir)); + ASSERT_FALSE(base::PathExists(work_dir)); EXPECT_TRUE(file_util::CreateDirectory(work_dir)); - ASSERT_TRUE(file_util::PathExists(work_dir)); + ASSERT_TRUE(base::PathExists(work_dir)); base::FilePath src = data_dir_.AppendASCII("archive1.7z"); base::FilePath patch = data_dir_.AppendASCII("archive.diff"); @@ -119,33 +119,33 @@ TEST_F(SetupUtilTestWithDir, GetMaxVersionFromArchiveDirTest) { // Create a version dir base::FilePath chrome_dir = test_dir_.path().AppendASCII("1.0.0.0"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); scoped_ptr<Version> version( installer::GetMaxVersionFromArchiveDir(test_dir_.path())); ASSERT_EQ(version->GetString(), "1.0.0.0"); base::Delete(chrome_dir, true); - ASSERT_FALSE(file_util::PathExists(chrome_dir)); + ASSERT_FALSE(base::PathExists(chrome_dir)); ASSERT_TRUE(installer::GetMaxVersionFromArchiveDir(test_dir_.path()) == NULL); chrome_dir = test_dir_.path().AppendASCII("ABC"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); ASSERT_TRUE(installer::GetMaxVersionFromArchiveDir(test_dir_.path()) == NULL); chrome_dir = test_dir_.path().AppendASCII("2.3.4.5"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); version.reset(installer::GetMaxVersionFromArchiveDir(test_dir_.path())); ASSERT_EQ(version->GetString(), "2.3.4.5"); // Create multiple version dirs, ensure that we select the greatest. chrome_dir = test_dir_.path().AppendASCII("9.9.9.9"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); chrome_dir = test_dir_.path().AppendASCII("1.1.1.1"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); version.reset(installer::GetMaxVersionFromArchiveDir(test_dir_.path())); ASSERT_EQ(version->GetString(), "9.9.9.9"); @@ -154,11 +154,11 @@ TEST_F(SetupUtilTestWithDir, GetMaxVersionFromArchiveDirTest) { TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) { base::FilePath test_file; file_util::CreateTemporaryFileInDir(test_dir_.path(), &test_file); - ASSERT_TRUE(file_util::PathExists(test_file)); + ASSERT_TRUE(base::PathExists(test_file)); file_util::WriteFile(test_file, "foo", 3); EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0)); base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); - EXPECT_FALSE(file_util::PathExists(test_file)); + EXPECT_FALSE(base::PathExists(test_file)); } // Note: This test is only valid when run at high integrity (i.e. it will fail diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 246c860..2b7610f 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -427,7 +427,7 @@ base::FilePath BackupLocalStateFile( const base::FilePath& local_state_folder = local_state_folders[i]; base::FilePath state_file( local_state_folder.Append(chrome::kLocalStateFilename)); - if (!file_util::PathExists(state_file)) + if (!base::PathExists(state_file)) continue; if (!file_util::CreateTemporaryFile(&backup)) LOG(ERROR) << "Failed to create temporary file for Local State."; diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 2227e74..85d925c 100644 --- a/chrome/installer/test/alternate_version_generator_main.cc +++ b/chrome/installer/test/alternate_version_generator_main.cc @@ -140,7 +140,7 @@ int wmain(int argc, wchar_t *argv[]) { return EXIT_FAILURE; } - if (!file_util::PathExists(mini_installer)) { + if (!base::PathExists(mini_installer)) { DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, mini_installer.value()); return EXIT_FAILURE; @@ -148,7 +148,7 @@ int wmain(int argc, wchar_t *argv[]) { base::FilePath out; GetOutPath(*cmd_line, &out); - if (!cmd_line->HasSwitch(switches::kForce) && file_util::PathExists(out)) { + if (!cmd_line->HasSwitch(switches::kForce) && base::PathExists(out)) { DumpUsage(*cmd_line, errors::OUT_FILE_EXISTS, out.value()); return EXIT_FAILURE; } diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index 01a106b..59757e4 100644 --- a/chrome/installer/util/chrome_browser_operations.cc +++ b/chrome/installer/util/chrome_browser_operations.cc @@ -115,7 +115,7 @@ void ChromeBrowserOperations::AddDefaultShortcutProperties( int icon_index = dist->GetIconIndex(); base::FilePath prefs_path(target_exe.DirName().AppendASCII( installer::kDefaultMasterPrefs)); - if (file_util::PathExists(prefs_path)) { + if (base::PathExists(prefs_path)) { installer::MasterPreferences prefs(prefs_path); prefs.GetInt(installer::master_preferences::kChromeShortcutIconIndex, &icon_index); diff --git a/chrome/installer/util/conditional_work_item_list.cc b/chrome/installer/util/conditional_work_item_list.cc index 9e8d5bf..56c8617 100644 --- a/chrome/installer/util/conditional_work_item_list.cc +++ b/chrome/installer/util/conditional_work_item_list.cc @@ -32,7 +32,7 @@ void ConditionalWorkItemList::Rollback() { // Pre-defined conditions: //------------------------------------------------------------------------------ bool ConditionRunIfFileExists::ShouldRun() const { - return file_util::PathExists(key_path_); + return base::PathExists(key_path_); } bool Not::ShouldRun() const { diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index ea14ea1..6f44e59 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -29,12 +29,12 @@ CopyTreeWorkItem::CopyTreeWorkItem(const base::FilePath& source_path, } bool CopyTreeWorkItem::Do() { - if (!file_util::PathExists(source_path_)) { + if (!base::PathExists(source_path_)) { LOG(ERROR) << source_path_.value() << " does not exist"; return false; } - bool dest_exist = file_util::PathExists(dest_path_); + bool dest_exist = base::PathExists(dest_path_); // handle overwrite_option_ = IF_DIFFERENT case. if ((dest_exist) && (overwrite_option_ == WorkItem::IF_DIFFERENT) && // only for single file @@ -52,7 +52,7 @@ bool CopyTreeWorkItem::Do() { (IsFileInUse(dest_path_))) { // handle overwrite_option_ = NEW_NAME_IF_IN_USE case. if (alternative_path_.empty() || - file_util::PathExists(alternative_path_) || + base::PathExists(alternative_path_) || !base::CopyFile(source_path_, alternative_path_)) { LOG(ERROR) << "failed to copy " << source_path_.value() << " to " << alternative_path_.value(); @@ -126,7 +126,7 @@ void CopyTreeWorkItem::Rollback() { } bool CopyTreeWorkItem::IsFileInUse(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return false; HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS, diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc index accd12a..981e54e 100644 --- a/chrome/installer/util/copy_tree_work_item_unittest.cc +++ b/chrome/installer/util/copy_tree_work_item_unittest.cc @@ -47,7 +47,7 @@ namespace { } bool IsFileInUse(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return false; HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS, @@ -80,13 +80,13 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination path base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); @@ -101,15 +101,15 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_TRUE(file_util::ContentsEqual(file_name_from, file_name_to)); // test rollback() work_item->Rollback(); - EXPECT_FALSE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); + EXPECT_FALSE(base::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); } // Copy one file, overwriting the existing one in destination. @@ -120,18 +120,18 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination file base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); CreateTextFile(file_name_to.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); // test Do() with always_overwrite being true. scoped_ptr<CopyTreeWorkItem> work_item( @@ -143,16 +143,16 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_2)); @@ -167,16 +167,16 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_2)); } @@ -190,18 +190,18 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination file base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); CreateTextFile(file_name_to.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); // test Do() with always_overwrite being true. scoped_ptr<CopyTreeWorkItem> work_item( @@ -218,24 +218,24 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // we verify the file is overwritten by checking the existence of backup // file. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_EQ(0, ReadTextFile(backup_file.value()).compare(text_content_1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // the backup file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test Do() with always_overwrite being false. nothing should change. work_item.reset( @@ -247,22 +247,22 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // we verify the file is not overwritten by checking that the backup // file does not exist. - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test rollback(). nothing should happen here. work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); } // Copy one file and without rollback. Verify all temporary files are deleted. @@ -271,18 +271,18 @@ TEST_F(CopyTreeWorkItemTest, CopyFileAndCleanup) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination file base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); CreateTextFile(file_name_to.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); base::FilePath backup_file; @@ -302,17 +302,17 @@ TEST_F(CopyTreeWorkItemTest, CopyFileAndCleanup) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file is moved to backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_EQ(0, ReadTextFile(backup_file.value()).compare(text_content_2)); } // verify the backup file is cleaned up as well. - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); } // Copy one file, with the existing one in destination being used with @@ -323,7 +323,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -333,12 +333,12 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << file_name_to.value(); @@ -366,23 +366,23 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file in used is moved to backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); // the backup file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. @@ -402,7 +402,7 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -412,13 +412,13 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to), alternate_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); alternate_to = alternate_to.AppendASCII("Alternate_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << file_name_to.value(); @@ -441,8 +441,8 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); // verify that the backup path does not exist @@ -452,13 +452,13 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); EXPECT_TRUE(work_item->backup_path_.path().empty()); // the alternate file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(alternate_to)); + EXPECT_FALSE(base::PathExists(alternate_to)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. @@ -482,24 +482,24 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(file_name_from, file_name_to)); // verify that the backup path does exist - EXPECT_TRUE(file_util::PathExists(backup_file)); - EXPECT_FALSE(file_util::PathExists(alternate_to)); + EXPECT_TRUE(base::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(alternate_to)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); // the backup file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(backup_file)); - EXPECT_FALSE(file_util::PathExists(alternate_to)); + EXPECT_FALSE(base::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(alternate_to)); } // Test overwrite option IF_NOT_PRESENT: @@ -513,7 +513,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -523,11 +523,11 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); // Get the path of backup file base::FilePath backup_file(temp_dir_.path()); @@ -544,22 +544,22 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { // verify that the source, destination have not changed and backup path // does not exist - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test rollback() work_item->Rollback(); // verify that the source, destination have not changed and backup path // does not exist after rollback also - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // Now delete the destination and try copying the file again. base::Delete(file_name_to, true); @@ -571,20 +571,20 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { // verify that the source, destination are the same and backup path // does not exist - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test rollback() work_item->Rollback(); // verify that the destination does not exist anymore - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_FALSE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_FALSE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); } // Copy one file without rollback. The existing one in destination is in use. @@ -595,7 +595,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -605,12 +605,12 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << file_name_to.value(); @@ -641,17 +641,17 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file in used is moved to backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); } // verify the file in used should be still at the backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); TerminateProcess(pi.hProcess, 0); @@ -668,27 +668,27 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { base::FilePath dir_name_from(test_dir_.path()); dir_name_from = dir_name_from.AppendASCII("from"); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); base::FilePath dir_name_from_1(dir_name_from); dir_name_from_1 = dir_name_from_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_from_1); - ASSERT_TRUE(file_util::PathExists(dir_name_from_1)); + ASSERT_TRUE(base::PathExists(dir_name_from_1)); base::FilePath dir_name_from_2(dir_name_from); dir_name_from_2 = dir_name_from_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_from_2); - ASSERT_TRUE(file_util::PathExists(dir_name_from_2)); + ASSERT_TRUE(base::PathExists(dir_name_from_2)); base::FilePath file_name_from_1(dir_name_from_1); file_name_from_1 = file_name_from_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_from_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from_1)); + ASSERT_TRUE(base::PathExists(file_name_from_1)); base::FilePath file_name_from_2(dir_name_from_2); file_name_from_2 = file_name_from_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_from_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from_2)); + ASSERT_TRUE(base::PathExists(file_name_from_2)); base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("to"); @@ -708,7 +708,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { base::FilePath file_name_to_1(dir_name_to); file_name_to_1 = file_name_to_1.AppendASCII("1"); file_name_to_1 = file_name_to_1.AppendASCII("File_1.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_to_1)); + EXPECT_TRUE(base::PathExists(file_name_to_1)); VLOG(1) << "compare " << file_name_from_1.value() << " and " << file_name_to_1.value(); EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1)); @@ -716,7 +716,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { base::FilePath file_name_to_2(dir_name_to); file_name_to_2 = file_name_to_2.AppendASCII("2"); file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_to_2)); + EXPECT_TRUE(base::PathExists(file_name_to_2)); VLOG(1) << "compare " << file_name_from_2.value() << " and " << file_name_to_2.value(); EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2)); diff --git a/chrome/installer/util/create_dir_work_item.cc b/chrome/installer/util/create_dir_work_item.cc index a21d3eb..2e1ffa3 100644 --- a/chrome/installer/util/create_dir_work_item.cc +++ b/chrome/installer/util/create_dir_work_item.cc @@ -16,7 +16,7 @@ CreateDirWorkItem::CreateDirWorkItem(const base::FilePath& path) } void CreateDirWorkItem::GetTopDirToCreate() { - if (file_util::PathExists(path_)) { + if (base::PathExists(path_)) { top_path_ = base::FilePath(); return; } @@ -25,7 +25,7 @@ void CreateDirWorkItem::GetTopDirToCreate() { do { top_path_ = parent_dir; parent_dir = parent_dir.DirName(); - } while ((parent_dir != top_path_) && !file_util::PathExists(parent_dir)); + } while ((parent_dir != top_path_) && !base::PathExists(parent_dir)); return; } @@ -56,7 +56,7 @@ void CreateDirWorkItem::Rollback() { base::FilePath path_to_delete(path_); while (1) { - if (file_util::PathExists(path_to_delete)) { + if (base::PathExists(path_to_delete)) { if (!RemoveDirectory(path_to_delete.value().c_str())) break; } diff --git a/chrome/installer/util/create_dir_work_item_unittest.cc b/chrome/installer/util/create_dir_work_item_unittest.cc index 1dce3ec..ba3e81b 100644 --- a/chrome/installer/util/create_dir_work_item_unittest.cc +++ b/chrome/installer/util/create_dir_work_item_unittest.cc @@ -29,7 +29,7 @@ TEST_F(CreateDirWorkItemTest, CreatePath) { base::FilePath parent_dir(temp_dir_.path()); parent_dir = parent_dir.AppendASCII("a"); file_util::CreateDirectory(parent_dir); - ASSERT_TRUE(file_util::PathExists(parent_dir)); + ASSERT_TRUE(base::PathExists(parent_dir)); base::FilePath top_dir_to_create(parent_dir); top_dir_to_create = top_dir_to_create.AppendASCII("b"); @@ -43,33 +43,33 @@ TEST_F(CreateDirWorkItemTest, CreatePath) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item->Rollback(); // Rollback should delete all the paths up to top_dir_to_create. - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); - EXPECT_TRUE(file_util::PathExists(parent_dir)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); + EXPECT_TRUE(base::PathExists(parent_dir)); } TEST_F(CreateDirWorkItemTest, CreateExistingPath) { base::FilePath dir_to_create(temp_dir_.path()); dir_to_create = dir_to_create.AppendASCII("aa"); file_util::CreateDirectory(dir_to_create); - ASSERT_TRUE(file_util::PathExists(dir_to_create)); + ASSERT_TRUE(base::PathExists(dir_to_create)); scoped_ptr<CreateDirWorkItem> work_item( WorkItem::CreateCreateDirWorkItem(dir_to_create)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item->Rollback(); // Rollback should not remove the path since it exists before // the CreateDirWorkItem is called. - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); } TEST_F(CreateDirWorkItemTest, CreateSharedPath) { @@ -87,22 +87,22 @@ TEST_F(CreateDirWorkItemTest, CreateSharedPath) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create_3)); + EXPECT_TRUE(base::PathExists(dir_to_create_3)); // Create another directory under dir_to_create_2 base::FilePath dir_to_create_4(dir_to_create_2); dir_to_create_4 = dir_to_create_4.AppendASCII("ddd"); file_util::CreateDirectory(dir_to_create_4); - ASSERT_TRUE(file_util::PathExists(dir_to_create_4)); + ASSERT_TRUE(base::PathExists(dir_to_create_4)); work_item->Rollback(); // Rollback should delete dir_to_create_3. - EXPECT_FALSE(file_util::PathExists(dir_to_create_3)); + EXPECT_FALSE(base::PathExists(dir_to_create_3)); // Rollback should not delete dir_to_create_2 as it is shared. - EXPECT_TRUE(file_util::PathExists(dir_to_create_2)); - EXPECT_TRUE(file_util::PathExists(dir_to_create_4)); + EXPECT_TRUE(base::PathExists(dir_to_create_2)); + EXPECT_TRUE(base::PathExists(dir_to_create_4)); } TEST_F(CreateDirWorkItemTest, RollbackWithMissingDir) { @@ -120,14 +120,14 @@ TEST_F(CreateDirWorkItemTest, RollbackWithMissingDir) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create_3)); + EXPECT_TRUE(base::PathExists(dir_to_create_3)); RemoveDirectory(dir_to_create_3.value().c_str()); - ASSERT_FALSE(file_util::PathExists(dir_to_create_3)); + ASSERT_FALSE(base::PathExists(dir_to_create_3)); work_item->Rollback(); // dir_to_create_3 has already been deleted, Rollback should delete // the rest. - EXPECT_FALSE(file_util::PathExists(dir_to_create_1)); + EXPECT_FALSE(base::PathExists(dir_to_create_1)); } diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc index 7c32654..1bf69de 100644 --- a/chrome/installer/util/delete_tree_work_item.cc +++ b/chrome/installer/util/delete_tree_work_item.cc @@ -108,7 +108,7 @@ bool DeleteTreeWorkItem::Do() { } // Now that we've taken care of the key files, take care of the rest. - if (!root_path_.empty() && file_util::PathExists(root_path_)) { + if (!root_path_.empty() && base::PathExists(root_path_)) { if (!ignore_failure_) { if (!backup_path_.CreateUniqueTempDirUnderPath(temp_path_)) { PLOG(ERROR) << "Failed to get backup path in folder " @@ -143,7 +143,7 @@ void DeleteTreeWorkItem::Rollback() { if (copied_to_backup_) { DCHECK(!backup_path_.path().empty()); base::FilePath backup = backup_path_.path().Append(root_path_.BaseName()); - if (file_util::PathExists(backup)) + if (base::PathExists(backup)) base::Move(backup, root_path_); } @@ -153,7 +153,7 @@ void DeleteTreeWorkItem::Rollback() { base::FilePath& key_file = key_paths_[i]; base::FilePath backup_file = backup_dir.path().Append(key_file.BaseName()); - if (file_util::PathExists(backup_file) && + if (base::PathExists(backup_file) && !base::Move(backup_file, key_file)) { // This could happen if we could not delete the key file to begin with. PLOG(WARNING) << "Rollback: Failed to move backup file back in place: " diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc index 190e0d9..3181c53 100644 --- a/chrome/installer/util/delete_tree_work_item_unittest.cc +++ b/chrome/installer/util/delete_tree_work_item_unittest.cc @@ -49,27 +49,27 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) { base::FilePath dir_name_delete(temp_dir_.path()); dir_name_delete = dir_name_delete.AppendASCII("to_be_delete"); file_util::CreateDirectory(dir_name_delete); - ASSERT_TRUE(file_util::PathExists(dir_name_delete)); + ASSERT_TRUE(base::PathExists(dir_name_delete)); base::FilePath dir_name_delete_1(dir_name_delete); dir_name_delete_1 = dir_name_delete_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_delete_1); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_1)); + ASSERT_TRUE(base::PathExists(dir_name_delete_1)); base::FilePath dir_name_delete_2(dir_name_delete); dir_name_delete_2 = dir_name_delete_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_delete_2); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_2)); + ASSERT_TRUE(base::PathExists(dir_name_delete_2)); base::FilePath file_name_delete_1(dir_name_delete_1); file_name_delete_1 = file_name_delete_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_delete_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_1)); + ASSERT_TRUE(base::PathExists(file_name_delete_1)); base::FilePath file_name_delete_2(dir_name_delete_2); file_name_delete_2 = file_name_delete_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_delete_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_2)); + ASSERT_TRUE(base::PathExists(file_name_delete_2)); // Test Do(). base::ScopedTempDir temp_dir; @@ -82,15 +82,15 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) { EXPECT_TRUE(work_item->Do()); // everything should be gone - EXPECT_FALSE(file_util::PathExists(file_name_delete_1)); - EXPECT_FALSE(file_util::PathExists(file_name_delete_2)); - EXPECT_FALSE(file_util::PathExists(dir_name_delete)); + EXPECT_FALSE(base::PathExists(file_name_delete_1)); + EXPECT_FALSE(base::PathExists(file_name_delete_2)); + EXPECT_FALSE(base::PathExists(dir_name_delete)); work_item->Rollback(); // everything should come back - EXPECT_TRUE(file_util::PathExists(file_name_delete_1)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_2)); - EXPECT_TRUE(file_util::PathExists(dir_name_delete)); + EXPECT_TRUE(base::PathExists(file_name_delete_1)); + EXPECT_TRUE(base::PathExists(file_name_delete_2)); + EXPECT_TRUE(base::PathExists(dir_name_delete)); } @@ -101,27 +101,27 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTree) { base::FilePath dir_name_delete(temp_dir_.path()); dir_name_delete = dir_name_delete.AppendASCII("to_be_delete"); file_util::CreateDirectory(dir_name_delete); - ASSERT_TRUE(file_util::PathExists(dir_name_delete)); + ASSERT_TRUE(base::PathExists(dir_name_delete)); base::FilePath dir_name_delete_1(dir_name_delete); dir_name_delete_1 = dir_name_delete_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_delete_1); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_1)); + ASSERT_TRUE(base::PathExists(dir_name_delete_1)); base::FilePath dir_name_delete_2(dir_name_delete); dir_name_delete_2 = dir_name_delete_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_delete_2); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_2)); + ASSERT_TRUE(base::PathExists(dir_name_delete_2)); base::FilePath file_name_delete_1(dir_name_delete_1); file_name_delete_1 = file_name_delete_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_delete_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_1)); + ASSERT_TRUE(base::PathExists(file_name_delete_1)); base::FilePath file_name_delete_2(dir_name_delete_2); file_name_delete_2 = file_name_delete_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_delete_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_2)); + ASSERT_TRUE(base::PathExists(file_name_delete_2)); // test Do() base::ScopedTempDir temp_dir; @@ -134,15 +134,15 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTree) { EXPECT_TRUE(work_item->Do()); // everything should be gone - EXPECT_FALSE(file_util::PathExists(file_name_delete_1)); - EXPECT_FALSE(file_util::PathExists(file_name_delete_2)); - EXPECT_FALSE(file_util::PathExists(dir_name_delete)); + EXPECT_FALSE(base::PathExists(file_name_delete_1)); + EXPECT_FALSE(base::PathExists(file_name_delete_2)); + EXPECT_FALSE(base::PathExists(dir_name_delete)); work_item->Rollback(); // everything should come back - EXPECT_TRUE(file_util::PathExists(file_name_delete_1)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_2)); - EXPECT_TRUE(file_util::PathExists(dir_name_delete)); + EXPECT_TRUE(base::PathExists(file_name_delete_1)); + EXPECT_TRUE(base::PathExists(file_name_delete_2)); + EXPECT_TRUE(base::PathExists(dir_name_delete)); } // Delete a tree with key_path in use. Everything should still be there. @@ -151,27 +151,27 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { base::FilePath dir_name_delete(temp_dir_.path()); dir_name_delete = dir_name_delete.AppendASCII("to_be_delete"); file_util::CreateDirectory(dir_name_delete); - ASSERT_TRUE(file_util::PathExists(dir_name_delete)); + ASSERT_TRUE(base::PathExists(dir_name_delete)); base::FilePath dir_name_delete_1(dir_name_delete); dir_name_delete_1 = dir_name_delete_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_delete_1); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_1)); + ASSERT_TRUE(base::PathExists(dir_name_delete_1)); base::FilePath dir_name_delete_2(dir_name_delete); dir_name_delete_2 = dir_name_delete_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_delete_2); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_2)); + ASSERT_TRUE(base::PathExists(dir_name_delete_2)); base::FilePath file_name_delete_1(dir_name_delete_1); file_name_delete_1 = file_name_delete_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_delete_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_1)); + ASSERT_TRUE(base::PathExists(file_name_delete_1)); base::FilePath file_name_delete_2(dir_name_delete_2); file_name_delete_2 = file_name_delete_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_delete_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_2)); + ASSERT_TRUE(base::PathExists(file_name_delete_2)); // Create a key path file. base::FilePath key_path(dir_name_delete); @@ -182,7 +182,7 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { base::FilePath exe_full_path(exe_full_path_str); base::CopyFile(exe_full_path, key_path); - ASSERT_TRUE(file_util::PathExists(key_path)); + ASSERT_TRUE(base::PathExists(key_path)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << key_path.value(); @@ -210,9 +210,9 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { } // verify everything is still there. - EXPECT_TRUE(file_util::PathExists(key_path)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_1)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_2)); + EXPECT_TRUE(base::PathExists(key_path)); + EXPECT_TRUE(base::PathExists(file_name_delete_1)); + EXPECT_TRUE(base::PathExists(file_name_delete_2)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. diff --git a/chrome/installer/util/duplicate_tree_detector_unittest.cc b/chrome/installer/util/duplicate_tree_detector_unittest.cc index 0607b98..6a97d84 100644 --- a/chrome/installer/util/duplicate_tree_detector_unittest.cc +++ b/chrome/installer/util/duplicate_tree_detector_unittest.cc @@ -40,22 +40,22 @@ class DuplicateTreeDetectorTest : public testing::Test { base::FilePath d1(first_root); d1 = d1.AppendASCII("D1"); file_util::CreateDirectory(d1); - ASSERT_TRUE(file_util::PathExists(d1)); + ASSERT_TRUE(base::PathExists(d1)); base::FilePath f1(d1); f1 = f1.AppendASCII("F1"); CreateTextFile(f1.MaybeAsASCII(), text_content_1_); - ASSERT_TRUE(file_util::PathExists(f1)); + ASSERT_TRUE(base::PathExists(f1)); base::FilePath d2(d1); d2 = d2.AppendASCII("D2"); file_util::CreateDirectory(d2); - ASSERT_TRUE(file_util::PathExists(d2)); + ASSERT_TRUE(base::PathExists(d2)); base::FilePath f2(d2); f2 = f2.AppendASCII("F2"); CreateTextFile(f2.MaybeAsASCII(), text_content_2_); - ASSERT_TRUE(file_util::PathExists(f2)); + ASSERT_TRUE(base::PathExists(f2)); ASSERT_TRUE(installer::test::CopyFileHierarchy(d1, second_root)); } @@ -94,7 +94,7 @@ TEST_F(DuplicateTreeDetectorTest, TestSourceContainsDest) { base::FilePath new_file(temp_source_dir_.path()); new_file = new_file.AppendASCII("FNew"); CreateTextFile(new_file.MaybeAsASCII(), text_content_1_); - ASSERT_TRUE(file_util::PathExists(new_file)); + ASSERT_TRUE(base::PathExists(new_file)); EXPECT_FALSE(installer::IsIdenticalFileHierarchy(temp_source_dir_.path(), temp_dest_dir_.path())); @@ -108,7 +108,7 @@ TEST_F(DuplicateTreeDetectorTest, TestDestContainsSource) { base::FilePath new_file(temp_dest_dir_.path()); new_file = new_file.AppendASCII("FNew"); CreateTextFile(new_file.MaybeAsASCII(), text_content_1_); - ASSERT_TRUE(file_util::PathExists(new_file)); + ASSERT_TRUE(base::PathExists(new_file)); EXPECT_TRUE(installer::IsIdenticalFileHierarchy(temp_source_dir_.path(), temp_dest_dir_.path())); diff --git a/chrome/installer/util/eula_util.cc b/chrome/installer/util/eula_util.cc index 8fee493..25bcba8 100644 --- a/chrome/installer/util/eula_util.cc +++ b/chrome/installer/util/eula_util.cc @@ -26,7 +26,7 @@ bool IsChromeFirstRunPending(BrowserDistribution* dist) { return InstallUtil::GetSentinelFilePath(chrome::kFirstRunSentinel, dist, &first_run_sentinel) - && !file_util::PathExists(first_run_sentinel); + && !base::PathExists(first_run_sentinel); } bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) { @@ -37,7 +37,7 @@ bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) { return InstallUtil::GetSentinelFilePath(kEULASentinelFile, dist, &eula_sentinel) - && file_util::PathExists(eula_sentinel); + && base::PathExists(eula_sentinel); } scoped_ptr<MasterPreferences> GetMasterPrefs(const ProductState& prod_state) { diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index 07a2b0c..424acef 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -385,11 +385,11 @@ bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file, if (IsPerUserInstall(exe_path.value().c_str())) { const base::FilePath maybe_product_dir(exe_path.DirName().DirName()); - if (file_util::PathExists(exe_path.Append(installer::kChromeExe))) { + if (base::PathExists(exe_path.Append(installer::kChromeExe))) { // DIR_EXE is most likely Chrome's directory in which case |exe_path| is // the user-level sentinel path. *path = exe_path; - } else if (file_util::PathExists( + } else if (base::PathExists( maybe_product_dir.Append(installer::kChromeExe))) { // DIR_EXE can also be the Installer directory if this is called from a // setup.exe running from Application\<version>\Installer (see diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index 5fd81bc..ad8c053 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -552,7 +552,7 @@ Version* InstallerState::GetCurrentVersion( // Be aware that there might be a pending "new_chrome.exe" already in the // installation path. If so, we use old_version, which holds the version of // "chrome.exe" itself. - if (file_util::PathExists(target_path().Append(kChromeNewExe))) + if (base::PathExists(target_path().Append(kChromeNewExe))) version = product_state->old_version(); if (version == NULL) @@ -590,7 +590,7 @@ bool InstallerState::IsChromeFrameRunning( base::FilePath cf_install_path( target_path().AppendASCII(current_version->GetString()) .Append(kChromeFrameDll)); - in_use = file_util::PathExists(cf_install_path) && + in_use = base::PathExists(cf_install_path) && IsFileInUse(cf_install_path); } return in_use; diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index 1d5fbb5..a5142b3 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -99,47 +99,47 @@ TEST_F(InstallerStateTest, Delete) { base::FilePath chrome_dir(test_dir_.path()); chrome_dir = chrome_dir.AppendASCII("chrome"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); base::FilePath chrome_dir_1(chrome_dir); chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0"); file_util::CreateDirectory(chrome_dir_1); - ASSERT_TRUE(file_util::PathExists(chrome_dir_1)); + ASSERT_TRUE(base::PathExists(chrome_dir_1)); base::FilePath chrome_dir_2(chrome_dir); chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0"); file_util::CreateDirectory(chrome_dir_2); - ASSERT_TRUE(file_util::PathExists(chrome_dir_2)); + ASSERT_TRUE(base::PathExists(chrome_dir_2)); base::FilePath chrome_dir_3(chrome_dir); chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0"); file_util::CreateDirectory(chrome_dir_3); - ASSERT_TRUE(file_util::PathExists(chrome_dir_3)); + ASSERT_TRUE(base::PathExists(chrome_dir_3)); base::FilePath chrome_dir_4(chrome_dir); chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0"); file_util::CreateDirectory(chrome_dir_4); - ASSERT_TRUE(file_util::PathExists(chrome_dir_4)); + ASSERT_TRUE(base::PathExists(chrome_dir_4)); base::FilePath chrome_dll_1(chrome_dir_1); chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_1)); + ASSERT_TRUE(base::PathExists(chrome_dll_1)); base::FilePath chrome_dll_2(chrome_dir_2); chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_2)); + ASSERT_TRUE(base::PathExists(chrome_dll_2)); base::FilePath chrome_dll_3(chrome_dir_3); chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_3.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_3)); + ASSERT_TRUE(base::PathExists(chrome_dll_3)); base::FilePath chrome_dll_4(chrome_dir_4); chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_4.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_4)); + ASSERT_TRUE(base::PathExists(chrome_dll_4)); MockInstallerState installer_state; BuildSingleChromeState(chrome_dir, &installer_state); @@ -152,11 +152,11 @@ TEST_F(InstallerStateTest, Delete) { } // old versions should be gone - EXPECT_FALSE(file_util::PathExists(chrome_dir_1)); - EXPECT_FALSE(file_util::PathExists(chrome_dir_2)); - EXPECT_FALSE(file_util::PathExists(chrome_dir_3)); + EXPECT_FALSE(base::PathExists(chrome_dir_1)); + EXPECT_FALSE(base::PathExists(chrome_dir_2)); + EXPECT_FALSE(base::PathExists(chrome_dir_3)); // the latest version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dll_4)); + EXPECT_TRUE(base::PathExists(chrome_dll_4)); } // Delete older version directories, keeping the one in used intact. @@ -165,37 +165,37 @@ TEST_F(InstallerStateTest, DeleteInUsed) { base::FilePath chrome_dir(test_dir_.path()); chrome_dir = chrome_dir.AppendASCII("chrome"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); base::FilePath chrome_dir_1(chrome_dir); chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0"); file_util::CreateDirectory(chrome_dir_1); - ASSERT_TRUE(file_util::PathExists(chrome_dir_1)); + ASSERT_TRUE(base::PathExists(chrome_dir_1)); base::FilePath chrome_dir_2(chrome_dir); chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0"); file_util::CreateDirectory(chrome_dir_2); - ASSERT_TRUE(file_util::PathExists(chrome_dir_2)); + ASSERT_TRUE(base::PathExists(chrome_dir_2)); base::FilePath chrome_dir_3(chrome_dir); chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0"); file_util::CreateDirectory(chrome_dir_3); - ASSERT_TRUE(file_util::PathExists(chrome_dir_3)); + ASSERT_TRUE(base::PathExists(chrome_dir_3)); base::FilePath chrome_dir_4(chrome_dir); chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0"); file_util::CreateDirectory(chrome_dir_4); - ASSERT_TRUE(file_util::PathExists(chrome_dir_4)); + ASSERT_TRUE(base::PathExists(chrome_dir_4)); base::FilePath chrome_dll_1(chrome_dir_1); chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_1)); + ASSERT_TRUE(base::PathExists(chrome_dll_1)); base::FilePath chrome_dll_2(chrome_dir_2); chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_2)); + ASSERT_TRUE(base::PathExists(chrome_dll_2)); // Open the file to make it in use. std::ofstream file; @@ -204,22 +204,22 @@ TEST_F(InstallerStateTest, DeleteInUsed) { base::FilePath chrome_othera_2(chrome_dir_2); chrome_othera_2 = chrome_othera_2.AppendASCII("othera.dll"); CreateTextFile(chrome_othera_2.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(chrome_othera_2)); + ASSERT_TRUE(base::PathExists(chrome_othera_2)); base::FilePath chrome_otherb_2(chrome_dir_2); chrome_otherb_2 = chrome_otherb_2.AppendASCII("otherb.dll"); CreateTextFile(chrome_otherb_2.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(chrome_otherb_2)); + ASSERT_TRUE(base::PathExists(chrome_otherb_2)); base::FilePath chrome_dll_3(chrome_dir_3); chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_3.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_3)); + ASSERT_TRUE(base::PathExists(chrome_dll_3)); base::FilePath chrome_dll_4(chrome_dir_4); chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_4.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_4)); + ASSERT_TRUE(base::PathExists(chrome_dll_4)); MockInstallerState installer_state; BuildSingleChromeState(chrome_dir, &installer_state); @@ -234,16 +234,16 @@ TEST_F(InstallerStateTest, DeleteInUsed) { } // the version defined as the existing version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dir_1)); + EXPECT_TRUE(base::PathExists(chrome_dir_1)); // old versions not in used should be gone - EXPECT_FALSE(file_util::PathExists(chrome_dir_3)); + EXPECT_FALSE(base::PathExists(chrome_dir_3)); // every thing under in used version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dir_2)); - EXPECT_TRUE(file_util::PathExists(chrome_dll_2)); - EXPECT_TRUE(file_util::PathExists(chrome_othera_2)); - EXPECT_TRUE(file_util::PathExists(chrome_otherb_2)); + EXPECT_TRUE(base::PathExists(chrome_dir_2)); + EXPECT_TRUE(base::PathExists(chrome_dll_2)); + EXPECT_TRUE(base::PathExists(chrome_othera_2)); + EXPECT_TRUE(base::PathExists(chrome_otherb_2)); // the latest version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dll_4)); + EXPECT_TRUE(base::PathExists(chrome_dll_4)); } // Tests a few basic things of the Package class. Makes sure that the path @@ -281,20 +281,20 @@ TEST_F(InstallerStateTest, Basic) { base::FilePath old_version_dir(installer_state.target_path().Append( UTF8ToWide(old_version.GetString()))); - EXPECT_FALSE(file_util::PathExists(new_version_dir)); - EXPECT_FALSE(file_util::PathExists(old_version_dir)); + EXPECT_FALSE(base::PathExists(new_version_dir)); + EXPECT_FALSE(base::PathExists(old_version_dir)); - EXPECT_FALSE(file_util::PathExists(installer_dir)); + EXPECT_FALSE(base::PathExists(installer_dir)); file_util::CreateDirectory(installer_dir); - EXPECT_TRUE(file_util::PathExists(new_version_dir)); + EXPECT_TRUE(base::PathExists(new_version_dir)); file_util::CreateDirectory(old_version_dir); - EXPECT_TRUE(file_util::PathExists(old_version_dir)); + EXPECT_TRUE(base::PathExists(old_version_dir)); // Create a fake chrome.dll key file in the old version directory. This // should prevent the old version directory from getting deleted. base::FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll)); - EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); + EXPECT_FALSE(base::PathExists(old_chrome_dll)); // Hold on to the file exclusively to prevent the directory from // being deleted. @@ -302,7 +302,7 @@ TEST_F(InstallerStateTest, Basic) { ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, 0, NULL, OPEN_ALWAYS, 0, NULL)); EXPECT_TRUE(file.IsValid()); - EXPECT_TRUE(file_util::PathExists(old_chrome_dll)); + EXPECT_TRUE(base::PathExists(old_chrome_dll)); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -314,8 +314,8 @@ TEST_F(InstallerStateTest, Basic) { temp_dir.path()); // The old directory should still exist. - EXPECT_TRUE(file_util::PathExists(old_version_dir)); - EXPECT_TRUE(file_util::PathExists(new_version_dir)); + EXPECT_TRUE(base::PathExists(old_version_dir)); + EXPECT_TRUE(base::PathExists(new_version_dir)); // Now close the file handle to make it possible to delete our key file. file.Close(); @@ -324,11 +324,11 @@ TEST_F(InstallerStateTest, Basic) { NULL, temp_dir.path()); // The new directory should still exist. - EXPECT_TRUE(file_util::PathExists(new_version_dir)); + EXPECT_TRUE(base::PathExists(new_version_dir)); // Now, the old directory and key file should be gone. - EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); - EXPECT_FALSE(file_util::PathExists(old_version_dir)); + EXPECT_FALSE(base::PathExists(old_chrome_dll)); + EXPECT_FALSE(base::PathExists(old_version_dir)); } TEST_F(InstallerStateTest, WithProduct) { @@ -536,7 +536,7 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) { // Create the version directories. for (int i = 0; i < arraysize(version_dirs); i++) { file_util::CreateDirectory(version_dirs[i]); - EXPECT_TRUE(file_util::PathExists(version_dirs[i])); + EXPECT_TRUE(base::PathExists(version_dirs[i])); } // Create exes with the appropriate version resource. diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index adb0172..3116415 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -59,7 +59,7 @@ TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) { (bytes_read == file_util::WriteFile(log_file, &old_log_data[0], bytes_read) || - file_util::PathExists(log_file))) { + base::PathExists(log_file))) { result = LOGFILE_TRUNCATED; } } diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 722897e..c605be6 100644 --- a/chrome/installer/util/logging_installer_unittest.cc +++ b/chrome/installer/util/logging_installer_unittest.cc @@ -21,7 +21,7 @@ TEST(LoggingInstallerTest, TestTruncate) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); @@ -34,7 +34,7 @@ TEST(LoggingInstallerTest, TestTruncate) { EXPECT_EQ(installer::kTruncatedInstallerLogFileSize , file_size); // Check that the temporary file was deleted. - EXPECT_FALSE(file_util::PathExists(temp_file.Append(L".tmp"))); + EXPECT_FALSE(base::PathExists(temp_file.Append(L".tmp"))); } TEST(LoggingInstallerTest, TestTruncationNotNeeded) { @@ -46,7 +46,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); @@ -54,7 +54,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) { EXPECT_EQ(installer::LOGFILE_UNTOUCHED, installer::TruncateLogFileIfNeeded(temp_file)); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); } @@ -68,7 +68,7 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); @@ -83,7 +83,7 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) { EXPECT_EQ(installer::LOGFILE_UNTOUCHED, installer::TruncateLogFileIfNeeded(temp_file)); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); } @@ -97,7 +97,7 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); @@ -115,5 +115,5 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) { EXPECT_EQ(installer::LOGFILE_DELETED, installer::TruncateLogFileIfNeeded(temp_file)); - EXPECT_FALSE(file_util::PathExists(temp_file)); + EXPECT_FALSE(base::PathExists(temp_file)); } diff --git a/chrome/installer/util/lzma_util_unittest.cc b/chrome/installer/util/lzma_util_unittest.cc index a2fe6eb..668f42c 100644 --- a/chrome/installer/util/lzma_util_unittest.cc +++ b/chrome/installer/util/lzma_util_unittest.cc @@ -18,7 +18,7 @@ class LzmaUtilTest : public testing::Test { virtual void SetUp() { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); data_dir_ = data_dir_.AppendASCII("installer"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); + ASSERT_TRUE(base::PathExists(data_dir_)); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } @@ -55,9 +55,9 @@ TEST_F(LzmaUtilTest, OpenArchiveTest) { TEST_F(LzmaUtilTest, UnPackTest) { base::FilePath extract_dir(temp_dir_.path()); extract_dir = extract_dir.AppendASCII("UnPackTest"); - ASSERT_FALSE(file_util::PathExists(extract_dir)); + ASSERT_FALSE(base::PathExists(extract_dir)); EXPECT_TRUE(file_util::CreateDirectory(extract_dir)); - ASSERT_TRUE(file_util::PathExists(extract_dir)); + ASSERT_TRUE(base::PathExists(extract_dir)); base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); LzmaUtil lzma_util; @@ -65,14 +65,14 @@ TEST_F(LzmaUtilTest, UnPackTest) { std::wstring unpacked_file; EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("a.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("a.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("a.exe").value()); archive = data_dir_.AppendASCII("archive2.7z"); EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("b.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); lzma_util.CloseArchive(); @@ -87,8 +87,8 @@ TEST_F(LzmaUtilTest, UnPackTest) { EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("archive\\a.exe"))); - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("archive\\a.exe"))); + EXPECT_TRUE(base::PathExists( extract_dir.AppendASCII("archive\\sub_dir\\text.txt"))); } @@ -96,21 +96,21 @@ TEST_F(LzmaUtilTest, UnPackTest) { TEST_F(LzmaUtilTest, UnPackArchiveTest) { base::FilePath extract_dir(temp_dir_.path()); extract_dir = extract_dir.AppendASCII("UnPackArchiveTest"); - ASSERT_FALSE(file_util::PathExists(extract_dir)); + ASSERT_FALSE(base::PathExists(extract_dir)); EXPECT_TRUE(file_util::CreateDirectory(extract_dir)); - ASSERT_TRUE(file_util::PathExists(extract_dir)); + ASSERT_TRUE(base::PathExists(extract_dir)); base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); std::wstring unpacked_file; EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("a.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("a.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("a.exe").value()); archive = data_dir_.AppendASCII("archive2.7z"); EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("b.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); archive = data_dir_.AppendASCII("invalid_archive.7z"); diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 6e8a94f..d345e95 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -101,7 +101,7 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path) // Failure to read the file is ignored as |json_data| will be the empty string // and the remainder of this MasterPreferences object should still be // initialized as best as possible. - if (file_util::PathExists(prefs_path) && + if (base::PathExists(prefs_path) && !file_util::ReadFileToString(prefs_path, &json_data)) { LOG(ERROR) << "Failed to read preferences from " << prefs_path.value(); } diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index ccbbf64..a1b7b03 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc @@ -28,7 +28,7 @@ MoveTreeWorkItem::MoveTreeWorkItem(const base::FilePath& source_path, } bool MoveTreeWorkItem::Do() { - if (!file_util::PathExists(source_path_)) { + if (!base::PathExists(source_path_)) { LOG(ERROR) << source_path_.value() << " does not exist"; return false; } @@ -41,7 +41,7 @@ bool MoveTreeWorkItem::Do() { // 2) If the contents of src_path_ are NOT fully contained in dest_path_, we // attempt to backup dest_path_ and replace it with src_path_. This will // fail if files in dest_path_ are in use. - if (file_util::PathExists(dest_path_)) { + if (base::PathExists(dest_path_)) { // Generate a backup path that can keep the original files under dest_path_. if (!backup_path_.CreateUniqueTempDirUnderPath(temp_dir_)) { PLOG(ERROR) << "Failed to get backup path in folder " diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc index 011f9ca..3402787 100644 --- a/chrome/installer/util/move_tree_work_item_unittest.cc +++ b/chrome/installer/util/move_tree_work_item_unittest.cc @@ -62,27 +62,27 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Generate destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); - ASSERT_FALSE(file_util::PathExists(to_dir)); + ASSERT_FALSE(base::PathExists(to_dir)); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("From_Dir2"); to_file = to_file.AppendASCII("From_File"); - ASSERT_FALSE(file_util::PathExists(to_file)); + ASSERT_FALSE(base::PathExists(to_file)); // test Do() scoped_ptr<MoveTreeWorkItem> work_item( @@ -92,16 +92,16 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_FALSE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(to_file)); + EXPECT_FALSE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(from_file)); - EXPECT_FALSE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(from_file)); + EXPECT_FALSE(base::PathExists(to_dir)); } // Move one directory from source to destination when destination already @@ -111,33 +111,33 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); base::FilePath orig_to_file(to_dir); orig_to_file = orig_to_file.AppendASCII("To_File"); CreateTextFile(orig_to_file.value(), kTextContent2); - ASSERT_TRUE(file_util::PathExists(orig_to_file)); + ASSERT_TRUE(base::PathExists(orig_to_file)); base::FilePath new_to_file(to_dir); new_to_file = new_to_file.AppendASCII("From_Dir2"); new_to_file = new_to_file.AppendASCII("From_File"); - ASSERT_FALSE(file_util::PathExists(new_to_file)); + ASSERT_FALSE(base::PathExists(new_to_file)); // test Do(), don't check for duplicates. scoped_ptr<MoveTreeWorkItem> work_item( @@ -147,18 +147,18 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_FALSE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(new_to_file)); - EXPECT_FALSE(file_util::PathExists(orig_to_file)); + EXPECT_FALSE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(new_to_file)); + EXPECT_FALSE(base::PathExists(orig_to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_FALSE(file_util::PathExists(new_to_file)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_FALSE(base::PathExists(new_to_file)); + EXPECT_TRUE(base::PathExists(orig_to_file)); EXPECT_EQ(0, ReadTextFile(orig_to_file).compare(kTextContent2)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); } @@ -170,17 +170,17 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Generate destination file name base::FilePath to_file(temp_from_dir_.path()); to_file = to_file.AppendASCII("To_File"); - ASSERT_FALSE(file_util::PathExists(to_file)); + ASSERT_FALSE(base::PathExists(to_file)); // test Do() scoped_ptr<MoveTreeWorkItem> work_item( @@ -190,17 +190,17 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_file)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_TRUE(file_util::PathExists(from_file)); - EXPECT_FALSE(file_util::PathExists(to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_file)); + EXPECT_FALSE(base::PathExists(to_file)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); } @@ -211,23 +211,23 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); CreateTextFile(to_file.value(), kTextContent2); - ASSERT_TRUE(file_util::PathExists(to_file)); + ASSERT_TRUE(base::PathExists(to_file)); // test Do() scoped_ptr<MoveTreeWorkItem> work_item( @@ -237,18 +237,18 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_FALSE(file_util::PathExists(to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_FALSE(base::PathExists(to_file)); EXPECT_EQ(0, ReadTextFile(to_dir).compare(kTextContent1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent2)); } @@ -259,18 +259,18 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create an executable in destination path by copying ourself to it. base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); wchar_t exe_full_path_str[MAX_PATH]; ::GetModuleFileName(NULL, exe_full_path_str, MAX_PATH); @@ -278,7 +278,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); base::CopyFile(exe_full_path, to_file); - ASSERT_TRUE(file_util::PathExists(to_file)); + ASSERT_TRUE(base::PathExists(to_file)); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -297,17 +297,17 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); TerminateProcess(pi.hProcess, 0); @@ -322,7 +322,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); wchar_t exe_full_path_str[MAX_PATH]; ::GetModuleFileName(NULL, exe_full_path_str, MAX_PATH); @@ -330,18 +330,18 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); base::CopyFile(exe_full_path, from_file); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create a destination source dir and generate destination file name. base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); CreateTextFile(to_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(to_file)); + ASSERT_TRUE(base::PathExists(to_file)); // Run the executable in source path STARTUPINFOW si = {sizeof(si)}; @@ -360,9 +360,9 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); // Close the process and make sure all the conditions after Do() are @@ -372,17 +372,17 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { CloseHandle(pi.hProcess); CloseHandle(pi.hThread); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); } @@ -393,17 +393,17 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // // Create a file hierarchy identical to the one in the source directory. base::FilePath to_dir(temp_from_dir_.path()); @@ -435,10 +435,10 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { // Make sure that we "moved" the files, i.e. that the source directory isn't // there anymore, - EXPECT_FALSE(file_util::PathExists(from_dir1)); + EXPECT_FALSE(base::PathExists(from_dir1)); // Make sure that the original directory structure and file are still present. - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); // Make sure that the backup path is not empty. EXPECT_FALSE(file_util::IsDirectoryEmpty(temp_to_dir_.path())); @@ -452,9 +452,9 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { // Once we rollback all the original files should still be there, as should // the source files. - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); EXPECT_EQ(0, ReadTextFile(orig_to_file).compare(kTextContent1)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); } @@ -466,40 +466,40 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); base::FilePath from_file2(from_dir2); from_file2 = from_file2.AppendASCII("From_File2"); CreateTextFile(from_file2.value(), kTextContent2); - ASSERT_TRUE(file_util::PathExists(from_file2)); + ASSERT_TRUE(base::PathExists(from_file2)); // Create destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); // Create a sub-directory of the same name as in the source directory. base::FilePath to_dir2(to_dir); to_dir2 = to_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(to_dir2); - ASSERT_TRUE(file_util::PathExists(to_dir2)); + ASSERT_TRUE(base::PathExists(to_dir2)); // Create one of the files in the to sub-directory, but not the other. base::FilePath orig_to_file(to_dir2); orig_to_file = orig_to_file.AppendASCII("From_File"); CreateTextFile(orig_to_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(orig_to_file)); + ASSERT_TRUE(base::PathExists(orig_to_file)); // test Do(), check for duplicates. scoped_ptr<MoveTreeWorkItem> work_item( @@ -511,16 +511,16 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) { // Make sure that we "moved" the files, i.e. that the source directory isn't // there anymore, - EXPECT_FALSE(file_util::PathExists(from_dir1)); + EXPECT_FALSE(base::PathExists(from_dir1)); // Make sure that the original directory structure and file are still present. - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); // Make sure that the backup path is not empty. EXPECT_FALSE(file_util::IsDirectoryEmpty(temp_to_dir_.path())); // Make sure that the "new" file is also present. base::FilePath new_to_file2(to_dir2); new_to_file2 = new_to_file2.AppendASCII("From_File2"); - EXPECT_TRUE(file_util::PathExists(new_to_file2)); + EXPECT_TRUE(base::PathExists(new_to_file2)); // Check that the work item believes that this was a regular move. EXPECT_FALSE(work_item->source_moved_to_backup_); @@ -532,12 +532,12 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) { // Once we rollback all the original files should still be there, as should // the source files. - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); EXPECT_EQ(0, ReadTextFile(orig_to_file).compare(kTextContent1)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); // Also, after rollback the new "to" file should be gone. - EXPECT_FALSE(file_util::PathExists(new_to_file2)); + EXPECT_FALSE(base::PathExists(new_to_file2)); } diff --git a/chrome/installer/util/self_cleaning_temp_dir.cc b/chrome/installer/util/self_cleaning_temp_dir.cc index bb2fd6c..8b85926 100644 --- a/chrome/installer/util/self_cleaning_temp_dir.cc +++ b/chrome/installer/util/self_cleaning_temp_dir.cc @@ -21,7 +21,7 @@ void SelfCleaningTempDir::GetTopDirToCreate( base::FilePath* base_dir) { DCHECK(base_dir); - if (file_util::PathExists(temp_parent_dir)) { + if (base::PathExists(temp_parent_dir)) { // Empty base_dir means that we didn't create any extra directories. base_dir->clear(); } else { @@ -29,7 +29,7 @@ void SelfCleaningTempDir::GetTopDirToCreate( do { *base_dir = parent_dir; parent_dir = parent_dir.DirName(); - } while (parent_dir != *base_dir && !file_util::PathExists(parent_dir)); + } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); LOG_IF(WARNING, !file_util::DirectoryExists(parent_dir)) << "A non-directory is at the base of the path leading to a desired " "temp directory location: " << parent_dir.value(); diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 4a196ea..c7da3e7 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -692,7 +692,7 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, base::FilePath exe_path = base::FilePath::FromWStringHack(chrome_exe).DirName() .Append(installer::kSetupExe); - if (!file_util::PathExists(exe_path)) { + if (!base::PathExists(exe_path)) { HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ); @@ -702,7 +702,7 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, exe_path = command_line.GetProgram(); } - if (file_util::PathExists(exe_path)) { + if (base::PathExists(exe_path)) { CommandLine cmd(exe_path); cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowser, chrome_exe); @@ -1438,7 +1438,7 @@ bool ShellUtil::CreateOrUpdateShortcut( // Install the system-level shortcut if requested. chosen_path = &system_shortcut_path; } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL || - !file_util::PathExists(system_shortcut_path)) { + !base::PathExists(system_shortcut_path)) { // Otherwise install the user-level shortcut, unless the system-level // variant of this shortcut is present on the machine and |operation| states // not to create a user-level shortcut in that case. diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 73d2b27..45b5738 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -306,7 +306,7 @@ TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(file_util::PathExists( + ASSERT_TRUE(base::PathExists( fake_common_desktop_.path().Append(shortcut_name))); test_properties_->level = ShellUtil::CURRENT_USER; @@ -314,7 +314,7 @@ TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); - ASSERT_FALSE(file_util::PathExists( + ASSERT_FALSE(base::PathExists( fake_user_desktop_.path().Append(shortcut_name))); } @@ -335,7 +335,7 @@ TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(file_util::PathExists( + ASSERT_TRUE(base::PathExists( fake_common_desktop_.path().Append(shortcut_name))); test_properties_->level = ShellUtil::CURRENT_USER; @@ -343,7 +343,7 @@ TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(file_util::PathExists( + ASSERT_TRUE(base::PathExists( fake_user_desktop_.path().Append(shortcut_name))); } @@ -355,13 +355,13 @@ TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut_path)); - ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); + ASSERT_FALSE(base::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { @@ -374,13 +374,13 @@ TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path( fake_common_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut_path)); - ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); + ASSERT_FALSE(base::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { @@ -396,7 +396,7 @@ TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { string16(kShortcutName1).append(installer::kLnkExt)); base::FilePath shortcut1_path( fake_user_desktop_.path().Append(shortcut1_name)); - ASSERT_TRUE(file_util::PathExists(shortcut1_path)); + ASSERT_TRUE(base::PathExists(shortcut1_path)); test_properties_->set_shortcut_name(kShortcutName2); test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); @@ -407,14 +407,14 @@ TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); base::FilePath shortcut2_path( fake_user_desktop_.path().Append(shortcut2_name)); - ASSERT_TRUE(file_util::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut2_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut1_path)); - ASSERT_FALSE(file_util::PathExists(shortcut2_path)); - ASSERT_TRUE(file_util::PathExists(shortcut1_path.DirName())); + ASSERT_FALSE(base::PathExists(shortcut1_path)); + ASSERT_FALSE(base::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut1_path.DirName())); } TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { @@ -425,7 +425,7 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); @@ -451,7 +451,7 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path( fake_common_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); @@ -491,7 +491,7 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); base::FilePath shortcut2_path( fake_user_desktop_.path().Append(shortcut2_name)); - ASSERT_TRUE(file_util::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut2_path)); base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); @@ -534,11 +534,11 @@ TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { ++count; EXPECT_EQ(2, count); - ASSERT_TRUE(file_util::PathExists(shortcut_folder)); + ASSERT_TRUE(base::PathExists(shortcut_folder)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut_folder)); + ASSERT_FALSE(base::PathExists(shortcut_folder)); } TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { @@ -556,7 +556,7 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); // The shortcut shouldn't be removed as it was installed pointing to // |other_chrome_exe| and RemoveChromeShortcut() is being told that the @@ -564,8 +564,8 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); - ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); + ASSERT_TRUE(base::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } TEST(ShellUtilTest, BuildAppModelIdBasic) { diff --git a/chrome/installer/util/work_item_list_unittest.cc b/chrome/installer/util/work_item_list_unittest.cc index f6c2322..0944b07 100644 --- a/chrome/installer/util/work_item_list_unittest.cc +++ b/chrome/installer/util/work_item_list_unittest.cc @@ -59,7 +59,7 @@ TEST_F(WorkItemListTest, ExecutionSuccess) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -90,7 +90,7 @@ TEST_F(WorkItemListTest, ExecutionSuccess) { EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(name.c_str(), &read_out)); EXPECT_EQ(0, read_out.compare(kDataStr)); key.Close(); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item_list->Rollback(); @@ -99,7 +99,7 @@ TEST_F(WorkItemListTest, ExecutionSuccess) { // can not be deleted. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } // Execute a WorkItem list. Fail in the middle. Rollback what has been done. @@ -111,7 +111,7 @@ TEST_F(WorkItemListTest, ExecutionFailAndRollback) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -148,7 +148,7 @@ TEST_F(WorkItemListTest, ExecutionFailAndRollback) { EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); key.Close(); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); // The last one should not be there. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, not_created_key.c_str(), KEY_READ)); @@ -158,7 +158,7 @@ TEST_F(WorkItemListTest, ExecutionFailAndRollback) { // Verify everything is rolled back. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { @@ -169,7 +169,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -205,7 +205,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(name.c_str(), &read_out)); EXPECT_EQ(0, read_out.compare(kDataStr)); key.Close(); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item_list->Rollback(); @@ -214,7 +214,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { // can not be deleted. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { @@ -225,7 +225,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -263,7 +263,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { key.Close(); // Verify that the other work item was executed. - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item_list->Rollback(); @@ -272,5 +272,5 @@ TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { // can not be deleted. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } |