summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhnguyen@google.com <hnguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-31 19:12:43 +0000
committerhnguyen@google.com <hnguyen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-31 19:12:43 +0000
commit8f7a9b6124529c6a6400d13c3e2a64f52d53e2ad (patch)
treedcfc2ab326f98b1c08a2092f24f7825a11dc433c
parent7205054ee8c3cea2d61d49d8a61f85d20ed155ed (diff)
downloadchromium_src-8f7a9b6124529c6a6400d13c3e2a64f52d53e2ad.zip
chromium_src-8f7a9b6124529c6a6400d13c3e2a64f52d53e2ad.tar.gz
chromium_src-8f7a9b6124529c6a6400d13c3e2a64f52d53e2ad.tar.bz2
Add test for Chrome install with existing Chrome Frame user/sys level.
BUG=none TEST=none Review URL: http://codereview.chromium.org/8384002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107988 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.cc40
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.h9
-rw-r--r--chrome/test/mini_installer_test/run_all_unittests.cc2
-rw-r--r--chrome/test/mini_installer_test/test.cc10
4 files changed, 42 insertions, 19 deletions
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc
index 27a4227..767e038 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.cc
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc
@@ -182,8 +182,15 @@ void ChromeMiniInstaller::InstallMiniInstaller(bool over_install,
const FilePath& path) {
LOG(INFO) << "Install level is: "
<< (system_install_ ? "system" : "user");
- RunInstaller(CommandLine(path));
-
+ ASSERT_TRUE(file_util::PathExists(path));
+ CommandLine installer(path);
+ if (is_chrome_frame_) {
+ installer.AppendSwitch(installer::switches::kDoNotCreateShortcuts);
+ installer.AppendSwitch(installer::switches::kDoNotLaunchChrome);
+ installer.AppendSwitch(installer::switches::kDoNotRegisterForUpdateLaunch);
+ installer.AppendSwitch(installer::switches::kChromeFrame);
+ }
+ RunInstaller(installer);
std::string version;
ASSERT_TRUE(GetChromeVersionFromRegistry(&version))
<< "Install failed: unable to get version.";
@@ -216,6 +223,10 @@ void ChromeMiniInstaller::InstallChromeUsingMultiInstall() {
void ChromeMiniInstaller::InstallChromeFrameUsingMultiInstall() {
CommandLine cmd = GetBaseMultiInstallCommand();
+ cmd.AppendSwitch(installer::switches::kDoNotCreateShortcuts);
+ cmd.AppendSwitch(installer::switches::kDoNotLaunchChrome);
+ cmd.AppendSwitch(installer::switches::kDoNotRegisterForUpdateLaunch);
+ cmd.AppendSwitch(installer::switches::kChromeFrame);
RunInstaller(cmd);
// Verify installation.
@@ -302,7 +313,15 @@ void ChromeMiniInstaller::InstallMetaInstaller() {
// Install Google Chrome through meta installer.
CommandLine installer(FilePath::FromWStringHack(
mini_installer_constants::kChromeMetaInstallerExe));
+ ASSERT_TRUE(file_util::PathExists(installer.GetProgram()));
+ if (is_chrome_frame_) {
+ installer.AppendSwitch(installer::switches::kDoNotCreateShortcuts);
+ installer.AppendSwitch(installer::switches::kDoNotLaunchChrome);
+ installer.AppendSwitch(installer::switches::kDoNotRegisterForUpdateLaunch);
+ installer.AppendSwitch(installer::switches::kChromeFrame);
+ }
RunInstaller(installer);
+
ASSERT_TRUE(MiniInstallerTestUtil::VerifyProcessClose(
mini_installer_constants::kChromeMetaInstallerExecutable));
@@ -353,7 +372,7 @@ void ChromeMiniInstaller::Repair(
std::string build_number;
ASSERT_TRUE(GetChromeVersionFromRegistry(&build_number));
FilePath install_path;
- ASSERT_TRUE(GetChromeInstallDirectoryLocation(&install_path));
+ ASSERT_TRUE(GetInstallDirectory(&install_path));
install_path = install_path.AppendASCII(build_number);
ASSERT_TRUE(file_util::Delete(install_path, true));
} else if (repair_type == ChromeMiniInstaller::REGISTRY) {
@@ -460,7 +479,7 @@ void ChromeMiniInstaller::UnInstallChromeFrameWithIERunning() {
void ChromeMiniInstaller::CleanChromeInstall() {
DeletePvRegistryKey();
FilePath install_path;
- ASSERT_TRUE(GetChromeInstallDirectoryLocation(&install_path));
+ ASSERT_TRUE(GetInstallDirectory(&install_path));
ASSERT_TRUE(file_util::Delete(install_path, true));
}
@@ -622,9 +641,9 @@ void ChromeMiniInstaller::FindChromeShortcut() {
}
}
-bool ChromeMiniInstaller::GetChromeInstallDirectoryLocation(FilePath* path) {
+bool ChromeMiniInstaller::GetInstallDirectory(FilePath* path) {
BrowserDistribution* dist = GetCurrentBrowserDistribution();
- *path = installer::GetChromeInstallPath(system_install_, dist);
+ *path = installer::GetChromeInstallPath(system_install_, dist);
FilePath parent;
if (system_install_) {
PathService::Get(base::DIR_PROGRAM_FILES, &parent);
@@ -668,16 +687,9 @@ HKEY ChromeMiniInstaller::GetRootRegistryKey() {
return type;
}
-// Launches the chrome installer and waits for it to end.
void ChromeMiniInstaller::RunInstaller(const CommandLine& command) {
ASSERT_TRUE(file_util::PathExists(command.GetProgram()));
CommandLine installer(command);
- if (is_chrome_frame_) {
- installer.AppendSwitch(installer::switches::kDoNotCreateShortcuts);
- installer.AppendSwitch(installer::switches::kDoNotLaunchChrome);
- installer.AppendSwitch(installer::switches::kDoNotRegisterForUpdateLaunch);
- installer.AppendSwitch(installer::switches::kChromeFrame);
- }
if (system_install_) {
installer.AppendSwitch(installer::switches::kSystemLevel);
}
@@ -696,7 +708,7 @@ void ChromeMiniInstaller::LaunchChrome(bool kill) {
MiniInstallerTestUtil::CloseProcesses(installer::kChromeExe);
FilePath install_path;
- ASSERT_TRUE(GetChromeInstallDirectoryLocation(&install_path));
+ ASSERT_TRUE(GetInstallDirectory(&install_path));
install_path = install_path.Append(installer::kChromeExe);
CommandLine browser(install_path);
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h
index 550eb41..7ecf4a0 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.h
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.h
@@ -26,9 +26,9 @@ class ChromeMiniInstaller {
VERSION_FOLDER
};
- // This method returns path to either program files
- // or documents and setting based on the install type.
- bool GetChromeInstallDirectoryLocation(FilePath* path);
+ // Get the location at which Chrome or Chrome Frame is installed.
+ bool GetInstallDirectory(FilePath* path);
+
// Get the base multi-install command.
CommandLine GetBaseMultiInstallCommand();
@@ -122,7 +122,8 @@ class ChromeMiniInstaller {
// Launch IE with |navigate_url|.
void LaunchIE(const std::wstring& navigate_url);
- // Run installer using provided |command|.
+ // Run installer with given |command|. If installer is
+ // system level append "--system-level" flag.
void RunInstaller(const CommandLine& command);
// Compares the registry key values after overinstall.
diff --git a/chrome/test/mini_installer_test/run_all_unittests.cc b/chrome/test/mini_installer_test/run_all_unittests.cc
index 1c72014..978bb3b 100644
--- a/chrome/test/mini_installer_test/run_all_unittests.cc
+++ b/chrome/test/mini_installer_test/run_all_unittests.cc
@@ -20,7 +20,7 @@ void BackUpProfile(bool chrome_frame) {
}
ChromeMiniInstaller installer(false, chrome_frame, "");
FilePath path;
- installer.GetChromeInstallDirectoryLocation(&path);
+ installer.GetInstallDirectory(&path);
path = path.Append(mini_installer_constants::kChromeAppDir).DirName();
FilePath backup_path = path;
// Will hold User Data path that needs to be backed-up.
diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc
index 8867149..7f00a70 100644
--- a/chrome/test/mini_installer_test/test.cc
+++ b/chrome/test/mini_installer_test/test.cc
@@ -168,6 +168,16 @@ TEST_F(MiniInstallTest, InstallChromeFrameUsingMultiInstallUser) {
TEST_F(MiniInstallTest, InstallChromeFrameUsingMultiInstallSys) {
cf_sys_installer_->InstallChromeFrameUsingMultiInstall();
}
+
+TEST_F(MiniInstallTest, InstallChromeWithExistingChromeFrameUser) {
+ cf_user_installer_->InstallChromeFrameUsingMultiInstall();
+ chrome_user_installer_->InstallChromeUsingMultiInstall();
+}
+
+TEST_F(MiniInstallTest, InstallChromeWithExistingChromeFrameSys) {
+ cf_sys_installer_->InstallChromeFrameUsingMultiInstall();
+ chrome_sys_installer_->InstallChromeUsingMultiInstall();
+}
#endif
TEST_F(MiniInstallTest, InstallMiniInstallerSys) {