diff options
author | Ben Murdoch <benm@google.com> | 2013-07-17 14:55:54 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-07-17 14:55:54 +0100 |
commit | 7dbb3d5cf0c15f500944d211057644d6a2f37371 (patch) | |
tree | 701119ba0596f51b0ab466d6472b0f98211359c5 /chrome/installer | |
parent | b2ecf4836a0eb284ddac7746b1f7ba613777a739 (diff) | |
download | chromium_org-7dbb3d5cf0c15f500944d211057644d6a2f37371.tar.gz |
Merge from Chromium at DEPS revision r212014
This commit was generated by merge_to_master.py.
Change-Id: Ie0f261e9682cd8abea1eea1e51beab83d5eea21a
Diffstat (limited to 'chrome/installer')
39 files changed, 499 insertions, 499 deletions
diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc index 181007dd06..09a65b3778 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 163c6ea49c..3b1d781426 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -141,7 +141,7 @@ void CopyPreferenceFileForFirstRun(const InstallerState& installer_state, const base::FilePath& prefs_source_path) { base::FilePath prefs_dest_path(installer_state.target_path().AppendASCII( installer::kDefaultMasterPrefs)); - if (!file_util::CopyFile(prefs_source_path, prefs_dest_path)) { + if (!base::CopyFile(prefs_source_path, prefs_dest_path)) { VLOG(1) << "Failed to copy master preferences from:" << prefs_source_path.value() << " gle: " << ::GetLastError(); } @@ -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; @@ -257,7 +257,7 @@ void CleanupLegacyShortcuts(const InstallerState& installer_state, shortcut_level, &uninstall_shortcut_path); uninstall_shortcut_path = uninstall_shortcut_path.Append( dist->GetUninstallLinkName() + installer::kLnkExt); - base::Delete(uninstall_shortcut_path, false); + base::DeleteFile(uninstall_shortcut_path, false); if (installer_state.system_install()) { ShellUtil::RemoveShortcuts( @@ -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 f8e5e83925..e992aa95e2 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 f9f19fadf6..b6259540fc 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 7259c4d3dc..dab094d2cf 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; @@ -940,7 +940,7 @@ installer::InstallStatus InstallProductsHelper( if (cmd_line.HasSwitch(installer::switches::kInstallerData)) { base::FilePath prefs_path(cmd_line.GetSwitchValuePath( installer::switches::kInstallerData)); - if (!base::Delete(prefs_path, true)) { + if (!base::DeleteFile(prefs_path, true)) { LOG(ERROR) << "Failed deleting master preferences file " << prefs_path.value() << ", scheduling for deletion after reboot."; @@ -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 ce3e13cdeb..177d548f80 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,16 +98,16 @@ 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"); base::FilePath dest = work_dir.AppendASCII("archive2.7z"); EXPECT_EQ(installer::ApplyDiffPatch(src, patch, dest, NULL), 0); base::FilePath base = data_dir_.AppendASCII("archive2.7z"); - EXPECT_TRUE(file_util::ContentsEqual(dest, base)); + EXPECT_TRUE(base::ContentsEqual(dest, base)); EXPECT_EQ(installer::ApplyDiffPatch(base::FilePath(), base::FilePath(), base::FilePath(), NULL), @@ -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)); + base::DeleteFile(chrome_dir, true); + 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 a39f15349d..2d865350d4 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -64,7 +64,7 @@ namespace { void DeleteInstallTempDir(const base::FilePath& target_path) { base::FilePath temp_path(target_path.DirName().Append( installer::kInstallTempDir)); - if (file_util::DirectoryExists(temp_path)) { + if (base::DirectoryExists(temp_path)) { installer::SelfCleaningTempDir temp_dir; if (!temp_dir.Initialize(target_path.DirName(), installer::kInstallTempDir) || @@ -270,7 +270,7 @@ bool RemoveInstallerFiles(const base::FilePath& installer_directory, continue; VLOG(1) << "Deleting installer path " << to_delete.value(); - if (!base::Delete(to_delete, true)) { + if (!base::DeleteFile(to_delete, true)) { LOG(ERROR) << "Failed to delete path: " << to_delete.value(); success = false; } @@ -402,7 +402,7 @@ DeleteResult DeleteEmptyDir(const base::FilePath& path) { if (!file_util::IsDirectoryEmpty(path)) return DELETE_NOT_EMPTY; - if (base::Delete(path, true)) + if (base::DeleteFile(path, true)) return DELETE_SUCCEEDED; LOG(ERROR) << "Failed to delete folder: " << path.value(); @@ -427,12 +427,12 @@ 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."; else - file_util::CopyFile(state_file, backup); + base::CopyFile(state_file, backup); break; } return backup; @@ -449,7 +449,7 @@ DeleteResult DeleteLocalState( for (size_t i = 0; i < local_state_folders.size(); ++i) { const base::FilePath& user_local_state = local_state_folders[i]; VLOG(1) << "Deleting user profile " << user_local_state.value(); - if (!base::Delete(user_local_state, true)) { + if (!base::DeleteFile(user_local_state, true)) { LOG(ERROR) << "Failed to delete user profile dir: " << user_local_state.value(); if (schedule_on_failure) { @@ -500,7 +500,7 @@ bool MoveSetupOutOfInstallFolder(const InstallerState& installer_state, // We cannot delete the file right away, but try to delete it some other // way. Either with the help of a different process or the system. - if (ret && !base::DeleteAfterReboot(temp_file)) { + if (ret && !base::DeleteFileAfterReboot(temp_file)) { static const uint32 kDeleteAfterMs = 10 * 1000; installer::DeleteFileFromTempProcess(temp_file, kDeleteAfterMs); } @@ -543,7 +543,7 @@ DeleteResult DeleteAppHostFilesAndFolders(const InstallerState& installer_state, DeleteResult result = DELETE_SUCCEEDED; base::FilePath app_host_exe(target_path.Append(installer::kChromeAppHostExe)); - if (!base::Delete(app_host_exe, false)) { + if (!base::DeleteFile(app_host_exe, false)) { result = DELETE_FAILED; LOG(ERROR) << "Failed to delete path: " << app_host_exe.value(); } @@ -589,7 +589,7 @@ DeleteResult DeleteChromeFilesAndFolders(const InstallerState& installer_state, } VLOG(1) << "Deleting install path " << to_delete.value(); - if (!base::Delete(to_delete, true)) { + if (!base::DeleteFile(to_delete, true)) { LOG(ERROR) << "Failed to delete path (1st try): " << to_delete.value(); if (installer_state.FindProduct(BrowserDistribution::CHROME_FRAME)) { // We don't try killing Chrome processes for Chrome Frame builds since @@ -605,7 +605,7 @@ DeleteResult DeleteChromeFilesAndFolders(const InstallerState& installer_state, // Try closing any running Chrome processes and deleting files once // again. CloseAllChromeProcesses(); - if (!base::Delete(to_delete, true)) { + if (!base::DeleteFile(to_delete, true)) { LOG(ERROR) << "Failed to delete path (2nd try): " << to_delete.value(); result = DELETE_FAILED; @@ -1351,7 +1351,7 @@ InstallStatus UninstallProduct(const InstallationState& original_state, // Try and delete the preserved local state once the post-install // operations are complete. if (!backup_state_file.empty()) - base::Delete(backup_state_file, false); + base::DeleteFile(backup_state_file, false); return ret; } diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index 3cd067adec..c8cf3b2b84 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc @@ -75,7 +75,7 @@ class ScopedTempDirectory { public: ScopedTempDirectory() { } ~ScopedTempDirectory() { - if (!directory_.empty() && !base::Delete(directory_, true)) { + if (!directory_.empty() && !base::DeleteFile(directory_, true)) { LOG(DFATAL) << "Failed deleting temporary directory \"" << directory_.value() << "\""; } @@ -524,7 +524,7 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path, // Copy the original mini_installer. base::FilePath mini_installer = work_dir.directory().Append(original_installer_path.BaseName()); - if (!file_util::CopyFile(original_installer_path, mini_installer)) { + if (!base::CopyFile(original_installer_path, mini_installer)) { LOG(DFATAL) << "Failed copying \"" << original_installer_path.value() << "\" to \"" << mini_installer.value() << "\""; return false; @@ -602,9 +602,9 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path, // Get rid of intermediate files base::FilePath chrome_7z(chrome_7z_name); - if (!base::Delete(chrome_7z, false) || - !base::Delete(chrome_packed_7z, false) || - !base::Delete(setup_ex_, false)) { + if (!base::DeleteFile(chrome_7z, false) || + !base::DeleteFile(chrome_packed_7z, false) || + !base::DeleteFile(setup_ex_, false)) { LOG(DFATAL) << "Failed deleting intermediate files"; return false; } @@ -679,7 +679,7 @@ bool GenerateSpecificPEFileVersion(const base::FilePath& original_file, const base::FilePath& target_file, const Version& version) { // First copy original_file to target_file. - if (!file_util::CopyFile(original_file, target_file)) { + if (!base::CopyFile(original_file, target_file)) { LOG(DFATAL) << "Failed copying \"" << original_file.value() << "\" to \"" << target_file.value() << "\""; return false; diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 2227e74454..85d925cfad 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/test/upgrade_test.cc b/chrome/installer/test/upgrade_test.cc index 7c9f9bd91a..cca93594b5 100644 --- a/chrome/installer/test/upgrade_test.cc +++ b/chrome/installer/test/upgrade_test.cc @@ -32,7 +32,7 @@ class UpgradeTest : public testing::Test { // Clean up by deleting the created newer version of mini_installer.exe. static void TearDownTestCase() { - EXPECT_TRUE(base::Delete(next_mini_installer_path_, false)); + EXPECT_TRUE(base::DeleteFile(next_mini_installer_path_, false)); } private: static base::FilePath next_mini_installer_path_; diff --git a/chrome/installer/tools/validate_installation_main.cc b/chrome/installer/tools/validate_installation_main.cc index 1fd86dee39..8c5069fd1f 100644 --- a/chrome/installer/tools/validate_installation_main.cc +++ b/chrome/installer/tools/validate_installation_main.cc @@ -81,7 +81,7 @@ ConsoleLogHelper::~ConsoleLogHelper() { // Delete the log file if it wasn't written to (this is expected). int64 file_size = 0; if (file_util::GetFileSize(log_file_path_, &file_size) && file_size == 0) - base::Delete(log_file_path_, false); + base::DeleteFile(log_file_path_, false); } // Returns the path to the log file to create. The file should be empty at diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index 01a106b4cb..59757e4031 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 9e8d5bfd57..56c8617009 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 118a217ad9..1ec3c8a837 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -29,31 +29,31 @@ 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 - (!file_util::DirectoryExists(source_path_)) && - (!file_util::DirectoryExists(dest_path_)) && - (file_util::ContentsEqual(source_path_, dest_path_))) { + (!base::DirectoryExists(source_path_)) && + (!base::DirectoryExists(dest_path_)) && + (base::ContentsEqual(source_path_, dest_path_))) { VLOG(1) << "Source file " << source_path_.value() << " and destination file " << dest_path_.value() << " are exactly same. Returning true."; return true; } else if ((dest_exist) && (overwrite_option_ == WorkItem::NEW_NAME_IF_IN_USE) && - (!file_util::DirectoryExists(source_path_)) && - (!file_util::DirectoryExists(dest_path_)) && + (!base::DirectoryExists(source_path_)) && + (!base::DirectoryExists(dest_path_)) && (IsFileInUse(dest_path_))) { // handle overwrite_option_ = NEW_NAME_IF_IN_USE case. if (alternative_path_.empty() || - file_util::PathExists(alternative_path_) || - !file_util::CopyFile(source_path_, alternative_path_)) { + base::PathExists(alternative_path_) || + !base::CopyFile(source_path_, alternative_path_)) { LOG(ERROR) << "failed to copy " << source_path_.value() << " to " << alternative_path_.value(); return false; @@ -90,7 +90,7 @@ bool CopyTreeWorkItem::Do() { } // In all cases that reach here, copy source to destination. - if (file_util::CopyDirectory(source_path_, dest_path_, true)) { + if (base::CopyDirectory(source_path_, dest_path_, true)) { copied_to_dest_path_ = true; VLOG(1) << "Copied source " << source_path_.value() << " to destination " << dest_path_.value(); @@ -109,7 +109,7 @@ void CopyTreeWorkItem::Rollback() { // If this does happen sometimes, we may consider using Move instead of // Delete here. For now we just log the error and continue with the // rest of rollback operation. - if (copied_to_dest_path_ && !base::Delete(dest_path_, true)) { + if (copied_to_dest_path_ && !base::DeleteFile(dest_path_, true)) { LOG(ERROR) << "Can not delete " << dest_path_.value(); } if (moved_to_backup_) { @@ -120,13 +120,13 @@ void CopyTreeWorkItem::Rollback() { } } if (copied_to_alternate_path_ && - !base::Delete(alternative_path_, true)) { + !base::DeleteFile(alternative_path_, true)) { LOG(ERROR) << "Can not delete " << alternative_path_.value(); } } 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 23cc5b36a7..3b64832606 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(file_util::ContentsEqual(file_name_from, file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); + EXPECT_TRUE(base::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"); - file_util::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + base::CopyFile(exe_full_path, 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(file_util::ContentsEqual(exe_full_path, backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); + EXPECT_TRUE(base::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)); + EXPECT_TRUE(base::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"); - file_util::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + base::CopyFile(exe_full_path, 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,24 +441,24 @@ 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)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); // verify that the backup path does not exist EXPECT_TRUE(work_item->backup_path_.path().empty()); - EXPECT_TRUE(file_util::ContentsEqual(file_name_from, alternate_to)); + EXPECT_TRUE(base::ContentsEqual(file_name_from, 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)); + EXPECT_TRUE(base::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)); + EXPECT_TRUE(base::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)); + EXPECT_TRUE(base::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"); - file_util::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + base::CopyFile(exe_full_path, file_name_to); + ASSERT_TRUE(base::PathExists(file_name_to)); // Get the path of backup file base::FilePath backup_file(temp_dir_.path()); @@ -544,25 +544,25 @@ 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_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); + 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_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); + EXPECT_FALSE(base::PathExists(backup_file)); // Now delete the destination and try copying the file again. - base::Delete(file_name_to, true); + base::DeleteFile(file_name_to, true); work_item.reset(WorkItem::CreateCopyTreeWorkItem( file_name_from, file_name_to, temp_dir_.path(), WorkItem::IF_NOT_PRESENT, @@ -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"); - file_util::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + base::CopyFile(exe_full_path, 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,18 +641,18 @@ 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(file_util::ContentsEqual(exe_full_path, backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); + EXPECT_TRUE(base::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(file_util::ContentsEqual(exe_full_path, backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, backup_file)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. @@ -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,16 +708,16 @@ 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)); + EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); 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)); + EXPECT_TRUE(base::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 a21d3eb0d8..2e1ffa3c2d 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 1dce3ece62..ba3e81ba74 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_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index f86405c204..5131b1d58b 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -63,7 +63,7 @@ bool ScheduleFileSystemEntityForDeletion(const wchar_t* path) { } DWORD flags = MOVEFILE_DELAY_UNTIL_REBOOT; - if (!file_util::DirectoryExists(base::FilePath::FromWStringHack(path))) { + if (!base::DirectoryExists(base::FilePath::FromWStringHack(path))) { // This flag valid only for files flags |= MOVEFILE_REPLACE_EXISTING; } diff --git a/chrome/installer/util/delete_after_reboot_helper_unittest.cc b/chrome/installer/util/delete_after_reboot_helper_unittest.cc index 02b52a773f..7fb7360c2d 100644 --- a/chrome/installer/util/delete_after_reboot_helper_unittest.cc +++ b/chrome/installer/util/delete_after_reboot_helper_unittest.cc @@ -39,7 +39,7 @@ class DeleteAfterRebootHelperTest : public testing::Test { } virtual void TearDown() { // Delete the temporary directory if it's still there. - base::Delete(temp_dir_, true); + base::DeleteFile(temp_dir_, true); // Try and restore the pending moves value, if we have one. if (IsUserAnAdmin() && original_pending_moves_.size() > 1) { @@ -228,7 +228,7 @@ TEST_F(DeleteAfterRebootHelperTest, TestFileDeleteSchedulingWithActualDeletes) { } // Delete the temporary directory. - base::Delete(temp_dir_, true); + base::DeleteFile(temp_dir_, true); // Test that we can remove the pending deletes. EXPECT_TRUE(RemoveFromMovesPendingReboot(temp_dir_.value().c_str())); diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc index a5ccf4d324..198a1d7f75 100644 --- a/chrome/installer/util/delete_tree_work_item.cc +++ b/chrome/installer/util/delete_tree_work_item.cc @@ -62,7 +62,7 @@ bool DeleteTreeWorkItem::Do() { if (!backup.CreateUniqueTempDirUnderPath(temp_path_)) { PLOG(ERROR) << "Could not create temp dir in " << temp_path_.value(); abort = true; - } else if (!file_util::CopyFile(key_file, + } else if (!base::CopyFile(key_file, backup.path().Append(key_file.BaseName()))) { PLOG(ERROR) << "Could not back up " << key_file.value() << " to directory " << backup.path().value(); @@ -91,7 +91,7 @@ bool DeleteTreeWorkItem::Do() { // We can safely delete the key files now. for (ptrdiff_t i = 0; !abort && i != num_key_files_; ++i) { base::FilePath& key_file = key_paths_[i]; - if (!base::Delete(key_file, true)) { + if (!base::DeleteFile(key_file, true)) { // This should not really be possible because of the above. PLOG(DFATAL) << "Unexpectedly could not delete " << key_file.value(); abort = true; @@ -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 " @@ -117,7 +117,7 @@ bool DeleteTreeWorkItem::Do() { } else { base::FilePath backup = backup_path_.path().Append(root_path_.BaseName()); - if (!file_util::CopyDirectory(root_path_, backup, true)) { + if (!base::CopyDirectory(root_path_, backup, true)) { LOG(ERROR) << "can not copy " << root_path_.value() << " to backup path " << backup.value(); return false; @@ -126,7 +126,7 @@ bool DeleteTreeWorkItem::Do() { } } } - if (!base::Delete(root_path_, true)) { + if (!base::DeleteFile(root_path_, true)) { LOG(ERROR) << "can not delete " << root_path_.value(); return ignore_failure_; } @@ -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 0d6e09d256..3181c53531 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); @@ -181,8 +181,8 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { ::GetModuleFileNameW(NULL, exe_full_path_str, MAX_PATH); base::FilePath exe_full_path(exe_full_path_str); - file_util::CopyFile(exe_full_path, key_path); - ASSERT_TRUE(file_util::PathExists(key_path)); + base::CopyFile(exe_full_path, 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 0607b98a3b..6a97d84008 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 8fee493191..25bcba86f2 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 07a2b0cba4..424acefcbc 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 5fd81bc9f6..32d9b5acb4 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; @@ -665,7 +665,7 @@ void InstallerState::RemoveOldVersionDirectories( LOG(ERROR) << "Deleting old version directory: " << next_version.value(); // Attempt to recursively delete the old version dir. - bool delete_succeeded = base::Delete(next_version, true); + bool delete_succeeded = base::DeleteFile(next_version, true); // Note: temporarily log old version deletion at ERROR level to make it // more likely we see this in the installer log. diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index 1d5fbb5089..a5142b3205 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 adb01721ed..15b3d7282d 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -59,11 +59,11 @@ 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; } } - } else if (base::Delete(log_file, false)) { + } else if (base::DeleteFile(log_file, false)) { // Couldn't get sufficient access to the log file, optimistically try to // delete it. result = LOGFILE_DELETED; diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 722897edf7..c605be691e 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 a2fe6eb842..668f42ca01 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 6e8a94fb17..d345e95c63 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/master_preferences_dummy.cc b/chrome/installer/util/master_preferences_dummy.cc index 4b363d91cf..f9bbbe9f47 100644 --- a/chrome/installer/util/master_preferences_dummy.cc +++ b/chrome/installer/util/master_preferences_dummy.cc @@ -14,7 +14,7 @@ #include "base/logging.h" #include "base/values.h" -#include "googleurl/src/gurl.h" +#include "url/gurl.h" namespace installer { diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index ec6e1cbda5..3525eff5e4 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -23,7 +23,7 @@ class MasterPreferencesTest : public testing::Test { } virtual void TearDown() { - EXPECT_TRUE(base::Delete(prefs_file_, false)); + EXPECT_TRUE(base::DeleteFile(prefs_file_, false)); } const base::FilePath& prefs_file() const { return prefs_file_; } @@ -41,7 +41,7 @@ struct ExpectedBooleans { } // namespace TEST_F(MasterPreferencesTest, NoFileToParse) { - EXPECT_TRUE(base::Delete(prefs_file(), false)); + EXPECT_TRUE(base::DeleteFile(prefs_file(), false)); installer::MasterPreferences prefs(prefs_file()); EXPECT_FALSE(prefs.read_from_file()); } @@ -275,7 +275,7 @@ TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { } // Delete temporary prefs file. - EXPECT_TRUE(base::Delete(prefs_file, false)); + EXPECT_TRUE(base::DeleteFile(prefs_file, false)); // Check that if master prefs doesn't exist, we can still parse the common // prefs. diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index ccbbf64a86..a1b7b031fc 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 11dc26ec04..c00a44d71d 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,26 +259,26 @@ 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); base::FilePath exe_full_path(exe_full_path_str); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); - file_util::CopyFile(exe_full_path, to_file); - ASSERT_TRUE(file_util::PathExists(to_file)); + base::CopyFile(exe_full_path, to_file); + ASSERT_TRUE(base::PathExists(to_file)); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -297,18 +297,18 @@ 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(file_util::ContentsEqual(exe_full_path, to_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, to_file)); TerminateProcess(pi.hProcess, 0); EXPECT_TRUE(WaitForSingleObject(pi.hProcess, 10000) == WAIT_OBJECT_0); @@ -322,26 +322,26 @@ 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); base::FilePath exe_full_path(exe_full_path_str); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); - file_util::CopyFile(exe_full_path, from_file); - ASSERT_TRUE(file_util::PathExists(from_file)); + base::CopyFile(exe_full_path, 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,10 +360,10 @@ 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(file_util::ContentsEqual(exe_full_path, to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, to_file)); // Close the process and make sure all the conditions after Do() are // still true. @@ -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(file_util::ContentsEqual(exe_full_path, to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, from_file)); + 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 bb2fd6c6f9..6426dd9f98 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,8 +29,8 @@ void SelfCleaningTempDir::GetTopDirToCreate( do { *base_dir = parent_dir; parent_dir = parent_dir.DirName(); - } while (parent_dir != *base_dir && !file_util::PathExists(parent_dir)); - LOG_IF(WARNING, !file_util::DirectoryExists(parent_dir)) + } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); + LOG_IF(WARNING, !base::DirectoryExists(parent_dir)) << "A non-directory is at the base of the path leading to a desired " "temp directory location: " << parent_dir.value(); } @@ -78,7 +78,7 @@ bool SelfCleaningTempDir::Delete() { // First try to recursively delete the leaf directory managed by our // base::ScopedTempDir. - if (!base::Delete(path(), true)) { + if (!base::DeleteFile(path(), true)) { // That failed, so schedule the temp dir and its contents for deletion after // reboot. LOG(WARNING) << "Failed to delete temporary directory " << path().value() diff --git a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc index c9416191c2..a752f177d7 100644 --- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc +++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc @@ -74,14 +74,14 @@ TEST_F(SelfCleaningTempDirTest, RemoveUnusedOnDelete) { SelfCleaningTempDir temp_dir; EXPECT_TRUE(temp_dir.Initialize(parent_temp_dir, L"Three")); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); EXPECT_TRUE(temp_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir)); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName())); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName())); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } // Test that two clients can work in the same area. @@ -101,23 +101,23 @@ TEST_F(SelfCleaningTempDirTest, TwoClients) { // Both clients are where they are expected. EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir1.path()); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir2.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir1.path())); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir2.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir1.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir2.path())); // Second client goes away. EXPECT_TRUE(temp_dir2.Delete()); // The first is now useless. - EXPECT_FALSE(file_util::DirectoryExists(temp_dir1.path())); + EXPECT_FALSE(base::DirectoryExists(temp_dir1.path())); // But the intermediate dirs are still present - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir)); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir)); // Now the first goes away. EXPECT_TRUE(temp_dir1.Delete()); // And cleans up after itself. - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir)); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName())); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName())); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } // Test that all intermediate dirs are cleaned up if they're empty when the @@ -133,14 +133,14 @@ TEST_F(SelfCleaningTempDirTest, RemoveUnusedOnDestroy) { SelfCleaningTempDir temp_dir; EXPECT_TRUE(temp_dir.Initialize(parent_temp_dir, L"Three")); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); } - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir)); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName())); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName())); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } // Test that intermediate dirs are left behind if they're not empty when the @@ -158,16 +158,16 @@ TEST_F(SelfCleaningTempDirTest, LeaveUsedOnDestroy) { SelfCleaningTempDir temp_dir; EXPECT_TRUE(temp_dir.Initialize(parent_temp_dir, L"Three")); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); // Drop a file somewhere. EXPECT_EQ(arraysize(kHiHon) - 1, file_util::WriteFile(parent_temp_dir.Append(GetRandomFilename()), kHiHon, arraysize(kHiHon) - 1)); } - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir)); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } } // namespace installer diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 4a196eafb5..94b7ec019e 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); @@ -1177,7 +1177,7 @@ bool GetAppShortcutsFolder(BrowserDistribution* dist, folder = folder.Append( ShellUtil::GetBrowserModelId(dist, level == ShellUtil::CURRENT_USER)); - if (!file_util::DirectoryExists(folder)) { + if (!base::DirectoryExists(folder)) { VLOG(1) << "No start screen shortcuts."; return false; } @@ -1200,7 +1200,7 @@ bool ShortcutOpUnpin(const base::FilePath& shortcut_path) { } bool ShortcutOpDelete(const base::FilePath& shortcut_path) { - bool ret = base::Delete(shortcut_path, false); + bool ret = base::DeleteFile(shortcut_path, false); LOG_IF(ERROR, !ret) << "Failed to remove " << shortcut_path.value(); return ret; } @@ -1269,7 +1269,7 @@ bool RemoveShortcutFolder(ShellUtil::ShortcutLocation location, LOG(WARNING) << "Cannot find path at location " << location; return false; } - if (!base::Delete(shortcut_folder, true)) { + if (!base::DeleteFile(shortcut_folder, true)) { LOG(ERROR) << "Cannot remove folder " << shortcut_folder.value(); return false; } @@ -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 73d2b27bed..45b5738633 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 f6c2322d25..0944b07109 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)); } |