diff options
author | anantha@chromium.org <anantha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 18:26:05 +0000 |
---|---|---|
committer | anantha@chromium.org <anantha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-30 18:26:05 +0000 |
commit | 38993f6f15fb7b12ee4c973910369dc82a1a5595 (patch) | |
tree | 4ebe9b3f67bfb50b3df7ac63e5a120717e5d5f9f /chrome | |
parent | 3c8808a2b5e3d01505443e4fdcba2a0e0620644a (diff) | |
download | chromium_src-38993f6f15fb7b12ee4c973910369dc82a1a5595.zip chromium_src-38993f6f15fb7b12ee4c973910369dc82a1a5595.tar.gz chromium_src-38993f6f15fb7b12ee4c973910369dc82a1a5595.tar.bz2 |
Modified the mini installer tests to work for both Google Chrome and Chromium.
Review URL: http://codereview.chromium.org/7944
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
5 files changed, 86 insertions, 52 deletions
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc index 56712d6..5819e57 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.cc +++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc @@ -22,6 +22,9 @@ void ChromeMiniInstaller::InstallMiniInstaller(bool over_install) { if (!over_install) { UnInstall(); } + printf("Will proceed with the test only if mini_installer.exe exists\n"); + ASSERT_TRUE(file_util::PathExists( + mini_installer_constants::kChromeMiniInstallerExecutable)); LaunchExe(mini_installer_constants::kChromeMiniInstallerExecutable, mini_installer_constants::kChromeMiniInstallerExecutable); BrowserDistribution* dist = BrowserDistribution::GetDistribution(); @@ -29,8 +32,8 @@ void ChromeMiniInstaller::InstallMiniInstaller(bool over_install) { FindChromeShortcut(); WaitUntilProcessStartsRunning(installer_util::kChromeExe); if (!over_install) { - ASSERT_TRUE(CloseWindow( - mini_installer_constants::kFirstChromeUI, WM_CLOSE)); + ASSERT_TRUE(CloseWindow(mini_installer_constants::kChromeFirstRunUI, + WM_CLOSE)); } else { ASSERT_TRUE(CloseWindow( mini_installer_constants::kBrowserTabName, WM_CLOSE)); @@ -38,14 +41,16 @@ void ChromeMiniInstaller::InstallMiniInstaller(bool over_install) { VerifyChromeLaunch(); } -// Installs chromesetupdev.exe, waits for the install to finish and then +// Installs chromesetup.exe, waits for the install to finish and then // checks the registry and shortcuts. -void ChromeMiniInstaller::InstallChromeSetupDev() { +void ChromeMiniInstaller::InstallMetaInstaller() { + printf("Will proceed with the test only if mini_installer.exe exists\n"); + ASSERT_TRUE(file_util::PathExists( + mini_installer_constants::kChromeMiniInstallerExecutable)); // Uninstall chrome, if already installed. UnInstall(); - - // Install older/dev version of chrome. - LaunchExe(mini_installer_constants::kChromeSetupDevExeLocation, + // Install Google Chrome through meta installer. + LaunchExe(mini_installer_constants::kChromeMetaInstallerExeLocation, mini_installer_constants::kChromeSetupExecutable); WaitUntilProcessStopsRunning( mini_installer_constants::kChromeMiniInstallerExecutable); @@ -58,25 +63,29 @@ void ChromeMiniInstaller::InstallChromeSetupDev() { ASSERT_TRUE(CheckRegistryKey(dist->GetVersionKey())); FindChromeShortcut(); WaitUntilProcessStartsRunning(installer_util::kChromeExe); - ASSERT_TRUE(CloseWindow(mini_installer_constants::kFirstChromeUI, WM_CLOSE)); + ASSERT_TRUE(CloseWindow(mini_installer_constants::kChromeFirstRunUI, + WM_CLOSE)); } -// Accepts mini/dev as parameters. If mini, installs mini_installer first. -// if dev, installs ChromeSetupDev.exe first and -// then over installs with mini_installer. -// Also, verifies if Chrome can be launched sucessfully after overinstall. +// If the build type is Google Chrome, then it first installs meta installer +// and then over installs with mini_installer. It also verifies if Chrome can +// be launched successfully after overinstall. void ChromeMiniInstaller::OverInstall() { - InstallChromeSetupDev(); - // gets the registry key value before overinstall. - std::wstring reg_key_value_returned = GetRegistryKey(); - printf("\n\nPreparing to overinstall...\n"); - printf("\nOverinstall path is %ls\n", - mini_installer_constants::kChromeMiniInstallerExecutable); - InstallMiniInstaller(true); - // Get the registry key value after over install - std::wstring reg_key_value_after_overinstall = GetRegistryKey(); - ASSERT_TRUE(VerifyOverInstall( - reg_key_value_returned, reg_key_value_after_overinstall)); + if (!IsChromiumBuild()) { + InstallMetaInstaller(); + // gets the registry key value before overinstall. + std::wstring reg_key_value_returned = GetRegistryKey(); + printf("\n\nPreparing to overinstall...\n"); + printf("\nOverinstall path is %ls\n", + mini_installer_constants::kChromeMiniInstallerExecutable); + InstallMiniInstaller(true); + // Get the registry key value after over install + std::wstring reg_key_value_after_overinstall = GetRegistryKey(); + ASSERT_TRUE(VerifyOverInstall( + reg_key_value_returned, reg_key_value_after_overinstall)); + } else { + printf("This test doesn't run on a chromium build\n"); + } } // This method first checks if Chrome is running. @@ -105,8 +114,8 @@ void ChromeMiniInstaller::UnInstall() { process_util::LaunchApp(L"\"" + uninstall_path + L"\"" + L" -uninstall", false, false, NULL); printf("\nLaunched setup.exe -uninstall....\n"); - ASSERT_TRUE(CloseWindow( - mini_installer_constants::kConfirmDialog, WM_COMMAND)); + ASSERT_TRUE(CloseWindow(mini_installer_constants::kChromeBuildType, + WM_COMMAND)); WaitUntilProcessStopsRunning( mini_installer_constants::kChromeSetupExecutable); ASSERT_FALSE(CheckRegistryKey(dist->GetVersionKey())); @@ -168,7 +177,7 @@ bool ChromeMiniInstaller::CheckRegistryKey(std::wstring key_path) { void ChromeMiniInstaller::DeleteAppFolder() { std::wstring path; ASSERT_TRUE(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); - file_util::AppendToPath(&path, mini_installer_constants::kAppDir); + file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); file_util::UpOneDirectory(&path); printf("Deleting this path after uninstall%ls\n", path.c_str()); ASSERT_TRUE(file_util::Delete(path.c_str(), true)); @@ -179,13 +188,15 @@ void ChromeMiniInstaller::FindChromeShortcut() { std::wstring username, path_name, append_path, uninstall_lnk, shortcut_path; bool return_val = false; ASSERT_TRUE(PathService::Get(base::DIR_START_MENU, &path_name)); - file_util::AppendToPath(&path_name, L"Google Chrome"); + file_util::AppendToPath(&path_name, mini_installer_constants::kChromeBuildType); // Verify if path exists. if (file_util::PathExists(path_name)) { return_val = true; uninstall_lnk = path_name; - file_util::AppendToPath(&path_name, L"Google Chrome.lnk"); - file_util::AppendToPath(&uninstall_lnk, L"Uninstall Google Chrome.lnk"); + file_util::AppendToPath(&path_name, + mini_installer_constants::kChromeLaunchShortcut); + file_util::AppendToPath(&uninstall_lnk, + mini_installer_constants::kChromeUninstallShortcut); ASSERT_TRUE(file_util::PathExists(path_name)); ASSERT_TRUE(file_util::PathExists(uninstall_lnk)); } @@ -201,7 +212,7 @@ std::wstring ChromeMiniInstaller::GetUninstallPath() { std::wstring username, append_path, path; std::wstring build_key_value = GetRegistryKey(); PathService::Get(base::DIR_LOCAL_APP_DATA, &path); - file_util::AppendToPath(&path, mini_installer_constants::kAppDir); + file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); file_util::AppendToPath(&path, build_key_value); file_util::AppendToPath(&path, installer::kInstallerDir); file_util::AppendToPath(&path, @@ -220,6 +231,15 @@ std::wstring ChromeMiniInstaller::GetRegistryKey() { return build_key_value; } +// This method checks if the build is Google Chrome or Chromium. +bool ChromeMiniInstaller::IsChromiumBuild() { + #if defined(GOOGLE_CHROME_BUILD) + return false; + #else + return true; + #endif +} + // Launches a given executable and waits until it is done. void ChromeMiniInstaller::LaunchExe(std::wstring path, const wchar_t process_name[]) { @@ -235,8 +255,7 @@ void ChromeMiniInstaller::LaunchExe(std::wstring path, void ChromeMiniInstaller::VerifyChromeLaunch() { std::wstring username, path, append_path; ASSERT_TRUE(PathService::Get(base::DIR_LOCAL_APP_DATA, &path)); - file_util::AppendToPath(&path, - mini_installer_constants::kAppDir); + file_util::AppendToPath(&path, mini_installer_constants::kChromeAppDir); file_util::AppendToPath(&path, installer_util::kChromeExe); process_util::LaunchApp(L"\"" + path + L"\"", false, false, NULL); WaitUntilProcessStartsRunning(installer_util::kChromeExe); diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.h b/chrome/test/mini_installer_test/chrome_mini_installer.h index d740942..52dbca1 100644 --- a/chrome/test/mini_installer_test/chrome_mini_installer.h +++ b/chrome/test/mini_installer_test/chrome_mini_installer.h @@ -24,8 +24,8 @@ class ChromeMiniInstaller { // Installs Chrome Mini Installer. void InstallMiniInstaller(bool over_install = false); - // Installs ChromeSetupDev.exe. - void InstallChromeSetupDev(); + // Installs Google Chrome through meta installer. + void InstallMetaInstaller(); // This method takes care of all overinstall cases. void OverInstall(); @@ -61,6 +61,9 @@ class ChromeMiniInstaller { // Reads registry key. std::wstring GetRegistryKey(); + // Checks for the build type + bool IsChromiumBuild(); + // Launches the given EXE and waits for it to end. void LaunchExe(std::wstring install_path, const wchar_t process_name[]); diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.cc b/chrome/test/mini_installer_test/mini_installer_test_constants.cc index 5faba60..9005496 100644 --- a/chrome/test/mini_installer_test/mini_installer_test_constants.cc +++ b/chrome/test/mini_installer_test/mini_installer_test_constants.cc @@ -6,20 +6,30 @@ namespace mini_installer_constants { -const wchar_t kAppDir[] = L"Google\\Chrome\\Application\\"; +#if defined(GOOGLE_CHROME_BUILD) +const wchar_t kChromeAppDir[] = L"Google\\Chrome\\Application\\"; +const wchar_t kChromeBuildType[] = L"Google Chrome"; +const wchar_t kChromeFirstRunUI[] = L"Welcome to Google Chrome"; +const wchar_t kChromeLaunchShortcut[] = L"Google Chrome.lnk"; +const wchar_t kChromeUninstallShortcut[] = L"Uninstall Google Chrome.lnk"; +#else +const wchar_t kChromeAppDir[] = L"Chromium\\Application\\"; +const wchar_t kChromeBuildType[] = L"Chromium"; +const wchar_t kChromeFirstRunUI[] = L"Welcome to Chromium"; +const wchar_t kChromeLaunchShortcut[] = L"Chromium.lnk"; +const wchar_t kChromeUninstallShortcut[] = L"Uninstall Chromium.lnk"; +#endif + const wchar_t kChromeSetupExecutable[] = L"setup.exe"; const wchar_t kIEExecutable[] = L"iexplore.exe"; const wchar_t kChromeMiniInstallerExecutable[] = L"mini_installer.exe"; -const wchar_t kChromeInstallerType[] = L"dev"; - const wchar_t kBrowserAppName[] = L"Google - Google Chrome"; const wchar_t kBrowserTabName[] = L"New Tab - Google Chrome"; -const wchar_t kConfirmDialog[] = L"Google Chrome"; const wchar_t kInstallerWindow[] = L"Google App Installer"; -const wchar_t kFirstChromeUI[] = L"Welcome to Google Chrome"; -// Chrome meta installer location. -const wchar_t kChromeSetupDevExeLocation[] = - L"\\\\172.23.44.61\\shared\\chrome_autotest\\DevTest\\ChromeSetup.exe"; + +// Google Chrome meta installer location. +const wchar_t kChromeMetaInstallerExeLocation[] = + L"\\\\172.23.44.61\\shared\\chrome_autotest\\beta_build\\ChromeSetup.exe"; } diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.h b/chrome/test/mini_installer_test/mini_installer_test_constants.h index 9fc7f89..21b033a1 100644 --- a/chrome/test/mini_installer_test/mini_installer_test_constants.h +++ b/chrome/test/mini_installer_test/mini_installer_test_constants.h @@ -9,21 +9,25 @@ namespace mini_installer_constants { -extern const wchar_t kAppDir[]; +// Path and process names +extern const wchar_t kChromeAppDir[]; extern const wchar_t kChromeSetupExecutable[]; extern const wchar_t kIEExecutable[]; extern const wchar_t kChromeMiniInstallerExecutable[]; -extern const wchar_t kChromeInstallerType[]; // Window names. extern const wchar_t kBrowserAppName[]; extern const wchar_t kBrowserTabName[]; -extern const wchar_t kConfirmDialog[]; +extern const wchar_t kChromeBuildType[]; extern const wchar_t kInstallerWindow[]; -extern const wchar_t kFirstChromeUI[]; +extern const wchar_t kChromeFirstRunUI[]; -// Chrome meta installer location. -extern const wchar_t kChromeSetupDevExeLocation[]; +// Shortcut names +extern const wchar_t kChromeLaunchShortcut[]; +extern const wchar_t kChromeUninstallShortcut[]; + +// Google Chrome meta installer location. +extern const wchar_t kChromeMetaInstallerExeLocation[]; } #endif // CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc index c88895d..145e2ca 100644 --- a/chrome/test/mini_installer_test/test.cc +++ b/chrome/test/mini_installer_test/test.cc @@ -18,15 +18,13 @@ class MiniInstallTest : public testing::Test { }; }; -// This test is disabled. See bug 1199175. -TEST_F(MiniInstallTest, DISABLED_MiniInstallerCleanInstallTest) { +TEST_F(MiniInstallTest, MiniInstallerCleanInstallTest) { ChromeMiniInstaller installer; installer.InstallMiniInstaller(); installer.UnInstall(); } -// This test is disabled. See bug 1199175. -TEST_F(MiniInstallTest, DISABLED_MiniInstallerOverChromeSetupDevTest) { +TEST_F(MiniInstallTest, MiniInstallerOverChromeMetaInstallerTest) { ChromeMiniInstaller installer; installer.OverInstall(); installer.UnInstall(); |