diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-11 04:08:40 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-11 04:08:40 +0000 |
commit | 152ea305aa6528244310077cac67afc8df71bb5a (patch) | |
tree | c835ca1bd19a49492aaa8959ef8242c28d072f65 /chrome/installer/test | |
parent | 2074e5e82dee830ce07695cd71a1fe04d782f924 (diff) | |
download | chromium_src-152ea305aa6528244310077cac67afc8df71bb5a.zip chromium_src-152ea305aa6528244310077cac67afc8df71bb5a.tar.gz chromium_src-152ea305aa6528244310077cac67afc8df71bb5a.tar.bz2 |
Move FilePath->base::FilePath
Review URL: https://codereview.chromium.org/12213104
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181663 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/test')
-rw-r--r-- | chrome/installer/test/alternate_version_generator.cc | 50 | ||||
-rw-r--r-- | chrome/installer/test/alternate_version_generator_main.cc | 14 | ||||
-rw-r--r-- | chrome/installer/test/resource_loader.cc | 2 | ||||
-rw-r--r-- | chrome/installer/test/resource_updater.cc | 5 | ||||
-rw-r--r-- | chrome/installer/test/upgrade_test.cc | 4 |
5 files changed, 40 insertions, 35 deletions
diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index e403fea..ddfd7f5 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc @@ -88,13 +88,13 @@ class ScopedTempDirectory { } return true; } - const FilePath& directory() const { + const base::FilePath& directory() const { DCHECK(!directory_.empty()); return directory_; } private: - FilePath directory_; + base::FilePath directory_; DISALLOW_COPY_AND_ASSIGN(ScopedTempDirectory); }; // class ScopedTempDirectory @@ -233,7 +233,7 @@ bool RunProcessAndWait(const wchar_t* exe_path, const std::wstring& cmdline, // Retrieves the version number of |pe_file| from its version // resource, placing the value in |version|. Returns true on success. -bool GetFileVersion(const FilePath& pe_file, ChromeVersion* version) { +bool GetFileVersion(const base::FilePath& pe_file, ChromeVersion* version) { DCHECK(version); bool result = false; upgrade_test::ResourceLoader pe_file_loader; @@ -262,7 +262,8 @@ bool GetFileVersion(const FilePath& pe_file, ChromeVersion* version) { // Retrieves the version number of setup.exe in |work_dir| from its version // resource, placing the value in |version|. Returns true on success. -bool GetSetupExeVersion(const FilePath& work_dir, ChromeVersion* version) { +bool GetSetupExeVersion(const base::FilePath& work_dir, + ChromeVersion* version) { return GetFileVersion(work_dir.Append(&kSetupExe[0]), version); } @@ -342,7 +343,7 @@ void VisitResource(const upgrade_test::EntryPath& path, } // Updates the version strings and numbers in all of |image_file|'s resources. -bool UpdateVersionIfMatch(const FilePath& image_file, +bool UpdateVersionIfMatch(const base::FilePath& image_file, VisitResourceContext* context) { if (!context || context->current_version_str.size() < context->new_version_str.size()) { @@ -415,7 +416,7 @@ bool IncrementNewVersion(upgrade_test::Direction direction, // as the |work-dir|\Chrome-bin\w.x.y.z directory. |original_version| and // |new_version|, when non-NULL, are given the original and new version numbers // on success. -bool ApplyAlternateVersion(const FilePath& work_dir, +bool ApplyAlternateVersion(const base::FilePath& work_dir, upgrade_test::Direction direction, std::wstring* original_version, std::wstring* new_version) { @@ -434,7 +435,7 @@ bool ApplyAlternateVersion(const FilePath& work_dir, file_util::FileEnumerator all_files(work_dir, true, file_util::FileEnumerator::FILES); do { - FilePath file = all_files.Next(); + base::FilePath file = all_files.Next(); if (file.empty()) { break; } @@ -445,7 +446,7 @@ bool ApplyAlternateVersion(const FilePath& work_dir, } while (doing_great); // Change the versioned directory. - FilePath chrome_bin = work_dir.Append(&kChromeBin[0]); + base::FilePath chrome_bin = work_dir.Append(&kChromeBin[0]); doing_great = file_util::Move(chrome_bin.Append(ctx.current_version_str), chrome_bin.Append(ctx.new_version_str)); @@ -466,10 +467,11 @@ bool ApplyAlternateVersion(const FilePath& work_dir, // executable's directory. This can be overridden with the --7za_path // command-line switch. FilePath Get7zaPath() { - FilePath l7za_path = CommandLine::ForCurrentProcess()->GetSwitchValuePath( - &kSwitch7zaPath[0]); + base::FilePath l7za_path = + CommandLine::ForCurrentProcess()->GetSwitchValuePath( + &kSwitch7zaPath[0]); if (l7za_path.empty()) { - FilePath dir_exe; + base::FilePath dir_exe; if (!PathService::Get(base::DIR_EXE, &dir_exe)) LOG(DFATAL) << "Failed getting directory of host executable"; l7za_path = dir_exe.Append(&k7zaPathRelative[0]); @@ -477,7 +479,8 @@ FilePath Get7zaPath() { return l7za_path; } -bool CreateArchive(const FilePath& output_file, const FilePath& input_path, +bool CreateArchive(const base::FilePath& output_file, + const base::FilePath& input_path, int compression_level) { DCHECK(compression_level == 0 || compression_level >= 1 && compression_level <= 9 && @@ -508,8 +511,8 @@ bool CreateArchive(const FilePath& output_file, const FilePath& input_path, namespace upgrade_test { -bool GenerateAlternateVersion(const FilePath& original_installer_path, - const FilePath& target_path, +bool GenerateAlternateVersion(const base::FilePath& original_installer_path, + const base::FilePath& target_path, Direction direction, std::wstring* original_version, std::wstring* new_version) { @@ -519,7 +522,7 @@ bool GenerateAlternateVersion(const FilePath& original_installer_path, return false; // Copy the original mini_installer. - FilePath mini_installer = + base::FilePath mini_installer = work_dir.directory().Append(original_installer_path.BaseName()); if (!file_util::CopyFile(original_installer_path, mini_installer)) { LOG(DFATAL) << "Failed copying \"" << original_installer_path.value() @@ -527,8 +530,9 @@ bool GenerateAlternateVersion(const FilePath& original_installer_path, return false; } - FilePath setup_ex_ = work_dir.directory().Append(&kSetupEx_[0]); - FilePath chrome_packed_7z = work_dir.directory().Append(&kChromePacked7z[0]); + base::FilePath setup_ex_ = work_dir.directory().Append(&kSetupEx_[0]); + base::FilePath chrome_packed_7z = + work_dir.directory().Append(&kChromePacked7z[0]); // Load the original file and extract setup.ex_ and chrome.packed.7z { ResourceLoader resource_loader; @@ -563,7 +567,7 @@ bool GenerateAlternateVersion(const FilePath& original_installer_path, } // Expand setup.ex_ - FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); + base::FilePath setup_exe = setup_ex_.ReplaceExtension(&kExe[0]); std::wstring command_line; command_line.append(1, L'"') .append(&kExpandExe[0]) @@ -597,7 +601,7 @@ bool GenerateAlternateVersion(const FilePath& original_installer_path, } // Get rid of intermediate files - FilePath chrome_7z(chrome_7z_name); + base::FilePath chrome_7z(chrome_7z_name); if (!file_util::Delete(chrome_7z, false) || !file_util::Delete(chrome_packed_7z, false) || !file_util::Delete(setup_ex_, false)) { @@ -648,8 +652,8 @@ bool GenerateAlternateVersion(const FilePath& original_installer_path, return file_util::Move(mini_installer, target_path); } -bool GenerateAlternatePEFileVersion(const FilePath& original_file, - const FilePath& target_file, +bool GenerateAlternatePEFileVersion(const base::FilePath& original_file, + const base::FilePath& target_file, Direction direction) { VisitResourceContext ctx; if (!GetFileVersion(original_file, &ctx.current_version)) { @@ -671,8 +675,8 @@ bool GenerateAlternatePEFileVersion(const FilePath& original_file, return true; } -bool GenerateSpecificPEFileVersion(const FilePath& original_file, - const FilePath& target_file, +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)) { diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 05442aa..b49e3d2 100644 --- a/chrome/installer/test/alternate_version_generator_main.cc +++ b/chrome/installer/test/alternate_version_generator_main.cc @@ -94,9 +94,9 @@ L" relative to this program's location.\n", // Gets the path to the source mini_installer.exe on which to operate, putting // the result in |mini_installer|. Returns true on success. bool GetMiniInstallerPath(const CommandLine& cmd_line, - FilePath* mini_installer) { + base::FilePath* mini_installer) { DCHECK(mini_installer); - FilePath result = cmd_line.GetSwitchValuePath(switches::kMiniInstaller); + base::FilePath result = cmd_line.GetSwitchValuePath(switches::kMiniInstaller); if (result.empty() && PathService::Get(base::DIR_EXE, &result)) result = result.Append(kDefaultMiniInstallerFile); if (result.empty()) @@ -106,11 +106,11 @@ bool GetMiniInstallerPath(const CommandLine& cmd_line, } // Gets the path to the output file, putting the result in |out|. -void GetOutPath(const CommandLine& cmd_line, FilePath* out) { +void GetOutPath(const CommandLine& cmd_line, base::FilePath* out) { DCHECK(out); - FilePath result = cmd_line.GetSwitchValuePath(switches::kOut); + base::FilePath result = cmd_line.GetSwitchValuePath(switches::kOut); if (result.empty()) - *out = FilePath(kDefaultOutPath); + *out = base::FilePath(kDefaultOutPath); else *out = result; } @@ -134,7 +134,7 @@ int wmain(int argc, wchar_t *argv[]) { return EXIT_SUCCESS; } - FilePath mini_installer; + base::FilePath mini_installer; if (!GetMiniInstallerPath(*cmd_line, &mini_installer)) { DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, std::wstring()); return EXIT_FAILURE; @@ -146,7 +146,7 @@ int wmain(int argc, wchar_t *argv[]) { return EXIT_FAILURE; } - FilePath out; + base::FilePath out; GetOutPath(*cmd_line, &out); if (!cmd_line->HasSwitch(switches::kForce) && file_util::PathExists(out)) { DumpUsage(*cmd_line, errors::OUT_FILE_EXISTS, out.value()); diff --git a/chrome/installer/test/resource_loader.cc b/chrome/installer/test/resource_loader.cc index 016aa1f..463c35b 100644 --- a/chrome/installer/test/resource_loader.cc +++ b/chrome/installer/test/resource_loader.cc @@ -59,7 +59,7 @@ ResourceLoader::~ResourceLoader() { } } -bool ResourceLoader::Initialize(const FilePath& pe_image_path) { +bool ResourceLoader::Initialize(const base::FilePath& pe_image_path) { DCHECK(module_ == NULL); module_ = LoadLibraryEx(pe_image_path.value().c_str(), NULL, (LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | diff --git a/chrome/installer/test/resource_updater.cc b/chrome/installer/test/resource_updater.cc index 60712b5..2deb301 100644 --- a/chrome/installer/test/resource_updater.cc +++ b/chrome/installer/test/resource_updater.cc @@ -23,7 +23,7 @@ ResourceUpdater::~ResourceUpdater() { } } -bool ResourceUpdater::Initialize(const FilePath& pe_image_path) { +bool ResourceUpdater::Initialize(const base::FilePath& pe_image_path) { DCHECK(handle_ == NULL); handle_ = BeginUpdateResource(pe_image_path.value().c_str(), FALSE); if (handle_ == NULL) { @@ -36,7 +36,8 @@ bool ResourceUpdater::Initialize(const FilePath& pe_image_path) { bool ResourceUpdater::Update(const std::wstring& name, const std::wstring& type, - WORD language_id, const FilePath& input_file) { + WORD language_id, + const base::FilePath& input_file) { DCHECK(handle_ != NULL); file_util::MemoryMappedFile input; diff --git a/chrome/installer/test/upgrade_test.cc b/chrome/installer/test/upgrade_test.cc index c0aadfb..5e1c127 100644 --- a/chrome/installer/test/upgrade_test.cc +++ b/chrome/installer/test/upgrade_test.cc @@ -20,7 +20,7 @@ class UpgradeTest : public testing::Test { public: // Generate a newer version of mini_installer.exe. static void SetUpTestCase() { - FilePath dir_exe; + base::FilePath dir_exe; ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dir_exe)); ASSERT_TRUE(file_util::CreateTemporaryFile(&next_mini_installer_path_)); ASSERT_TRUE( @@ -35,7 +35,7 @@ class UpgradeTest : public testing::Test { EXPECT_TRUE(file_util::Delete(next_mini_installer_path_, false)); } private: - static FilePath next_mini_installer_path_; + static base::FilePath next_mini_installer_path_; }; // class UpgradeTest FilePath UpgradeTest::next_mini_installer_path_; |