summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc1
-rw-r--r--chrome/browser/browser_main_win.cc3
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc10
-rw-r--r--chrome/browser/upgrade_detector.cc13
-rw-r--r--chrome/chrome_installer.gypi1
-rw-r--r--chrome/chrome_installer_util.gypi4
-rw-r--r--chrome/common/service_process_util.cc15
-rw-r--r--chrome/installer/setup/install.cc40
-rw-r--r--chrome/installer/setup/install.h2
-rw-r--r--chrome/installer/setup/setup_main.cc7
-rw-r--r--chrome/installer/setup/setup_util.cc34
-rw-r--r--chrome/installer/setup/setup_util.h4
-rw-r--r--chrome/installer/setup/setup_util_unittest.cc6
-rw-r--r--chrome/installer/setup/uninstall.cc10
-rw-r--r--chrome/installer/setup/uninstall.h1
-rw-r--r--chrome/installer/util/browser_distribution.cc4
-rw-r--r--chrome/installer/util/browser_distribution.h7
-rw-r--r--chrome/installer/util/google_chrome_distribution.cc9
-rw-r--r--chrome/installer/util/google_chrome_distribution.h4
-rw-r--r--chrome/installer/util/google_chrome_distribution_dummy.cc4
-rw-r--r--chrome/installer/util/helper_unittest.cc3
-rw-r--r--chrome/installer/util/install_util.cc6
-rw-r--r--chrome/installer/util/install_util.h6
-rw-r--r--chrome/installer/util/package.cc71
-rw-r--r--chrome/installer/util/package.h2
-rw-r--r--chrome/installer/util/package_unittest.cc13
-rw-r--r--chrome/installer/util/product.h2
-rw-r--r--chrome/installer/util/product_unittest.cc6
-rw-r--r--chrome/installer/util/version.cc56
-rw-r--r--chrome/installer/util/version.h51
-rw-r--r--chrome/installer/util/version_unittest.cc82
-rw-r--r--chrome_frame/test/test_with_web_server.cc10
32 files changed, 128 insertions, 359 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index cab71e2..cf4ee07 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -139,7 +139,6 @@
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/install_util.h"
#include "chrome/installer/util/shell_util.h"
-#include "chrome/installer/util/version.h"
#include "gfx/platform_font_win.h"
#include "net/base/net_util.h"
#include "net/base/sdch_manager.h"
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc
index 3887968..bd5573a 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -183,8 +183,7 @@ bool CheckMachineLevelInstall() {
// TODO(tommi): Check if using the default distribution is always the right
// thing to do.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- scoped_ptr<installer::Version> version(InstallUtil::GetChromeVersion(dist,
- true));
+ scoped_ptr<Version> version(InstallUtil::GetChromeVersion(dist, true));
if (version.get()) {
FilePath exe_path;
PathService::Get(base::DIR_EXE, &exe_path);
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index 8e8723f..9e58f04 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -745,15 +745,13 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result,
// Google Update reported that Chrome is up-to-date. Now make sure that we
// are running the latest version and if not, notify the user by falling
// into the next case of UPGRADE_SUCCESSFUL.
- // TODO(tommi): Check if using the default distribution is always the
- // right thing to do.
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- scoped_ptr<installer::Version> installed_version(
+ scoped_ptr<Version> installed_version(
InstallUtil::GetChromeVersion(dist, false));
- scoped_ptr<installer::Version> running_version(
- installer::Version::GetVersionFromString(current_version_));
+ scoped_ptr<Version> running_version(
+ Version::GetVersionFromString(current_version_));
if (!installed_version.get() ||
- !installed_version->IsHigherThan(running_version.get())) {
+ (installed_version->CompareTo(*running_version) < 0)) {
#endif
UserMetrics::RecordAction(
UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_);
diff --git a/chrome/browser/upgrade_detector.cc b/chrome/browser/upgrade_detector.cc
index a8928f1..7f3161d 100644
--- a/chrome/browser/upgrade_detector.cc
+++ b/chrome/browser/upgrade_detector.cc
@@ -30,7 +30,7 @@
#include "chrome/browser/ui/cocoa/keystone_glue.h"
#elif defined(OS_POSIX)
#include "base/process_util.h"
-#include "chrome/installer/util/version.h"
+#include "base/version.h"
#endif
namespace {
@@ -80,7 +80,6 @@ class DetectUpgradeTask : public Task {
virtual void Run() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- using installer::Version;
scoped_ptr<Version> installed_version;
#if defined(OS_WIN)
@@ -97,8 +96,8 @@ class DetectUpgradeTask : public Task {
}
#elif defined(OS_MACOSX)
installed_version.reset(
- Version::GetVersionFromString(
- keystone_glue::CurrentlyInstalledVersion()));
+ Version::GetVersionFromString(UTF16ToWideHack(
+ keystone_glue::CurrentlyInstalledVersion())));
#elif defined(OS_POSIX)
// POSIX but not Mac OS X: Linux, etc.
CommandLine command_line(*CommandLine::ForCurrentProcess());
@@ -109,7 +108,7 @@ class DetectUpgradeTask : public Task {
return;
}
- installed_version.reset(Version::GetVersionFromString(ASCIIToUTF16(reply)));
+ installed_version.reset(Version::GetVersionFromString(reply));
#endif
// Get the version of the currently *running* instance of Chrome.
@@ -119,7 +118,7 @@ class DetectUpgradeTask : public Task {
return;
}
scoped_ptr<Version> running_version(
- Version::GetVersionFromString(ASCIIToUTF16(version_info.Version())));
+ Version::GetVersionFromString(version_info.Version()));
if (running_version.get() == NULL) {
NOTREACHED() << "Failed to parse version info";
return;
@@ -129,7 +128,7 @@ class DetectUpgradeTask : public Task {
// switching from dev to beta channel, for example). The user needs a
// restart in this case as well. See http://crbug.com/46547
if (!installed_version.get() ||
- installed_version->IsHigherThan(running_version.get())) {
+ (installed_version->CompareTo(*running_version) > 0)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
upgrade_detected_task_);
upgrade_detected_task_ = NULL;
diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi
index d2be152..7e57b28 100644
--- a/chrome/chrome_installer.gypi
+++ b/chrome/chrome_installer.gypi
@@ -102,7 +102,6 @@
'installer/util/shell_util_unittest.cc',
'installer/util/wmi_unittest.cc',
'installer/util/work_item_list_unittest.cc',
- 'installer/util/version_unittest.cc',
],
'msvs_settings': {
'VCManifestTool': {
diff --git a/chrome/chrome_installer_util.gypi b/chrome/chrome_installer_util.gypi
index 4ab157c..db9ca01 100644
--- a/chrome/chrome_installer_util.gypi
+++ b/chrome/chrome_installer_util.gypi
@@ -49,8 +49,6 @@
'installer/util/set_reg_value_work_item.h',
'installer/util/util_constants.cc',
'installer/util/util_constants.h',
- 'installer/util/version.cc',
- 'installer/util/version.h',
'installer/util/wmi.cc',
'installer/util/wmi.h',
'installer/util/work_item.cc',
@@ -154,8 +152,6 @@
'installer/util/master_preferences.h',
'installer/util/master_preferences_constants.cc',
'installer/util/master_preferences_constants.h',
- 'installer/util/version.cc',
- 'installer/util/version.h',
],
'include_dirs': [
'<(DEPTH)',
diff --git a/chrome/common/service_process_util.cc b/chrome/common/service_process_util.cc
index 81899b6..bcbac69 100644
--- a/chrome/common/service_process_util.cc
+++ b/chrome/common/service_process_util.cc
@@ -10,11 +10,11 @@
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "base/version.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/service_process_util.h"
-#include "chrome/installer/util/version.h"
namespace {
@@ -75,9 +75,7 @@ ServiceProcessRunningState GetServiceProcessRunningState(
if (service_version_out)
*service_version_out = version;
- scoped_ptr<installer::Version> service_version;
- service_version.reset(
- installer::Version::GetVersionFromString(ASCIIToUTF16(version)));
+ scoped_ptr<Version> service_version(Version::GetVersionFromString(version));
// If the version string is invalid, treat it like an older version.
if (!service_version.get())
return SERVICE_OLDER_VERSION_RUNNING;
@@ -90,9 +88,8 @@ ServiceProcessRunningState GetServiceProcessRunningState(
// are out of date.
return SERVICE_NEWER_VERSION_RUNNING;
}
- scoped_ptr<installer::Version> running_version(
- installer::Version::GetVersionFromString(
- ASCIIToUTF16(version_info.Version())));
+ scoped_ptr<Version> running_version(Version::GetVersionFromString(
+ version_info.Version()));
if (!running_version.get()) {
NOTREACHED() << "Failed to parse version info";
// Our own version is invalid. This is an error case. Pretend that we
@@ -100,9 +97,9 @@ ServiceProcessRunningState GetServiceProcessRunningState(
return SERVICE_NEWER_VERSION_RUNNING;
}
- if (running_version->IsHigherThan(service_version.get())) {
+ if (running_version->CompareTo(*service_version) > 0) {
return SERVICE_OLDER_VERSION_RUNNING;
- } else if (service_version->IsHigherThan(running_version.get())) {
+ } else if (service_version->CompareTo(*running_version) > 0) {
return SERVICE_NEWER_VERSION_RUNNING;
}
return SERVICE_SAME_VERSION_RUNNING;
diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc
index 07cf55d..c5faf74 100644
--- a/chrome/installer/setup/install.cc
+++ b/chrome/installer/setup/install.cc
@@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
+#include "base/utf_string_conversions.h"
#include "chrome/installer/setup/setup_constants.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
@@ -42,7 +43,6 @@ using installer::Products;
using installer::Product;
using installer::Package;
using installer::PackageProperties;
-using installer::Version;
void AddChromeToMediaPlayerList() {
std::wstring reg_path(installer::kMediaPlayerRegPath);
@@ -177,11 +177,13 @@ void AddUninstallShortcutWorkItems(const FilePath& setup_path,
browser_dist->GetPublisherName(),
true);
install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
- L"Version", new_version.GetString(),
+ L"Version",
+ UTF8ToWide(new_version.GetString()),
true);
install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg,
L"DisplayVersion",
- new_version.GetString(), true);
+ UTF8ToWide(new_version.GetString()),
+ true);
time_t rawtime = time(NULL);
struct tm timeinfo = {0};
localtime_s(&timeinfo, &rawtime);
@@ -395,13 +397,15 @@ bool RegisterComDlls(const Package& install,
// Unregister DLLs that were left from the old version that is being upgraded.
if (current_version) {
- FilePath old_dll_path(install.path().Append(current_version->GetString()));
+ FilePath old_dll_path(install.path().Append(
+ UTF8ToWide(current_version->GetString())));
// Ignore failures to unregister old DLLs.
installer::RegisterComDllList(old_dll_path, install.system_level(), false,
false);
}
- FilePath dll_path(install.path().Append(new_version.GetString()));
+ FilePath dll_path(install.path().Append(
+ UTF8ToWide(new_version.GetString())));
return installer::RegisterComDllList(dll_path, install.system_level(), true,
true);
}
@@ -451,8 +455,8 @@ bool DoPostInstallTasks(bool multi_install,
BrowserDistribution* dist = products[i]->distribution();
version_key = dist->GetVersionKey();
inuse_list->AddSetRegValueWorkItem(root, version_key,
- google_update::kRegOldVersionField,
- current_version->GetString(), true);
+ google_update::kRegOldVersionField,
+ UTF8ToWide(current_version->GetString()), true);
// Adding this registry entry for all products is overkill.
// However, as it stands, we don't have a way to know which distribution
@@ -468,8 +472,8 @@ bool DoPostInstallTasks(bool multi_install,
PackageProperties* props = package.properties();
if (props->ReceivesUpdates()) {
inuse_list->AddSetRegValueWorkItem(root, props->GetVersionKey(),
- google_update::kRegOldVersionField,
- current_version->GetString(), true);
+ google_update::kRegOldVersionField,
+ UTF8ToWide(current_version->GetString()), true);
// TODO(tommi): We should move the rename command here. We also need to
// update Upgrade::SwapNewChromeExeIfPresent.
}
@@ -643,13 +647,13 @@ installer::InstallStatus InstallNewVersion(
// take the permissions of %ProgramFiles% folder) otherwise just move it.
if (package.system_level()) {
install_list->AddCopyTreeWorkItem(
- src_path.Append(new_version.GetString()).value(),
- package.path().Append(new_version.GetString()).value(),
+ src_path.Append(UTF8ToWide(new_version.GetString())).value(),
+ package.path().Append(UTF8ToWide(new_version.GetString())).value(),
temp_dir.value(), WorkItem::ALWAYS);
} else {
install_list->AddMoveTreeWorkItem(
- src_path.Append(new_version.GetString()).value(),
- package.path().Append(new_version.GetString()).value(),
+ src_path.Append(UTF8ToWide(new_version.GetString())).value(),
+ package.path().Append(UTF8ToWide(new_version.GetString())).value(),
temp_dir.value());
}
@@ -693,7 +697,7 @@ installer::InstallStatus InstallNewVersion(
false); // set during first install
install_list->AddSetRegValueWorkItem(root, version_key,
google_update::kRegVersionField,
- new_version.GetString(),
+ UTF8ToWide(new_version.GetString()),
true); // overwrite version
}
@@ -704,7 +708,7 @@ installer::InstallStatus InstallNewVersion(
install_list->AddCreateRegKeyWorkItem(root, version_key);
install_list->AddSetRegValueWorkItem(root, version_key,
google_update::kRegVersionField,
- new_version.GetString(),
+ UTF8ToWide(new_version.GetString()),
true); // overwrite version
install_list->AddSetRegValueWorkItem(root, version_key,
google_update::kRegNameField,
@@ -718,7 +722,7 @@ installer::InstallStatus InstallNewVersion(
current_version->get(), new_version, package)) {
installer::InstallStatus result =
file_util::PathExists(new_chrome_exe) && current_version->get() &&
- new_version.IsEqual(*current_version->get()) ?
+ new_version.Equals(**current_version) ?
installer::SAME_VERSION_REPAIR_FAILED :
installer::INSTALL_FAILED;
LOG(ERROR) << "Install failed, rolling back... result: " << result;
@@ -732,12 +736,12 @@ installer::InstallStatus InstallNewVersion(
return installer::FIRST_INSTALL_SUCCESS;
}
- if (new_version.IsEqual(*current_version->get())) {
+ if (new_version.Equals(**current_version)) {
VLOG(1) << "Install repaired of version " << new_version.GetString();
return installer::INSTALL_REPAIRED;
}
- if (new_version.IsHigherThan(current_version->get())) {
+ if (new_version.CompareTo(**current_version) > 0) {
if (file_util::PathExists(new_chrome_exe)) {
VLOG(1) << "Version updated to " << new_version.GetString()
<< " while running " << (*current_version)->GetString();
diff --git a/chrome/installer/setup/install.h b/chrome/installer/setup/install.h
index 7a572b3b..7310e4d 100644
--- a/chrome/installer/setup/install.h
+++ b/chrome/installer/setup/install.h
@@ -11,10 +11,10 @@
#include <string>
#include <vector>
+#include "base/version.h"
#include "chrome/installer/util/product.h"
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/version.h"
class DictionaryValue;
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 7429600..f4b7a8d 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -50,7 +50,6 @@ using installer::ProductPackageMapping;
using installer::Products;
using installer::Package;
using installer::Packages;
-using installer::Version;
using installer::MasterPreferences;
namespace {
@@ -95,8 +94,8 @@ DWORD UnPackArchive(const FilePath& archive,
return installer::CHROME_NOT_INSTALLED;
}
- FilePath existing_archive(
- installation.path().Append(archive_version->GetString()));
+ FilePath existing_archive(installation.path().Append(
+ UTF8ToWide(archive_version->GetString())));
existing_archive = existing_archive.Append(installer::kInstallerDir);
existing_archive = existing_archive.Append(installer::kChromeArchive);
if (int i = installer::ApplyDiffPatch(FilePath(existing_archive),
@@ -308,7 +307,7 @@ installer::InstallStatus InstallChrome(const CommandLine& cmd_line,
for (size_t i = 0; i < installation.products().size(); ++i) {
const Product* product = installation.products()[i];
scoped_ptr<Version> v(product->GetInstalledVersion());
- if (v.get() && v->IsHigherThan(installer_version.get())) {
+ if (v.get() && (v->CompareTo(*installer_version) > 0)) {
LOG(ERROR) << "Higher version is already installed.";
higher_version_installed = true;
install_status = installer::HIGHER_VERSION_EXISTS;
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index 16e0af1..34eed36 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -33,34 +33,22 @@ int installer::ApplyDiffPatch(const FilePath& src,
dest.value().c_str());
}
-installer::Version* installer::GetVersionFromArchiveDir(
- const FilePath& chrome_path) {
+Version* installer::GetVersionFromArchiveDir(const FilePath& chrome_path) {
VLOG(1) << "Looking for Chrome version folder under " << chrome_path.value();
- FilePath root_path = chrome_path.Append(L"*");
-
+ Version* version = NULL;
+ file_util::FileEnumerator version_enum(chrome_path, false,
+ file_util::FileEnumerator::DIRECTORIES);
// TODO(tommi): The version directory really should match the version of
// setup.exe. To begin with, we should at least DCHECK that that's true.
- // TODO(tommi): use file_util::FileEnumerator.
- WIN32_FIND_DATA find_data = {0};
- HANDLE file_handle = FindFirstFile(root_path.value().c_str(), &find_data);
- BOOL ret = TRUE;
- installer::Version* version = NULL;
- // Here we are assuming that the installer we have is really valid so there
- // can not be two version directories. We exit as soon as we find a valid
- // version directory.
- while (ret) {
- if (find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
- lstrcmpW(find_data.cFileName, L"..") != 0 &&
- lstrcmpW(find_data.cFileName, L".") != 0) {
- VLOG(1) << "directory found: " << find_data.cFileName;
- version = installer::Version::GetVersionFromString(find_data.cFileName);
- if (version)
- break;
- }
- ret = FindNextFile(file_handle, &find_data);
+ while (!version_enum.Next().empty()) {
+ file_util::FileEnumerator::FindInfo find_data = {0};
+ version_enum.GetFindInfo(&find_data);
+ VLOG(1) << "directory found: " << find_data.cFileName;
+ version = Version::GetVersionFromString(find_data.cFileName);
+ if (version)
+ break;
}
- FindClose(file_handle);
return version;
}
diff --git a/chrome/installer/setup/setup_util.h b/chrome/installer/setup/setup_util.h
index 468ed62..3717e07 100644
--- a/chrome/installer/setup/setup_util.h
+++ b/chrome/installer/setup/setup_util.h
@@ -8,7 +8,7 @@
#define CHROME_INSTALLER_SETUP_SETUP_UTIL_H_
#pragma once
-#include "chrome/installer/util/version.h"
+#include "base/version.h"
class FilePath;
@@ -23,7 +23,7 @@ namespace installer {
// Find the version of Chrome from an install source directory.
// Chrome_path should contain a version folder.
// Returns the first version found or NULL if no version is found.
- installer::Version* GetVersionFromArchiveDir(const FilePath& chrome_path);
+ Version* GetVersionFromArchiveDir(const FilePath& chrome_path);
} // namespace installer
#endif // CHROME_INSTALLER_SETUP_SETUP_UTIL_H_
diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc
index 72e40ed..f4a244c 100644
--- a/chrome/installer/setup/setup_util_unittest.cc
+++ b/chrome/installer/setup/setup_util_unittest.cc
@@ -62,9 +62,9 @@ TEST_F(SetupUtilTest, GetVersionFromArchiveDirTest) {
FilePath chrome_dir = test_dir_.path().AppendASCII("1.0.0.0");
file_util::CreateDirectory(chrome_dir);
ASSERT_TRUE(file_util::PathExists(chrome_dir));
- scoped_ptr<installer::Version> version(
+ scoped_ptr<Version> version(
installer::GetVersionFromArchiveDir(test_dir_.path()));
- ASSERT_TRUE(version->GetString() == L"1.0.0.0");
+ ASSERT_EQ(version->GetString(), "1.0.0.0");
file_util::Delete(chrome_dir, true);
ASSERT_FALSE(file_util::PathExists(chrome_dir));
@@ -79,5 +79,5 @@ TEST_F(SetupUtilTest, GetVersionFromArchiveDirTest) {
file_util::CreateDirectory(chrome_dir);
ASSERT_TRUE(file_util::PathExists(chrome_dir));
version.reset(installer::GetVersionFromArchiveDir(test_dir_.path()));
- ASSERT_TRUE(version->GetString() == L"2.3.4.5");
+ ASSERT_EQ(version->GetString(), "2.3.4.5");
}
diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc
index 703fec6..f9be2fa 100644
--- a/chrome/installer/setup/uninstall.cc
+++ b/chrome/installer/setup/uninstall.cc
@@ -26,7 +26,6 @@
#include "chrome/installer/util/logging_installer.h"
#include "chrome/installer/util/shell_util.h"
#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/version.h"
// Build-time generated include file.
#include "registered_dlls.h" // NOLINT
@@ -291,7 +290,7 @@ bool MoveSetupOutOfInstallFolder(const Package& package,
}
DeleteResult DeleteFilesAndFolders(const Package& package,
- const installer::Version& installed_version) {
+ const Version& installed_version) {
VLOG(1) << "DeleteFilesAndFolders: " << package.path().value();
if (package.path().empty()) {
LOG(ERROR) << "Could not get installation destination path.";
@@ -539,8 +538,7 @@ InstallStatus UninstallChrome(const FilePath& setup_path,
}
// Get the version of installed Chrome (if any)
- scoped_ptr<installer::Version>
- installed_version(product.GetInstalledVersion());
+ scoped_ptr<Version> installed_version(product.GetInstalledVersion());
// Chrome is not in use so lets uninstall Chrome by deleting various files
// and registry entries. Here we will just make best effort and keep going
@@ -601,8 +599,8 @@ InstallStatus UninstallChrome(const FilePath& setup_path,
// Simplest would be to always register them.
if (installed_version.get() && !is_chrome) {
RegisterComDllList(product.package().path().Append(
- installed_version->GetString()),
- product.system_level(), false, false);
+ UTF8ToWide(installed_version->GetString())), product.system_level(),
+ false, false);
}
}
diff --git a/chrome/installer/setup/uninstall.h b/chrome/installer/setup/uninstall.h
index 9d265cb..2ec7775 100644
--- a/chrome/installer/setup/uninstall.h
+++ b/chrome/installer/setup/uninstall.h
@@ -15,7 +15,6 @@
#include "base/command_line.h"
#include "chrome/installer/util/product.h"
#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/version.h"
namespace installer {
// This function removes all Chrome registration related keys. It returns true
diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc
index 98b2e64..2aa80b8 100644
--- a/chrome/installer/util/browser_distribution.cc
+++ b/chrome/installer/util/browser_distribution.cc
@@ -113,7 +113,7 @@ BrowserDistribution* BrowserDistribution::GetSpecificDistribution(
}
void BrowserDistribution::DoPostUninstallOperations(
- const installer::Version& version, const FilePath& local_data_path,
+ const Version& version, const FilePath& local_data_path,
const std::wstring& distribution_data) {
}
@@ -218,7 +218,7 @@ void BrowserDistribution::UpdateDiffInstallStatus(bool system_install,
}
void BrowserDistribution::LaunchUserExperiment(
- installer::InstallStatus status, const installer::Version& version,
+ installer::InstallStatus status, const Version& version,
const installer::Product& installation, bool system_level) {
}
diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h
index 2b23169..1edc73d 100644
--- a/chrome/installer/util/browser_distribution.h
+++ b/chrome/installer/util/browser_distribution.h
@@ -13,8 +13,8 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/version.h"
#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/version.h"
#if defined(OS_WIN)
#include <windows.h> // NOLINT
@@ -47,7 +47,7 @@ class BrowserDistribution {
static int GetInstallReturnCode(installer::InstallStatus install_status);
- virtual void DoPostUninstallOperations(const installer::Version& version,
+ virtual void DoPostUninstallOperations(const Version& version,
const FilePath& local_data_path,
const std::wstring& distribution_data);
@@ -100,8 +100,7 @@ class BrowserDistribution {
// experiment. This function determines if the user qualifies and if so it
// sets the wheels in motion or in simple cases does the experiment itself.
virtual void LaunchUserExperiment(installer::InstallStatus status,
- const installer::Version& version,
- const installer::Product& installation,
+ const Version& version, const installer::Product& installation,
bool system_level);
// The user has qualified for the inactive user toast experiment and this
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc
index ef8e8b0..364f14b 100644
--- a/chrome/installer/util/google_chrome_distribution.cc
+++ b/chrome/installer/util/google_chrome_distribution.cc
@@ -326,7 +326,7 @@ bool GoogleChromeDistribution::ExtractUninstallMetrics(
#endif
void GoogleChromeDistribution::DoPostUninstallOperations(
- const installer::Version& version, const FilePath& local_data_path,
+ const Version& version, const FilePath& local_data_path,
const std::wstring& distribution_data) {
// Send the Chrome version and OS version as params to the form.
// It would be nice to send the locale, too, but I don't see an
@@ -336,7 +336,6 @@ void GoogleChromeDistribution::DoPostUninstallOperations(
// characters that need escaping: 0.2.13.4. Should that change, we will
// need to escape the string before using it in a URL.
const std::wstring kVersionParam = L"crversion";
- const std::wstring kVersion = version.GetString();
const std::wstring kOSParam = L"os";
std::wstring os_version = L"na";
OSVERSIONINFO version_info;
@@ -355,8 +354,8 @@ void GoogleChromeDistribution::DoPostUninstallOperations(
iexplore = iexplore.AppendASCII("iexplore.exe");
std::wstring command = iexplore.value() + L" " + GetUninstallSurveyUrl() +
- L"&" + kVersionParam + L"=" + kVersion + L"&" + kOSParam + L"=" +
- os_version;
+ L"&" + kVersionParam + L"=" + UTF8ToWide(version.GetString()) + L"&" +
+ kOSParam + L"=" + os_version;
std::wstring uninstall_metrics;
if (ExtractUninstallMetricsFromFile(local_data_path.value(),
@@ -553,7 +552,7 @@ void SetClient(std::wstring experiment_group, bool last_write) {
// 3- It has been re-launched from the #2 case. In this case we enter
// this function with |system_install| true and a REENTRY_SYS_UPDATE status.
void GoogleChromeDistribution::LaunchUserExperiment(
- installer::InstallStatus status, const installer::Version& version,
+ installer::InstallStatus status, const Version& version,
const installer::Product& installation, bool system_level) {
if (system_level) {
if (installer::NEW_VERSION_UPDATED == status) {
diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h
index 5ac4835..006ed13 100644
--- a/chrome/installer/util/google_chrome_distribution.h
+++ b/chrome/installer/util/google_chrome_distribution.h
@@ -28,7 +28,7 @@ class GoogleChromeDistribution : public BrowserDistribution {
// distribution_data contains Google Update related data that will be
// concatenated to the survey url if the file in local_data_path indicates
// the user has opted in to providing anonymous usage data.
- virtual void DoPostUninstallOperations(const installer::Version& version,
+ virtual void DoPostUninstallOperations(const Version& version,
const FilePath& local_data_path,
const std::wstring& distribution_data);
@@ -69,7 +69,7 @@ class GoogleChromeDistribution : public BrowserDistribution {
bool incremental_install, installer::InstallStatus install_status);
virtual void LaunchUserExperiment(installer::InstallStatus status,
- const installer::Version& version,
+ const Version& version,
const installer::Product& installation,
bool system_level);
diff --git a/chrome/installer/util/google_chrome_distribution_dummy.cc b/chrome/installer/util/google_chrome_distribution_dummy.cc
index 648bfbf..370fec8 100644
--- a/chrome/installer/util/google_chrome_distribution_dummy.cc
+++ b/chrome/installer/util/google_chrome_distribution_dummy.cc
@@ -20,7 +20,7 @@ GoogleChromeDistribution::GoogleChromeDistribution(
}
void GoogleChromeDistribution::DoPostUninstallOperations(
- const installer::Version& version,
+ const Version& version,
const FilePath& local_data_path,
const std::wstring& distribution_data) {
}
@@ -106,7 +106,7 @@ void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install,
}
void GoogleChromeDistribution::LaunchUserExperiment(
- installer::InstallStatus status, const installer::Version& version,
+ installer::InstallStatus status, const Version& version,
const installer::Product& installation, bool system_level) {
NOTREACHED();
}
diff --git a/chrome/installer/util/helper_unittest.cc b/chrome/installer/util/helper_unittest.cc
index 64139cf..7c1e955 100644
--- a/chrome/installer/util/helper_unittest.cc
+++ b/chrome/installer/util/helper_unittest.cc
@@ -11,16 +11,15 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_util.h"
+#include "base/version.h"
#include "chrome/installer/util/helper.h"
#include "chrome/installer/util/package.h"
#include "chrome/installer/util/package_properties.h"
-#include "chrome/installer/util/version.h"
#include "chrome/installer/util/work_item.h"
#include "testing/gtest/include/gtest/gtest.h"
using installer::ChromePackageProperties;
using installer::Package;
-using installer::Version;
namespace {
class SetupHelperTest : public testing::Test {
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 7d0d978..c5384b3 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -78,8 +78,8 @@ std::wstring InstallUtil::GetChromeUninstallCmd(bool system_install,
return uninstall_cmd;
}
-installer::Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist,
- bool system_install) {
+Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist,
+ bool system_install) {
DCHECK(dist);
RegKey key;
std::wstring version_str;
@@ -93,7 +93,7 @@ installer::Version* InstallUtil::GetChromeVersion(BrowserDistribution* dist,
}
key.Close();
VLOG(1) << "Existing Chrome version found " << version_str;
- return installer::Version::GetVersionFromString(version_str);
+ return Version::GetVersionFromString(version_str);
}
bool InstallUtil::IsOSSupported() {
diff --git a/chrome/installer/util/install_util.h b/chrome/installer/util/install_util.h
index fd21b29..59a4fb5 100644
--- a/chrome/installer/util/install_util.h
+++ b/chrome/installer/util/install_util.h
@@ -16,9 +16,9 @@
#include "base/basictypes.h"
#include "base/command_line.h"
+#include "base/version.h"
#include "chrome/installer/util/master_preferences.h"
#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/version.h"
class WorkItemList;
class BrowserDistribution;
@@ -48,8 +48,8 @@ class InstallUtil {
// found.
// system_install: if true, looks for version number under the HKLM root,
// otherwise looks under the HKCU.
- static installer::Version* GetChromeVersion(BrowserDistribution* dist,
- bool system_install);
+ static Version* GetChromeVersion(BrowserDistribution* dist,
+ bool system_install);
// This function checks if the current OS is supported for Chromium.
static bool IsOSSupported();
diff --git a/chrome/installer/util/package.cc b/chrome/installer/util/package.cc
index 998dbc6d..68e1a33 100644
--- a/chrome/installer/util/package.cc
+++ b/chrome/installer/util/package.cc
@@ -6,6 +6,7 @@
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -57,7 +58,7 @@ bool Package::system_level() const {
FilePath Package::GetInstallerDirectory(
const Version& version) const {
- return path_.Append(version.GetString())
+ return path_.Append(UTF8ToWide(version.GetString()))
.Append(installer::kInstallerDir);
}
@@ -85,7 +86,7 @@ Version* Package::GetCurrentVersion() const {
scoped_ptr<Version> this_version(Version::GetVersionFromString(version));
if (this_version.get()) {
if (!current_version.get() ||
- current_version->IsHigherThan(this_version.get())) {
+ (current_version->CompareTo(*this_version) > 0)) {
current_version.reset(this_version.release());
} else if (current_version.get()) {
DCHECK_EQ(current_version->GetString(), this_version->GetString())
@@ -101,55 +102,41 @@ Version* Package::GetCurrentVersion() const {
void Package::RemoveOldVersionDirectories(
const Version& latest_version) const {
- std::wstring search_path(path_.value());
- file_util::AppendToPath(&search_path, L"*");
-
- // TODO(tommi): use file_util::FileEnumerator.
- WIN32_FIND_DATA find_file_data;
- HANDLE file_handle = FindFirstFile(search_path.c_str(), &find_file_data);
- if (file_handle == INVALID_HANDLE_VALUE) {
- VLOG(1) << "No directories found under: " << search_path;
- return;
- }
-
- BOOL ret = TRUE;
+ file_util::FileEnumerator version_enum(path_, false,
+ file_util::FileEnumerator::DIRECTORIES);
scoped_ptr<Version> version;
// We try to delete all directories whose versions are lower than
// latest_version.
- while (ret) {
- if (find_file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY &&
- lstrcmpW(find_file_data.cFileName, L"..") != 0 &&
- lstrcmpW(find_file_data.cFileName, L".") != 0) {
- VLOG(1) << "directory found: " << find_file_data.cFileName;
- version.reset(Version::GetVersionFromString(find_file_data.cFileName));
- if (version.get() && latest_version.IsHigherThan(version.get())) {
- FilePath remove_dir(path_.Append(find_file_data.cFileName));
- std::vector<FilePath> key_files;
-
- Products::const_iterator it = products_.begin();
- for (; it != products_.end(); ++it) {
- BrowserDistribution* dist = it->get()->distribution();
- std::vector<FilePath> dist_key_files(dist->GetKeyFiles());
- std::vector<FilePath>::const_iterator key_file_iter(
- dist_key_files.begin());
- for (; key_file_iter != dist_key_files.end(); ++key_file_iter) {
- key_files.push_back(remove_dir.Append(*key_file_iter));
- }
+ FilePath next_version = version_enum.Next();
+ while (!next_version.empty()) {
+ file_util::FileEnumerator::FindInfo find_data = {0};
+ version_enum.GetFindInfo(&find_data);
+ VLOG(1) << "directory found: " << find_data.cFileName;
+ version.reset(Version::GetVersionFromString(find_data.cFileName));
+ if (version.get() && (latest_version.CompareTo(*version) > 0)) {
+ std::vector<FilePath> key_files;
+ for (Products::const_iterator it = products_.begin();
+ it != products_.end(); ++it) {
+ BrowserDistribution* dist = it->get()->distribution();
+ std::vector<FilePath> dist_key_files(dist->GetKeyFiles());
+ std::vector<FilePath>::const_iterator key_file_iter(
+ dist_key_files.begin());
+ for (; key_file_iter != dist_key_files.end(); ++key_file_iter) {
+ key_files.push_back(next_version.Append(*key_file_iter));
}
+ }
- VLOG(1) << "Deleting directory: " << remove_dir.value();
+ VLOG(1) << "Deleting directory: " << next_version.value();
- scoped_ptr<DeleteTreeWorkItem> item(
- WorkItem::CreateDeleteTreeWorkItem(remove_dir, key_files));
- if (!item->Do())
- item->Rollback();
- }
+ scoped_ptr<DeleteTreeWorkItem> item(
+ WorkItem::CreateDeleteTreeWorkItem(next_version, key_files));
+ if (!item->Do())
+ item->Rollback();
}
- ret = FindNextFile(file_handle, &find_file_data);
- }
- FindClose(file_handle);
+ next_version = version_enum.Next();
+ }
}
} // namespace installer
diff --git a/chrome/installer/util/package.h b/chrome/installer/util/package.h
index 8d2af0c..d89baa6 100644
--- a/chrome/installer/util/package.h
+++ b/chrome/installer/util/package.h
@@ -12,11 +12,11 @@
#include "base/ref_counted.h"
class CommandLine;
+class Version;
namespace installer {
class Product;
-class Version;
class PackageProperties;
typedef std::vector<scoped_refptr<const Product> > Products;
diff --git a/chrome/installer/util/package_unittest.cc b/chrome/installer/util/package_unittest.cc
index c328f9b..b553a46 100644
--- a/chrome/installer/util/package_unittest.cc
+++ b/chrome/installer/util/package_unittest.cc
@@ -4,6 +4,7 @@
#include "base/logging.h"
#include "base/scoped_handle.h"
+#include "base/utf_string_conversions.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/master_preferences.h"
@@ -12,7 +13,6 @@
#include "chrome/installer/util/product.h"
#include "chrome/installer/util/product_unittest.h"
#include "chrome/installer/util/util_constants.h"
-#include "chrome/installer/util/version.h"
using base::win::RegKey;
using base::win::ScopedHandle;
@@ -20,7 +20,6 @@ using installer::ChromePackageProperties;
using installer::ChromiumPackageProperties;
using installer::Package;
using installer::Product;
-using installer::Version;
class PackageTest : public TestWithTempDirAndDeleteTempOverrideKeys {
protected:
@@ -48,8 +47,10 @@ TEST_F(PackageTest, Basic) {
FilePath installer_dir(package->GetInstallerDirectory(*new_version.get()));
EXPECT_FALSE(installer_dir.empty());
- FilePath new_version_dir(package->path().Append(new_version->GetString()));
- FilePath old_version_dir(package->path().Append(old_version->GetString()));
+ FilePath new_version_dir(package->path().Append(
+ UTF8ToWide(new_version->GetString())));
+ FilePath old_version_dir(package->path().Append(
+ UTF8ToWide(old_version->GetString())));
EXPECT_FALSE(file_util::PathExists(new_version_dir));
EXPECT_FALSE(file_util::PathExists(old_version_dir));
@@ -120,12 +121,12 @@ TEST_F(PackageTest, WithProduct) {
EXPECT_TRUE(chrome_key.Valid());
if (chrome_key.Valid()) {
chrome_key.WriteValue(google_update::kRegVersionField,
- current_version->GetString().c_str());
+ UTF8ToWide(current_version->GetString()).c_str());
// TODO(tommi): Also test for when there exists a new_chrome.exe.
scoped_ptr<Version> found_version(package->GetCurrentVersion());
EXPECT_TRUE(found_version.get() != NULL);
if (found_version.get()) {
- EXPECT_TRUE(current_version->IsEqual(*found_version.get()));
+ EXPECT_TRUE(current_version->Equals(*found_version));
}
}
}
diff --git a/chrome/installer/util/product.h b/chrome/installer/util/product.h
index aa1f1e5..cfd1736 100644
--- a/chrome/installer/util/product.h
+++ b/chrome/installer/util/product.h
@@ -14,6 +14,7 @@
#include "chrome/installer/util/package.h"
class CommandLine;
+class Version;
namespace installer {
class MasterPreferences;
@@ -24,7 +25,6 @@ namespace installer {
class Product;
class Package;
class PackageProperties;
-class Version;
typedef std::vector<scoped_refptr<Package> > Packages;
typedef std::vector<scoped_refptr<const Product> > Products;
diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc
index 992bd4d..64cc1da 100644
--- a/chrome/installer/util/product_unittest.cc
+++ b/chrome/installer/util/product_unittest.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/scoped_handle.h"
+#include "base/utf_string_conversions.h"
#include "chrome/installer/util/chrome_frame_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
#include "chrome/installer/util/package.h"
@@ -20,7 +21,6 @@ using installer::ChromiumPackageProperties;
using installer::Package;
using installer::Product;
using installer::ProductPackageMapping;
-using installer::Version;
using installer::MasterPreferences;
void TestWithTempDir::SetUp() {
@@ -144,12 +144,12 @@ TEST_F(ProductTest, ProductInstallBasic) {
scoped_ptr<Version> current_version(
Version::GetVersionFromString(kCurrentVersion));
version_key.WriteValue(google_update::kRegVersionField,
- current_version->GetString().c_str());
+ UTF8ToWide(current_version->GetString()).c_str());
scoped_ptr<Version> installed(product->GetInstalledVersion());
EXPECT_TRUE(installed.get() != NULL);
if (installed.get()) {
- EXPECT_TRUE(installed->IsEqual(*current_version.get()));
+ EXPECT_TRUE(installed->Equals(*current_version.get()));
}
}
}
diff --git a/chrome/installer/util/version.cc b/chrome/installer/util/version.cc
deleted file mode 100644
index 7618e7d..0000000
--- a/chrome/installer/util/version.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/installer/util/version.h"
-
-#include <vector>
-
-#include "base/format_macros.h"
-#include "base/string_number_conversions.h"
-#include "base/string_split.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/installer/util/version.h"
-
-installer::Version::Version(int64 major, int64 minor, int64 build,
- int64 patch)
- : major_(major),
- minor_(minor),
- build_(build),
- patch_(patch) {
- version_str_ = ASCIIToUTF16(
- StringPrintf("%" PRId64 ".%" PRId64 ".%" PRId64 ".%" PRId64,
- major_, minor_, build_, patch_));
-}
-
-installer::Version::~Version() {
-}
-
-bool installer::Version::IsHigherThan(const installer::Version* other) const {
- return ((major_ > other->major_) ||
- ((major_ == other->major_) && (minor_ > other->minor_)) ||
- ((major_ == other->major_) && (minor_ == other->minor_)
- && (build_ > other->build_)) ||
- ((major_ == other->major_) && (minor_ == other->minor_)
- && (build_ == other->build_)
- && (patch_ > other->patch_)));
-}
-
-installer::Version* installer::Version::GetVersionFromString(
- const string16& version_str) {
- std::vector<string16> numbers;
- base::SplitString(version_str, '.', &numbers);
-
- if (numbers.size() != 4) {
- LOG(ERROR) << "Invalid version string: " << version_str;
- return NULL;
- }
-
- int64 v0, v1, v2, v3;
- base::StringToInt64(numbers[0], &v0);
- base::StringToInt64(numbers[1], &v1);
- base::StringToInt64(numbers[2], &v2);
- base::StringToInt64(numbers[3], &v3);
- return new Version(v0, v1, v2, v3);
-}
diff --git a/chrome/installer/util/version.h b/chrome/installer/util/version.h
deleted file mode 100644
index e237260..0000000
--- a/chrome/installer/util/version.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_INSTALLER_UTIL_VERSION_H_
-#define CHROME_INSTALLER_UTIL_VERSION_H_
-#pragma once
-
-#include "base/basictypes.h"
-#include "base/string16.h"
-
-namespace installer {
-
-// TODO(tommi): We should be using the Version class from base.
-class Version {
- public:
- virtual ~Version();
-
- // Check if the current version is higher than the version object passed
- // as parameter
- bool IsHigherThan(const Version* other) const;
-
- // Return the string representation of this version
- const string16& GetString() const {
- return version_str_;
- }
-
- bool IsEqual(const Version& other) const {
- return version_str_ == other.GetString();
- }
-
- // Assume that the version string is specified by four integers separated
- // by character '.'. Return NULL if string is not of this format.
- // Caller is responsible for freeing the Version object once done.
- static Version* GetVersionFromString(const string16& version_str);
-
- private:
- int64 major_;
- int64 minor_;
- int64 build_;
- int64 patch_;
- string16 version_str_;
-
- // Classes outside this file do not have any need to create objects of
- // this type so declare constructor as private.
- Version(int64 major, int64 minor, int64 build, int64 patch);
-};
-
-} // namespace installer
-
-#endif // CHROME_INSTALLER_UTIL_VERSION_H_
diff --git a/chrome/installer/util/version_unittest.cc b/chrome/installer/util/version_unittest.cc
deleted file mode 100644
index 6a3e12c..0000000
--- a/chrome/installer/util/version_unittest.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/installer/util/version.h"
-
-#include <string>
-#include <vector>
-
-#include "base/scoped_ptr.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-static const installer::Version* kNoVersion = NULL;
-
-TEST(VersionTest, Parse) {
- EXPECT_EQ(installer::Version::GetVersionFromString(L"1"), kNoVersion);
- EXPECT_EQ(installer::Version::GetVersionFromString(L"1.2"), kNoVersion);
- EXPECT_EQ(installer::Version::GetVersionFromString(L"1.2.3"), kNoVersion);
- EXPECT_EQ(installer::Version::GetVersionFromString(L"1.2.3.4.5"), kNoVersion);
- EXPECT_EQ(installer::Version::GetVersionFromString(L"hokum"), kNoVersion);
-
- scoped_ptr<installer::Version> v1(
- installer::Version::GetVersionFromString(L"1.22.333.4444"));
- EXPECT_EQ(v1->GetString(), L"1.22.333.4444");
-}
-
-bool Implies(bool p, bool q) { return !p | q; }
-
-TEST(VersionTest, Comparison) {
- static const wchar_t* version_strings[] = {
- L"0.0.0.0",
- L"1.0.0.0",
- L"0.1.0.0",
- L"0.0.1.0",
- L"0.0.0.1",
- L"2.0.193.1",
- L"3.0.183.1",
- L"3.0.187.1",
- L"3.0.189.0",
- };
-
- std::vector<const installer::Version*> versions;
-
- for (size_t i = 0; i < _countof(version_strings); ++i) {
- std::wstring version_string(version_strings[i]);
- const installer::Version* version =
- installer::Version::GetVersionFromString(version_string);
- EXPECT_NE(version, kNoVersion);
- EXPECT_EQ(version_string, version->GetString());
- versions.push_back(version);
- }
-
- // Compare all N*N pairs and check that IsHigherThan is antireflexive.
- for (size_t i = 0; i < versions.size(); ++i) {
- const installer::Version* v1 = versions[i];
- for (size_t j = 0; j < versions.size(); ++j) {
- const installer::Version* v2 = versions[j];
- // Check exactly one of '>', '<', or '=' is true.
- bool higher = v1->IsHigherThan(v2);
- bool lower = v2->IsHigherThan(v1);
- bool equal = v1->GetString() == v2->GetString();
- EXPECT_EQ(1, higher + lower + equal);
- }
- }
-
- // Compare all N*N*N triples and check that IsHigherThan is a total order.
- for (size_t i = 0; i < versions.size(); ++i) {
- const installer::Version* v1 = versions[i];
- for (size_t j = 0; j < versions.size(); ++j) {
- const installer::Version* v2 = versions[j];
- for (size_t k = 0; k < versions.size(); ++k) {
- const installer::Version* v3 = versions[j];
- EXPECT_TRUE(Implies(v2->IsHigherThan(v1) && v3->IsHigherThan(v2),
- v3->IsHigherThan(v1)));
- }
- }
- }
-
- for (size_t i = 0; i < versions.size(); ++i) {
- delete versions[i];
- }
-}
diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc
index da35740..07b099a 100644
--- a/chrome_frame/test/test_with_web_server.cc
+++ b/chrome_frame/test/test_with_web_server.cc
@@ -271,16 +271,14 @@ void ChromeFrameTestWithWebServer::VersionTest(BrowserKind browser,
// the directory where chrome is installed.
if (!version_info) {
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
- scoped_ptr<installer::Version> ver_system(
- InstallUtil::GetChromeVersion(dist, true));
- scoped_ptr<installer::Version> ver_user(
- InstallUtil::GetChromeVersion(dist, false));
+ scoped_ptr<Version> ver_system(InstallUtil::GetChromeVersion(dist, true));
+ scoped_ptr<Version> ver_user(InstallUtil::GetChromeVersion(dist, false));
ASSERT_TRUE(ver_system.get() || ver_user.get());
bool system_install = ver_system.get() ? true : false;
FilePath cf_dll_path(installer::GetChromeInstallPath(system_install, dist));
- cf_dll_path = cf_dll_path.Append(
- ver_system.get() ? ver_system->GetString() : ver_user->GetString());
+ cf_dll_path = cf_dll_path.Append(UTF8ToWide(
+ ver_system.get() ? ver_system->GetString() : ver_user->GetString()));
cf_dll_path = cf_dll_path.Append(kChromeFrameDllName);
version_info = FileVersionInfo::CreateFileVersionInfo(cf_dll_path);
if (version_info)