diff options
author | vivianz@chromium.org <vivianz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-21 20:16:28 +0000 |
---|---|---|
committer | vivianz@chromium.org <vivianz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-21 20:16:28 +0000 |
commit | 96c2a1e8174da1fc008c666d1b23bac0d0a3be83 (patch) | |
tree | 7898a566403997bd840348d99223e6f6be89f91d /chrome/test/mini_installer_test | |
parent | 3bd2710cae6376a7ad2e8007ae6bd36f2b933f96 (diff) | |
download | chromium_src-96c2a1e8174da1fc008c666d1b23bac0d0a3be83.zip chromium_src-96c2a1e8174da1fc008c666d1b23bac0d0a3be83.tar.gz chromium_src-96c2a1e8174da1fc008c666d1b23bac0d0a3be83.tar.bz2 |
Add 3 chrome frame mini installer tests, cover installation tests while IE process is running. fixed some old tests
on verifying installation succeed.
BUG=61635
Test=None
Review URL: http://codereview.chromium.org/6524001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/mini_installer_test')
-rw-r--r-- | chrome/test/mini_installer_test/chrome_mini_installer.cc | 76 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/chrome_mini_installer.h | 14 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/test.cc | 28 |
3 files changed, 91 insertions, 27 deletions
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc index 576a921..db0254b 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.cc +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -81,9 +81,12 @@ void ChromeMiniInstaller::Install() { // This method will get the previous latest full installer from // nightly location, install it and over install with specified install_type. void ChromeMiniInstaller::OverInstallOnFullInstaller( - const std::wstring& install_type) { + const std::wstring& install_type, bool should_start_ie) { ASSERT_TRUE(has_full_installer_ && has_diff_installer_ && - has_prev_installer_); + has_prev_installer_); + + if (should_start_ie) + LaunchIE(L"http://www.google.com"); InstallMiniInstaller(false, prev_installer_); @@ -120,7 +123,6 @@ void ChromeMiniInstaller::OverInstallOnFullInstaller( } } - // This method will get the latest full installer from nightly location // and installs it. void ChromeMiniInstaller::InstallFullInstaller(bool over_install) { @@ -258,7 +260,7 @@ void ChromeMiniInstaller::UnInstall() { } MiniInstallerTestUtil::CloseProcesses(installer::kChromeExe); std::wstring uninstall_path = GetUninstallPath(); - if (uninstall_path == L"") { + if (uninstall_path.empty()) { printf("\n %ls install is in a weird state. Cleaning the machine...\n", product_name.c_str()); CleanChromeInstall(); @@ -292,6 +294,46 @@ void ChromeMiniInstaller::UnInstall() { } } +void ChromeMiniInstaller::UnInstallChromeFrameWithIERunning() { + std::wstring product_name = + mini_installer_constants::kChromeFrameProductName; + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + if (!CheckRegistryKey(dist->GetVersionKey())) { + printf("%ls is not installed.\n", product_name.c_str()); + return; + } + + MiniInstallerTestUtil::CloseProcesses(installer::kChromeExe); + std::wstring uninstall_path = GetUninstallPath(); + + if (uninstall_path.empty()) { + printf("\n %ls install is in a weird state. Cleaning the machine...\n", + product_name.c_str()); + CleanChromeInstall(); + return; + } + + ASSERT_TRUE(file_util::PathExists(FilePath(uninstall_path))); + std::wstring uninstall_args(L"\""); + uninstall_args.append(uninstall_path); + uninstall_args.append(L"\" --uninstall --force-uninstall"); + uninstall_args.append(L" --chrome-frame"); + + if (install_type_ == mini_installer_constants::kSystemInstall) + uninstall_args = uninstall_args + L" --system-level"; + + base::ProcessHandle setup_handle; + base::LaunchApp(uninstall_args, false, false, &setup_handle); + + ASSERT_TRUE(CloseUninstallWindow()); + ASSERT_TRUE(MiniInstallerTestUtil::VerifyProcessHandleClosed(setup_handle)); + ASSERT_FALSE(CheckRegistryKeyOnUninstall(dist->GetVersionKey())); + + DeleteUserDataFolder(); + MiniInstallerTestUtil::CloseProcesses( + mini_installer_constants::kIEProcessName); +} + // Will clean up the machine if Chrome install is messed up. void ChromeMiniInstaller::CleanChromeInstall() { DeletePvRegistryKey(); @@ -633,31 +675,23 @@ void ChromeMiniInstaller::VerifyMachineState() { // launch IE with cf:about:version, then check if // chrome.exe process got spawned. void ChromeMiniInstaller::VerifyChromeFrameInstall() { + // Launch IE + LaunchIE(L"gcf:about:version"); + + // Check if Chrome process got spawned. + MiniInstallerTestUtil::VerifyProcessLaunch(installer::kChromeExe, true); +} + +void ChromeMiniInstaller::LaunchIE(const std::wstring& navigate_url) { FilePath browser_path; PathService::Get(base::DIR_PROGRAM_FILES, &browser_path); browser_path = browser_path.Append(mini_installer_constants::kIELocation); browser_path = browser_path.Append(mini_installer_constants::kIEProcessName); CommandLine cmd_line(browser_path); - cmd_line.AppendArgNative(L"gcf:about:version"); + cmd_line.AppendArgNative(navigate_url); - // Launch IE base::LaunchApp(cmd_line, false, false, NULL); - - // Check if Chrome process got spawned. - MiniInstallerTestUtil::VerifyProcessLaunch(installer::kChromeExe, true); - - // Verify if IExplore folder got created - FilePath path = GetUserDataDirPath(); - path = path.AppendASCII("IEXPLORE"); - if (!file_util::PathExists(path)) { - // The profile folder for IE 6 and 7 lives in the user's Temporary Internet - // Files folder. Check there if the previous one was not found. - PathService::Get(base::DIR_IE_INTERNET_CACHE, &path); - path = path.AppendASCII("Google Chrome Frame"); - } - - ASSERT_TRUE(file_util::PathExists(path)); } // This method will launch any requested browser. diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h index fd8da6a..b48209e 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.h +++ b/chrome/test/mini_installer_test/chrome_mini_installer.h @@ -36,8 +36,11 @@ class ChromeMiniInstaller { void Install(); // This method will first install the full installer and - // then over installs with diff installer. - void OverInstallOnFullInstaller(const std::wstring& install_type); + // then over installs with diff installer. If |should_start_ie| is true, + // start IE browser before launch installer, and leave the process running + // through the installtions. + void OverInstallOnFullInstaller(const std::wstring& install_type, + bool should_start_ie); // Installs Google Chrome through meta installer. void InstallMetaInstaller(); @@ -55,6 +58,10 @@ class ChromeMiniInstaller { // Uninstalls Chrome. void UnInstall(); + // This method uninstalls Chrome Frame without closing IE browser first. + // IE browser should be running before this method is called. + void UnInstallChromeFrameWithIERunning(); + // This method will perform a over install void OverInstall(); @@ -120,6 +127,9 @@ class ChromeMiniInstaller { // machine. void VerifyChromeFrameInstall(); + // Launch IE with |navigate_url|. + void LaunchIE(const std::wstring& navigate_url); + // Launches the chrome installer and waits for it to end. void LaunchInstaller(const std::wstring& install_path, const wchar_t* process_name); diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc index bde3d7a..9c773d1 100644 --- a/chrome/test/mini_installer_test/test.cc +++ b/chrome/test/mini_installer_test/test.cc @@ -97,20 +97,32 @@ TEST_F(MiniInstallTest, FullInstallerUser) { // Overinstall full installer. TEST_F(MiniInstallTest, FullOverPreviousFullUser) { if (!chrome_frame_) - user_inst_->OverInstallOnFullInstaller(kFullInstall); + user_inst_->OverInstallOnFullInstaller(kFullInstall, false); } TEST_F(MiniInstallTest, FullOverPreviousFullSys) { - sys_inst_->OverInstallOnFullInstaller(kFullInstall); + sys_inst_->OverInstallOnFullInstaller(kFullInstall, false); +} + +// Overinstall full Chrome Frame installer while IE browser is running. +TEST_F(MiniInstallTest, FullFrameOverPreviousFullIERunningSys) { + if (chrome_frame_) + sys_inst_->OverInstallOnFullInstaller(kFullInstall, true); } // Overinstall diff installer. TEST_F(MiniInstallTest, DiffOverPreviousFullUser) { if (!chrome_frame_) - user_inst_->OverInstallOnFullInstaller(kDiffInstall); + user_inst_->OverInstallOnFullInstaller(kDiffInstall, false); } TEST_F(MiniInstallTest, DiffOverPreviousFullSys) { - sys_inst_->OverInstallOnFullInstaller(kDiffInstall); + sys_inst_->OverInstallOnFullInstaller(kDiffInstall, false); +} + +// Overinstall diff Chrome Frame installer while IE browser is running. +TEST_F(MiniInstallTest, DiffFrameOverPreviousFullIERunningSys) { + if (chrome_frame_) + sys_inst_->OverInstallOnFullInstaller(kDiffInstall, true); } // Repair version folder. @@ -132,6 +144,14 @@ TEST_F(MiniInstallTest, RepairRegistryOnFullSys) { sys_inst_->Repair(ChromeMiniInstaller::REGISTRY); } +// Run full Chrome Frame install then uninstall it while IE browser is running. +TEST_F(MiniInstallTest, FullInstallAndUnInstallChromeFrameWithIERunning) { + if (chrome_frame_) { + sys_inst_->InstallFullInstaller(false); + sys_inst_->UnInstallChromeFrameWithIERunning(); + } +} + // Install standalone. TEST_F(MiniInstallTest, InstallStandaloneUser) { if (!chrome_frame_) |