diff options
author | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 16:44:44 +0000 |
---|---|---|
committer | grt@chromium.org <grt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 16:44:44 +0000 |
commit | 798297240c743cd9208b8d7cb0bd4ca3663d1e39 (patch) | |
tree | 07920ec15753bde0a3b5dd4e6185caa1cd50db76 | |
parent | e79409fe29ce16bb814d789c5b20a38daf6729bf (diff) | |
download | chromium_src-798297240c743cd9208b8d7cb0bd4ca3663d1e39.zip chromium_src-798297240c743cd9208b8d7cb0bd4ca3663d1e39.tar.gz chromium_src-798297240c743cd9208b8d7cb0bd4ca3663d1e39.tar.bz2 |
Delete old mini_installer_test.
And run the new Python-driven test_mini_installer on win_rel trybot.
BUG=277655
Review URL: https://codereview.chromium.org/301223007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274260 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | PRESUBMIT.py | 2 | ||||
-rw-r--r-- | build/all.gyp | 8 | ||||
-rw-r--r-- | chrome/chrome_installer.gypi | 38 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/installer_path_provider.cc | 237 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/installer_path_provider.h | 49 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/installer_test_util.cc | 300 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/installer_test_util.h | 88 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/mini_installer_test_constants.cc | 81 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/mini_installer_test_constants.h | 69 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/run_all_unittests.cc | 76 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/switch_builder.cc | 42 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/switch_builder.h | 33 | ||||
-rw-r--r-- | chrome/test/mini_installer_test/test.cc | 412 | ||||
-rw-r--r-- | testing/buildbot/chromium.win.json | 3 |
14 files changed, 3 insertions, 1435 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 306dc8e..4273feb 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -1427,7 +1427,7 @@ def GetDefaultTryConfigs(bots=None): 'gfx_unittests', 'google_apis_unittests', 'installer_util_unittests', - 'mini_installer_test', + 'test_mini_installer', 'nacl_integration', 'remoting_unittests', 'sync_integration_tests', diff --git a/build/all.gyp b/build/all.gyp index 55c69bc..8f41bf0 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -301,9 +301,7 @@ 'dependencies': [ '../chrome/chrome.gyp:crash_service', '../chrome/chrome.gyp:installer_util_unittests', - '../chrome/chrome.gyp:mini_installer_test', - # mini_installer_tests depends on mini_installer. This should be - # defined in installer.gyp. + # ../chrome/test/mini_installer requires mini_installer. '../chrome/installer/mini_installer.gyp:mini_installer', '../chrome_elf/chrome_elf.gyp:chrome_elf_unittests', '../content/content_shell_and_tests.gyp:copy_test_netscape_plugin', @@ -958,7 +956,6 @@ '../chrome/chrome.gyp:gcapi_test', '../chrome/chrome.gyp:installer_util_unittests', '../chrome/chrome.gyp:interactive_ui_tests', - '../chrome/chrome.gyp:mini_installer_test', '../chrome/chrome.gyp:performance_browser_tests', '../chrome/chrome.gyp:sync_integration_tests', '../chrome/chrome.gyp:unit_tests', @@ -967,8 +964,7 @@ '../content/content_shell_and_tests.gyp:content_browsertests', '../content/content_shell_and_tests.gyp:content_unittests', '../content/content_shell_and_tests.gyp:copy_test_netscape_plugin', - # mini_installer_tests depends on mini_installer. This should be - # defined in installer.gyp. + # ../chrome/test/mini_installer requires mini_installer. '../chrome/installer/mini_installer.gyp:mini_installer', '../courgette/courgette.gyp:courgette_unittests', '../device/device_tests.gyp:device_unittests', diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi index 1e6cd9c..3e58a21 100644 --- a/chrome/chrome_installer.gypi +++ b/chrome/chrome_installer.gypi @@ -211,44 +211,6 @@ ], }, { - 'target_name': 'mini_installer_test', - 'type': 'executable', - 'dependencies': [ - 'installer_util', - 'installer_util_strings', - '../base/base.gyp:base', - '../base/base.gyp:base_i18n', - '../base/base.gyp:test_support_base', - '../chrome/chrome.gyp:test_support_common', - '../testing/gtest.gyp:gtest', - ], - 'include_dirs': [ - '..', - ], - 'sources': [ - '<(SHARED_INTERMEDIATE_DIR)/installer_util_strings/installer_util_strings.rc', - 'installer/util/installation_validation_helper.cc', - 'installer/util/installation_validation_helper.h', - 'test/mini_installer_test/installer_path_provider.cc', - 'test/mini_installer_test/installer_path_provider.h', - 'test/mini_installer_test/installer_test_util.cc', - 'test/mini_installer_test/installer_test_util.h', - 'test/mini_installer_test/mini_installer_test_constants.cc', - 'test/mini_installer_test/mini_installer_test_constants.h', - 'test/mini_installer_test/run_all_unittests.cc', - 'test/mini_installer_test/switch_builder.cc', - 'test/mini_installer_test/switch_builder.h', - 'test/mini_installer_test/test.cc', - ], - 'msvs_settings': { - 'VCManifestTool': { - 'AdditionalManifestFiles': [ - '$(ProjectDir)\\installer\\mini_installer\\mini_installer.exe.manifest', - ], - }, - }, - }, - { 'target_name': 'setup', 'type': 'executable', 'dependencies': [ diff --git a/chrome/test/mini_installer_test/installer_path_provider.cc b/chrome/test/mini_installer_test/installer_path_provider.cc deleted file mode 100644 index 6602cab..0000000 --- a/chrome/test/mini_installer_test/installer_path_provider.cc +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) 2012 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/test/mini_installer_test/installer_path_provider.h" - -#include <algorithm> - -#include "base/command_line.h" -#include "base/file_util.h" -#include "base/files/file_enumerator.h" -#include "base/path_service.h" -#include "base/strings/string_util.h" -#include "base/strings/stringprintf.h" -#include "chrome/test/mini_installer_test/installer_test_util.h" -#include "chrome/test/mini_installer_test/mini_installer_test_constants.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace { - -struct FilePathInfo { - base::FileEnumerator::FileInfo info; - base::FilePath path; -}; - -bool CompareDate(const FilePathInfo& a, const FilePathInfo& b) { - return a.info.GetLastModifiedTime() > b.info.GetLastModifiedTime(); -} - -// Get list of file |type| matching |pattern| in |root|. -// The list is sorted in last modified date order. -// Return true if files/directories are found. -bool FindMatchingFiles(const base::FilePath& root, - const std::string& pattern, - base::FileEnumerator::FileType type, - std::vector<base::FilePath>* paths) { - base::FileEnumerator files(root, false, type, - base::FilePath().AppendASCII(pattern).value()); - std::vector<FilePathInfo> matches; - for (base::FilePath current = files.Next(); !current.empty(); - current = files.Next()) { - FilePathInfo entry; - entry.info = files.GetInfo(); - entry.path = current; - matches.push_back(entry); - } - - if (matches.empty()) - return false; - - std::sort(matches.begin(), matches.end(), CompareDate); - std::vector<FilePathInfo>::iterator current; - for (current = matches.begin(); current != matches.end(); ++current) { - paths->push_back(current->path); - } - return true; -} - -bool FindNewestMatchingFile(const base::FilePath& root, - const std::string& pattern, - base::FileEnumerator::FileType type, - base::FilePath* path) { - std::vector<base::FilePath> paths; - if (FindMatchingFiles(root, pattern, type, &paths)) { - *path = paths[0]; - return true; - } - return false; -} - -} // namespace - -namespace installer_test { - -InstallerPathProvider::InstallerPathProvider() { - base::FilePath full_installer, previous_installer; - if (!GetFullInstaller(&full_installer) || - !GetPreviousInstaller(&previous_installer)) - return; - current_build_ = - full_installer.DirName().DirName().BaseName().MaybeAsASCII(); - previous_build_ = - previous_installer.DirName().DirName().BaseName().MaybeAsASCII(); -} - -InstallerPathProvider::InstallerPathProvider( - const std::string& build_under_test) : current_build_(build_under_test) { - base::FilePath full_installer, previous_installer; - if (!GetFullInstaller(&full_installer) || - !GetPreviousInstaller(&previous_installer)) - return; - previous_build_ = - previous_installer.DirName().DirName().BaseName().MaybeAsASCII(); -} - -InstallerPathProvider::~InstallerPathProvider() {} - -bool InstallerPathProvider::GetFullInstaller(base::FilePath* path) { - std::string full_installer_pattern("*_chrome_installer*"); - return GetInstaller(full_installer_pattern, path); -} - -bool InstallerPathProvider::GetDiffInstaller(base::FilePath* path) { - std::string diff_installer_pattern("*_from_*"); - return GetInstaller(diff_installer_pattern, path); -} - -bool InstallerPathProvider::GetMiniInstaller(base::FilePath* path) { - // Use local copy of installer, else fall back to filer. - base::FilePath mini_installer = PathFromExeDir( - mini_installer_constants::kChromeMiniInstallerExecutable); - if (base::PathExists(mini_installer)) { - *path = mini_installer; - return true; - } - std::string mini_installer_pattern("mini_installer.exe"); - return GetInstaller(mini_installer_pattern, path); -} - -bool InstallerPathProvider::GetPreviousInstaller(base::FilePath* path) { - std::string diff_installer_pattern("*_from_*"); - std::string full_installer_pattern("*_chrome_installer*"); - base::FilePath diff_installer; - if (!GetInstaller(diff_installer_pattern, &diff_installer)) - return false; - - base::FilePath previous_installer; - std::vector<std::string> tokenized_name; - Tokenize(diff_installer.BaseName().MaybeAsASCII(), - "_", &tokenized_name); - std::string build_pattern = base::StringPrintf( - "*%s", tokenized_name[2].c_str()); - std::vector<base::FilePath> previous_build; - if (FindMatchingFiles(diff_installer.DirName().DirName().DirName(), - build_pattern, base::FileEnumerator::DIRECTORIES, - &previous_build)) { - base::FilePath windir = previous_build.at(0).Append( - mini_installer_constants::kWinFolder); - FindNewestMatchingFile(windir, full_installer_pattern, - base::FileEnumerator::FILES, &previous_installer); - } - - if (previous_installer.empty()) - return false; - *path = previous_installer; - return true; -} - -bool InstallerPathProvider::GetStandaloneInstaller(base::FilePath* path) { - // Get standalone installer. - base::FilePath standalone_installer( - mini_installer_constants::kChromeStandAloneInstallerLocation); - // Get the file name. - std::vector<std::string> tokenized_build_number; - if (current_build_.empty()) - return false; - Tokenize(current_build_, ".", &tokenized_build_number); - std::string standalone_installer_filename = base::StringPrintf( - "%s%s_%s.exe", - base::FilePath(mini_installer_constants::kUntaggedInstallerPattern) - .MaybeAsASCII().c_str(), - tokenized_build_number[2].c_str(), - tokenized_build_number[3].c_str()); - standalone_installer = standalone_installer.AppendASCII(current_build_) - .Append(mini_installer_constants::kWinFolder) - .AppendASCII(standalone_installer_filename); - *path = standalone_installer; - return base::PathExists(standalone_installer); -} - -bool InstallerPathProvider::GetSignedStandaloneInstaller(base::FilePath* path) { - base::FilePath standalone_installer; - if (!GetStandaloneInstaller(&standalone_installer)) - return false; - base::FilePath tagged_installer = PathFromExeDir( - mini_installer_constants::kStandaloneInstaller); - CommandLine sign_command = CommandLine::FromString( - base::StringPrintf(L"%ls %ls %ls %ls", - mini_installer_constants::kChromeApplyTagExe, - standalone_installer.value().c_str(), - tagged_installer.value().c_str(), - mini_installer_constants::kChromeApplyTagParameters)); - - if (!installer_test::RunAndWaitForCommandToFinish(sign_command)) - return false; - - *path = PathFromExeDir(mini_installer_constants::kStandaloneInstaller); - return true; -} - -base::FilePath InstallerPathProvider::PathFromExeDir( - const base::FilePath::StringType& name) { - base::FilePath path; - PathService::Get(base::DIR_EXE, &path); - path = path.Append(name); - return path; -} - -bool InstallerPathProvider::GetInstaller(const std::string& pattern, - base::FilePath* path) { - base::FilePath installer; - // Search filer for installer binary. - base::FilePath root(mini_installer_constants::kChromeInstallersLocation); - std::vector<base::FilePath> paths; - if (!FindMatchingFiles(root, current_build_, - base::FileEnumerator::DIRECTORIES, &paths)) { - return false; - } - - std::vector<base::FilePath>::const_iterator dir; - for (dir = paths.begin(); dir != paths.end(); ++dir) { - base::FilePath windir = dir->Append( - mini_installer_constants::kWinFolder); - if (FindNewestMatchingFile(windir, pattern, base::FileEnumerator::FILES, - &installer)) { - break; - } - } - - if (installer.empty()) { - LOG(WARNING) << "Failed to find installer with pattern: " << pattern; - return false; - } - - *path = installer; - return true; -} - -std::string InstallerPathProvider::GetCurrentBuild() { - return current_build_; -} - -std::string InstallerPathProvider::GetPreviousBuild() { - return previous_build_; -} - -} // namespace diff --git a/chrome/test/mini_installer_test/installer_path_provider.h b/chrome/test/mini_installer_test/installer_path_provider.h deleted file mode 100644 index 98e1b77..0000000 --- a/chrome/test/mini_installer_test/installer_path_provider.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) 2012 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_TEST_MINI_INSTALLER_TEST_INSTALLER_PATH_PROVIDER_H_ -#define CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_PATH_PROVIDER_H_ - -#include "base/basictypes.h" -#include "base/files/file_path.h" - -namespace installer_test { - -// Locate and provides path for installers. -// Search for latest installer binaries in the filer directory defined by -// mini_installer_constants::kChromeInstallersLocation. -class InstallerPathProvider { - public: - // Search for latest installer binaries in filer. - InstallerPathProvider(); - - explicit InstallerPathProvider(const std::string& build_under_test); - ~InstallerPathProvider(); - - bool GetFullInstaller(base::FilePath* path); - bool GetDiffInstaller(base::FilePath* path); - bool GetMiniInstaller(base::FilePath* path); - bool GetPreviousInstaller(base::FilePath* path); - bool GetStandaloneInstaller(base::FilePath* path); - bool GetSignedStandaloneInstaller(base::FilePath* path); - - std::string GetCurrentBuild(); - std::string GetPreviousBuild(); - - private: - // Returns the local file path for the given file |name|. - // Assumes file is located in the current working directory. - base::FilePath PathFromExeDir(const base::FilePath::StringType& name); - - bool GetInstaller(const std::string& pattern, base::FilePath* path); - - // Build numbers. - std::string current_build_, previous_build_; - - DISALLOW_COPY_AND_ASSIGN(InstallerPathProvider); -}; - -} // namespace - -#endif // CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_PATH_PROVIDER_H_ diff --git a/chrome/test/mini_installer_test/installer_test_util.cc b/chrome/test/mini_installer_test/installer_test_util.cc deleted file mode 100644 index f8cbb39..0000000 --- a/chrome/test/mini_installer_test/installer_test_util.cc +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) 2012 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/test/mini_installer_test/installer_test_util.h" - -#include "base/file_util.h" -#include "base/path_service.h" -#include "base/process/kill.h" -#include "base/process/launch.h" -#include "base/process/process.h" -#include "base/strings/string_util.h" -#include "base/threading/platform_thread.h" -#include "chrome/common/chrome_result_codes.h" -#include "chrome/installer/util/google_update_constants.h" -#include "chrome/installer/util/helper.h" -#include "chrome/installer/util/install_util.h" -#include "chrome/installer/util/util_constants.h" -#include "chrome/test/mini_installer_test/mini_installer_test_constants.h" -#include "testing/gtest/include/gtest/gtest.h" - -using installer::InstallationValidator; - -namespace { - -BrowserDistribution::Type ToBrowserDistributionType( - InstallationValidator::InstallationType type) { - const int kChromeMask = - (InstallationValidator::ProductBits::CHROME_SINGLE | - InstallationValidator::ProductBits::CHROME_MULTI); - const int kChromeFrameMask = - (InstallationValidator::ProductBits::CHROME_FRAME_SINGLE | - InstallationValidator::ProductBits::CHROME_FRAME_MULTI); - const int kBinariesMask = - (InstallationValidator::ProductBits::CHROME_MULTI | - InstallationValidator::ProductBits::CHROME_FRAME_MULTI); - // Default return is CHROME_BINARIES. - BrowserDistribution::Type ret_value = BrowserDistribution::CHROME_BINARIES; - if (type & kChromeMask) - ret_value = BrowserDistribution::CHROME_BROWSER; - if (type & kChromeFrameMask) - ret_value = BrowserDistribution::CHROME_FRAME; - if (type & kBinariesMask) - ret_value = BrowserDistribution::CHROME_BINARIES; - return ret_value; -} - -} // namespace - -namespace installer_test { - -bool DeleteInstallDirectory(bool system_level, - InstallationValidator::InstallationType type) { - std::string version = GetVersion(type); - if (version.empty()) - return false; - base::FilePath path; - bool has_install_dir = GetInstallDirectory(system_level, - ToBrowserDistributionType(type), - &path); - if (!has_install_dir || !base::PathExists(path)) - return false; - path = path.AppendASCII(version); - return base::DeleteFile(path, true); -} - -bool DeleteRegistryKey(bool system_level, - InstallationValidator::InstallationType type, - REGSAM wow64_access) { - BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( - ToBrowserDistributionType(type)); - base::FilePath::StringType key(google_update::kRegPathClients); - key.push_back(base::FilePath::kSeparators[0]); - key.append(dist->GetAppGuid()); - HKEY root = system_level ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; - return InstallUtil::DeleteRegistryKey(root, key, wow64_access); -} - -bool GetChromeInstallDirectory(bool system_level, base::FilePath* path) { - return GetInstallDirectory(system_level, - BrowserDistribution::CHROME_BROWSER, path); -} - -bool GetInstallDirectory(bool system_level, - BrowserDistribution::Type type, base::FilePath* path) { - BrowserDistribution* dist = - BrowserDistribution::GetSpecificDistribution(type); - *path = installer::GetChromeInstallPath(system_level, dist); - base::FilePath parent; - if (system_level) - PathService::Get(base::DIR_PROGRAM_FILES, &parent); - else - PathService::Get(base::DIR_LOCAL_APP_DATA, &parent); - return parent.IsParent(*path); -} - -bool GetInstalledProducts( - std::vector<installer_test::InstalledProduct>* products) { - // Clear out the products list. - products->clear(); - // Check user-level and system-level for products. - BrowserDistribution* current_dist; - installer_test::InstalledProduct current_prod; - for (int i = 0; i < 2; ++i) { - const bool system_level = (i != 0); - InstallationValidator::InstallationType type = - InstallationValidator::NO_PRODUCTS; - bool is_valid = - InstallationValidator::ValidateInstallationType(system_level, &type); - if (type != InstallationValidator::NO_PRODUCTS) { - current_dist = BrowserDistribution::GetSpecificDistribution( - ToBrowserDistributionType(type)); - Version version; - InstallUtil::GetChromeVersion(current_dist, system_level, &version); - if (version.IsValid()) { - current_prod.type = type; - current_prod.version = version.GetString(); - current_prod.system = system_level; - products->push_back(current_prod); - } - } - } - return !products->empty(); -} - -bool ValidateInstall(bool system_level, - InstallationValidator::InstallationType expected, - const std::string& version) { - if (GetVersion(expected) != version) - return false; - InstallationValidator::InstallationType type; - InstallationValidator::ValidateInstallationType(system_level, &type); - if (type == InstallationValidator::NO_PRODUCTS) { - LOG(ERROR) << "No installed Chrome or Chrome Frame versions found."; - return false; - } - if ((type & expected) == 0) { - LOG(ERROR) << "Expected type: " << expected << "\n Actual type: " << type; - return false; - } - return true; -} - -std::string GetVersion(InstallationValidator::InstallationType product) { - std::vector<installer_test::InstalledProduct> installed; - if (GetInstalledProducts(&installed)) { - for (size_t i = 0; i < installed.size(); ++i) { - if ((installed[i].type & product) != 0) { - return installed[i].version; - } - } - } - return ""; -} - -bool Install(const base::FilePath& installer) { - if (!base::PathExists(installer)) { - LOG(ERROR) << "Installer does not exist: " << installer.MaybeAsASCII(); - return false; - } - CommandLine command(installer); - LOG(INFO) << "Running installer command: " - << command.GetCommandLineString(); - return installer_test::RunAndWaitForCommandToFinish(command); -} - -bool Install(const base::FilePath& installer, const SwitchBuilder& switches) { - if (!base::PathExists(installer)) { - LOG(ERROR) << "Installer does not exist: " << installer.MaybeAsASCII(); - return false; - } - CommandLine command(installer); - command.AppendArguments(switches.GetSwitches(), false); - LOG(INFO) << "Running installer command: " - << command.GetCommandLineString(); - return installer_test::RunAndWaitForCommandToFinish(command); -} - -bool LaunchChrome(bool close_after_launch, bool system_level) { - base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - base::FilePath install_path; - if (!GetChromeInstallDirectory( - system_level, &install_path)) { - LOG(ERROR) << "Could not find Chrome install directory"; - return false; - } - install_path = install_path.Append(installer::kChromeExe); - CommandLine browser(install_path); - - base::FilePath exe = browser.GetProgram(); - LOG(INFO) << "Browser launch command: " << browser.GetCommandLineString(); - base::ProcessHandle chrome; - if (!base::LaunchProcess(browser, base::LaunchOptions(), &chrome)) { - LOG(ERROR) << "Could not launch process: " << exe.value(); - return false; - } - if (close_after_launch) { - if (base::KillProcess(chrome, 0, true)) { - LOG(ERROR) << "Failed to close chrome.exe after launch."; - return false; - } - } - return true; -} - -bool LaunchIE(const std::string& url) { - base::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.AppendArg(url); - return base::LaunchProcess(cmd_line, base::LaunchOptions(), NULL); -} - -bool UninstallAll() { - base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - base::CleanupProcesses(installer::kChromeFrameHelperExe, base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - std::vector<installer_test::InstalledProduct> installed; - if (!GetInstalledProducts(&installed)) { - LOG(WARNING) << "No installed products to uninstall."; - return false; - } - bool ret_val = false; - for (size_t i = 0; i < installed.size(); ++i) { - if (!Uninstall(installed[i].system, installed[i].type)) - ret_val = false; - } - return ret_val; -} - -bool Uninstall(bool system_level, - InstallationValidator::InstallationType type) { - std::vector<BrowserDistribution::Type> products; - if (ToBrowserDistributionType(type) != - BrowserDistribution::CHROME_BINARIES) { - products.push_back(ToBrowserDistributionType(type)); - } else { - products.push_back(BrowserDistribution::CHROME_BROWSER); - products.push_back(BrowserDistribution::CHROME_FRAME); - } - bool ret_val = false; - for (size_t i = 0; i < products.size(); ++i) { - if (!Uninstall(system_level, products[i])) - ret_val = false; - } - return ret_val; -} - -bool Uninstall(bool system_level, - BrowserDistribution::Type product) { - static const int kMultiMask = - (InstallationValidator::ProductBits::CHROME_MULTI | - InstallationValidator::ProductBits::CHROME_FRAME_MULTI); - CommandLine uninstall_cmd(InstallUtil::GetChromeUninstallCmd(system_level, - product)); - CommandLine::StringType archive = - uninstall_cmd.GetProgram().DirName().AppendASCII("chrome.7z").value(); - uninstall_cmd.AppendSwitch(installer::switches::kUninstall); - uninstall_cmd.AppendSwitch(installer::switches::kForceUninstall); - uninstall_cmd.AppendSwitchNative( - installer::switches::kInstallArchive, archive); - if (system_level) - uninstall_cmd.AppendSwitch(installer::switches::kSystemLevel); - if ((product & kMultiMask) !=0) - uninstall_cmd.AppendSwitch(installer::switches::kMultiInstall); - LOG(INFO) << "Uninstall command: " << uninstall_cmd.GetCommandLineString(); - bool ret_val = RunAndWaitForCommandToFinish(uninstall_cmd); - // Close IE notification when uninstalling Chrome Frame. - base::CleanupProcesses(mini_installer_constants::kIEProcessName, - base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - return ret_val; -} - - -bool RunAndWaitForCommandToFinish(CommandLine command) { - if (!base::PathExists(command.GetProgram())) { - LOG(ERROR) << "Command executable does not exist: " - << command.GetProgram().MaybeAsASCII(); - return false; - } - base::ProcessHandle process; - if (!base::LaunchProcess(command, base::LaunchOptions(), &process)) { - LOG(ERROR) << "Failed to launch command: " - << command.GetCommandLineString(); - return false; - } - if (!base::WaitForSingleProcess(process, base::TimeDelta::FromMinutes(1))) { - LOG(ERROR) << "Launched process did not complete."; - return false; - } - return true; -} - -} // namespace installer_test diff --git a/chrome/test/mini_installer_test/installer_test_util.h b/chrome/test/mini_installer_test/installer_test_util.h deleted file mode 100644 index 5aeb2d3..0000000 --- a/chrome/test/mini_installer_test/installer_test_util.h +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) 2012 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_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_ -#define CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_ - -#include <vector> - -#include "base/command_line.h" -#include "base/files/file_path.h" -#include "chrome/installer/util/installation_validator.h" -#include "chrome/test/mini_installer_test/switch_builder.h" - -namespace installer_test { - -struct InstalledProduct { - std::string version; - installer::InstallationValidator::InstallationType type; - bool system; -}; - -// Utility functions used to test Chrome installation. - -// Deletes the Chrome installation directory which is found at different -// locations depending on the |system_level| and |type|. -// Returns true if successful, otherwise false. -bool DeleteInstallDirectory( - bool system_level, - installer::InstallationValidator::InstallationType type); - -// Deletes the Chrome Windows registry entry. -// Returns true if successful, otherwise false. -bool DeleteRegistryKey( - bool system_level, - installer::InstallationValidator::InstallationType type, - REGSAM wow64_access); - -// Locates the Chrome installation directory based on the -// provided |system_level|. Returns true if successful, otherwise false. -// Returns true if successful, otherwise false. -bool GetChromeInstallDirectory(bool system_level, base::FilePath* path); - -// Gets the installation directory of either Chrome or Chrome Frame -// as specified by the |system_level| and |type|. -// Returns true if successful, otherwise false. -bool GetInstallDirectory(bool system_level, - BrowserDistribution::Type type, base::FilePath* path); - -// Returns the version of the specified |product|. -std::string GetVersion( - installer::InstallationValidator::InstallationType product); - -// Gets a list of installed products. -// Returns true if there are installed products. -bool GetInstalledProducts(std::vector<InstalledProduct>* products); - -bool Install(const base::FilePath& installer); -bool Install(const base::FilePath& installer, const SwitchBuilder& switches); -bool LaunchChrome(bool close_after_launch, bool system_level); -bool LaunchIE(const std::string& url); - -// Uninstall all Chrome or Chrome Frame installations. -bool UninstallAll(); - -// Uninstall the product specified by |system_level| and |type|. -bool Uninstall( - bool system_level, - installer::InstallationValidator::InstallationType type); - -// Uninstall the product specified by |system_level| and |product|. -bool Uninstall( - bool system_level, - BrowserDistribution::Type product); - -bool ValidateInstall( - bool system_level, - installer::InstallationValidator::InstallationType expected, - const std::string& version); - -// Run and wait for command to finish. -// Returns true if successful, otherwise false. -bool RunAndWaitForCommandToFinish(base::CommandLine command); - -} // namespace installer_test - -#endif // CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_ - diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.cc b/chrome/test/mini_installer_test/mini_installer_test_constants.cc deleted file mode 100644 index ed1a78b..0000000 --- a/chrome/test/mini_installer_test/mini_installer_test_constants.cc +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2011 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/test/mini_installer_test/mini_installer_test_constants.h" - -namespace mini_installer_constants { - -#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"; -const wchar_t kChromeUninstallDialogName[] = L"Uninstall Google Chrome"; -#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"; -const wchar_t kChromeUninstallDialogName[] = L"Uninstall Chromium"; -#endif -const wchar_t kBrowserTabName[] = L"New Tab - Google Chrome"; -const wchar_t kChromeFrameAppDir[] = L"Google\\Chrome Frame\\Application\\"; -const wchar_t kChromeFrameAppName[] = L"Google Chrome Frame"; -const wchar_t kChromeFrameProductName[] = L"Chrome Frame"; -const wchar_t kChromeMiniInstallerExecutable[] = L"mini_installer.exe"; -const wchar_t kChromeMetaInstallerExecutable[] = L"chrome_installer.exe"; -const wchar_t kChromeProductName[] = L"Chrome"; -const wchar_t kChromeSetupExecutable[] = L"setup.exe"; -const wchar_t kChromeUserDataBackupDir[] = L"User Data Copy"; -const wchar_t kChromeUserDataDir[] = L"User Data"; -const wchar_t kDiffInstall[] = L"Diff"; -const wchar_t kDiffInstallerPattern[] = L"_from_"; -const wchar_t kFullInstallerPattern[] = L"_chrome_installer"; -const wchar_t kGoogleUpdateExecutable[] = L"GoogleUpdate.exe"; -const wchar_t kIEExecutable[] = L"iexplore.exe"; -const wchar_t kInstallerWindow[] = L"Chrome Installer"; -const wchar_t kStandaloneInstaller[] = L"ChromeSetupTest.exe"; -const wchar_t kUntaggedInstallerPattern[] = L"ChromeStandaloneSetup_"; -const wchar_t kWinFolder[] = L"win"; - - -const wchar_t kDevChannelBuild[] = L"10.0."; -const wchar_t kStableChannelBuild[] = L"8.0."; -const wchar_t kFullInstall[] = L"Full"; - - -const wchar_t kIELocation[] = L"Internet Explorer\\"; -const wchar_t kIEProcessName[] = L"IEXPLORE.EXE"; - -// Google Chrome meta installer location. -const wchar_t kChromeMetaInstallerExe[] = - L"\\\\172.23.44.61\\shared\\chrome_autotest\\beta_build\\ChromeSetup.exe"; -const wchar_t kChromeStandAloneInstallerLocation[] = - L"\\\\filer\\shares\\chromeclient\\builds\\ChromeSigning"; -const wchar_t kChromeApplyTagExe[] = - L"\\\\filer\\shares\\googleclient\\save\\builds\\Omaha\\1.3.21.57" - L"\\opt\\tests\\ApplyTag.exe"; -const wchar_t kChromeApplyTagParameters[] = - L"\"appguid={8A69D345-D564-463C-AFF1-A69D9E530F96}" - L"&appname=Chrome&needsadmin=false\""; -const wchar_t kChromeInstallersLocation[] = - L"\\\\172.24.6.7\\shares\\chromeclient\\builds\\chrome\\"; - -} // namespace mini_installer_constants - -namespace switches { -// Help. -extern const char kInstallerHelp[] = "help"; - -// Back up the profile. -const char kInstallerTestBackup[] = "backup"; - -// Control the build under test. -const char kInstallerTestBuild[] = "build"; - -// Force the installer tests to run, regardless of the current platform. -const char kInstallerTestForce[] = "force"; -} // namespace switches diff --git a/chrome/test/mini_installer_test/mini_installer_test_constants.h b/chrome/test/mini_installer_test/mini_installer_test_constants.h deleted file mode 100644 index e0c3f48..0000000 --- a/chrome/test/mini_installer_test/mini_installer_test_constants.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2011 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. - -// Constants related to the Chrome mini installer testing. - -#ifndef CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ -#define CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ - -namespace mini_installer_constants { - -// Path and process names -extern const wchar_t kChromeAppDir[]; -extern const wchar_t kChromeFrameAppDir[]; -extern const wchar_t kChromeFrameProductName[]; -extern const wchar_t kChromeMetaInstallerExecutable[]; -extern const wchar_t kChromeProductName[]; -extern const wchar_t kChromeMiniInstallerExecutable[]; -extern const wchar_t kChromeSetupExecutable[]; -extern const wchar_t kChromeUserDataBackupDir[]; -extern const wchar_t kChromeUserDataDir[]; -extern const wchar_t kDiffInstall[]; -extern const wchar_t kDiffInstallerPattern[]; -extern const wchar_t kFullInstall[]; -extern const wchar_t kFullInstallerPattern[]; -extern const wchar_t kGoogleUpdateExecutable[]; -extern const wchar_t kIEExecutable[]; -extern const wchar_t kWinFolder[]; - -// Window names. -extern const wchar_t kBrowserTabName[]; -extern const wchar_t kChromeBuildType[]; -extern const wchar_t kChromeFrameAppName[]; -extern const wchar_t kChromeFirstRunUI[]; -extern const wchar_t kChromeUninstallDialogName[]; -extern const wchar_t kInstallerWindow[]; - -// Shortcut names -extern const wchar_t kChromeLaunchShortcut[]; -extern const wchar_t kChromeUninstallShortcut[]; - -// Chrome install types -extern const wchar_t kStandaloneInstaller[]; -extern const wchar_t kUntaggedInstallerPattern[]; - -// Channel types -extern const wchar_t kDevChannelBuild[]; -extern const wchar_t kStableChannelBuild[]; - -extern const wchar_t kIELocation[]; -extern const wchar_t kIEProcessName[]; - -// Google Chrome meta installer location. -extern const wchar_t kChromeApplyTagExe[]; -extern const wchar_t kChromeApplyTagParameters[]; -extern const wchar_t kChromeInstallersLocation[]; -extern const wchar_t kChromeMetaInstallerExe[]; -extern const wchar_t kChromeStandAloneInstallerLocation[]; -} // namespace mini_installer_constants - -// Command line switches. -namespace switches { -extern const char kInstallerHelp[]; -extern const char kInstallerTestBackup[]; -extern const char kInstallerTestBuild[]; -extern const char kInstallerTestForce[]; -} // namespace switches - -#endif // CHROME_TEST_MINI_INSTALLER_TEST_MINI_INSTALLER_TEST_CONSTANTS_H__ diff --git a/chrome/test/mini_installer_test/run_all_unittests.cc b/chrome/test/mini_installer_test/run_all_unittests.cc deleted file mode 100644 index c9e930a..0000000 --- a/chrome/test/mini_installer_test/run_all_unittests.cc +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2012 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 "base/command_line.h" -#include "base/file_util.h" -#include "base/process/process_iterator.h" -#include "base/test/test_suite.h" -#include "base/win/windows_version.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/installer/util/util_constants.h" -#include "chrome/test/mini_installer_test/mini_installer_test_constants.h" -#include "chrome/test/mini_installer_test/installer_test_util.h" - - -void BackUpProfile(bool chrome_frame) { - if (base::GetProcessCount(L"chrome.exe", NULL) > 0) { - printf("Chrome is currently running and cannot backup the profile." - "Please close Chrome and run the tests again.\n"); - exit(1); - } - base::FilePath path; - installer_test::GetChromeInstallDirectory(false /* system_level */, &path); - path = path.Append(mini_installer_constants::kChromeAppDir).DirName(); - base::FilePath backup_path = path; - // Will hold User Data path that needs to be backed-up. - path = path.Append(mini_installer_constants::kChromeUserDataDir); - // Will hold new backup path to save the profile. - backup_path = backup_path.Append( - mini_installer_constants::kChromeUserDataBackupDir); - // Will check if User Data profile is available. - if (base::PathExists(path)) { - // Will check if User Data is already backed up. - // If yes, will delete and create new one. - if (base::PathExists(backup_path)) - base::DeleteFile(backup_path, true); - base::CopyDirectory(path, backup_path, true); - } else { - printf("Chrome is not installed. Will not take any backup\n"); - } -} - -int main(int argc, char** argv) { - // Check command line to decide if the tests should continue - // with cleaning the system or make a backup before continuing. - CommandLine::Init(argc, argv); - const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - base::TestSuite test_suite(argc, argv); - - if (command_line.HasSwitch(switches::kInstallerHelp)) { - printf("This test needs command line arguments.\n"); - printf("Usage: %ls [-backup] [-build <version>] [-force] \n", - command_line.GetProgram().value().c_str()); - printf("-backup arg will make a copy of User Data before uninstalling" - " your chrome at all levels. The copy will be named as" - " User Data Copy.\n" - "-build specifies the build to be tested, e.g., 3.0.195.24." - " Specifying 'dev' or 'stable' will use the latest build from that" - " channel. 'latest', the default, will use the latest build.\n" - "-force allows these tests to be run on the current platform," - " regardless of whether it is supported.\n"); - return 1; - } - - if (command_line.HasSwitch(switches::kInstallerTestBackup)) { - BackUpProfile(command_line.HasSwitch( - installer::switches::kChromeFrame)); - } - - if (base::win::GetVersion() < base::win::VERSION_VISTA || - command_line.HasSwitch(switches::kInstallerTestForce)) { - return test_suite.Run(); - } - printf("These tests don't run on this platform.\n"); - return 0; -} diff --git a/chrome/test/mini_installer_test/switch_builder.cc b/chrome/test/mini_installer_test/switch_builder.cc deleted file mode 100644 index e786090..0000000 --- a/chrome/test/mini_installer_test/switch_builder.cc +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2012 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/test/mini_installer_test/switch_builder.h" - -#include "chrome/installer/util/install_util.h" - -namespace installer_test { - -SwitchBuilder::SwitchBuilder() - : switches_(CommandLine::NO_PROGRAM) {} - -SwitchBuilder::~SwitchBuilder() {} - -const CommandLine& SwitchBuilder::GetSwitches() const { - return switches_; -} - -SwitchBuilder& SwitchBuilder::AddChrome() { - switches_.AppendSwitch(installer::switches::kChrome); - return *this; -} - -SwitchBuilder& SwitchBuilder::AddChromeFrame() { - switches_.AppendSwitch(installer::switches::kChromeFrame); - switches_.AppendSwitch(installer::switches::kDoNotLaunchChrome); - switches_.AppendSwitch(installer::switches::kDoNotRegisterForUpdateLaunch); - return *this; -} - -SwitchBuilder& SwitchBuilder::AddMultiInstall() { - switches_.AppendSwitch(installer::switches::kMultiInstall); - return *this; -} - -SwitchBuilder& SwitchBuilder::AddSystemInstall() { - switches_.AppendSwitch(installer::switches::kSystemLevel); - return *this; -} - -} // namespace diff --git a/chrome/test/mini_installer_test/switch_builder.h b/chrome/test/mini_installer_test/switch_builder.h deleted file mode 100644 index 94d039f..0000000 --- a/chrome/test/mini_installer_test/switch_builder.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2012 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_TEST_MINI_INSTALLER_TEST_SWITCH_BUILDER_H_ -#define CHROME_TEST_MINI_INSTALLER_TEST_SWITCH_BUILDER_H_ - -#include "base/basictypes.h" -#include "base/command_line.h" - -namespace installer_test { - -// Builds commandline arguments for Chrome installation. -class SwitchBuilder { - public: - SwitchBuilder(); - ~SwitchBuilder(); - - const base::CommandLine& GetSwitches() const; - - SwitchBuilder& AddChrome(); - SwitchBuilder& AddChromeFrame(); - SwitchBuilder& AddMultiInstall(); - SwitchBuilder& AddSystemInstall(); - - private: - base::CommandLine switches_; - DISALLOW_COPY_AND_ASSIGN(SwitchBuilder); -}; - -} // namespace - -#endif // CHROME_TEST_MINI_INSTALLER_TEST_SWITCH_BUILDER_H_ diff --git a/chrome/test/mini_installer_test/test.cc b/chrome/test/mini_installer_test/test.cc deleted file mode 100644 index a479cb6..0000000 --- a/chrome/test/mini_installer_test/test.cc +++ /dev/null @@ -1,412 +0,0 @@ -// Copyright (c) 2012 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 "base/command_line.h" -#include "base/files/file_path.h" -#include "base/memory/scoped_ptr.h" -#include "base/process/kill.h" -#include "base/strings/string_util.h" -#include "chrome/common/chrome_result_codes.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/installer/util/install_util.h" -#include "chrome/installer/util/installation_validator.h" -#include "chrome/installer/util/util_constants.h" -#include "chrome/test/mini_installer_test/installer_path_provider.h" -#include "chrome/test/mini_installer_test/installer_test_util.h" -#include "chrome/test/mini_installer_test/mini_installer_test_constants.h" -#include "chrome/test/mini_installer_test/switch_builder.h" -#include "testing/gtest/include/gtest/gtest.h" - -using installer::InstallationValidator; -using installer_test::InstallerPathProvider; -using installer_test::SwitchBuilder; - -namespace { - -class MiniInstallTest : public testing::Test { - public: - virtual void SetUp() { - std::vector<installer_test::InstalledProduct> installed; - if (installer_test::GetInstalledProducts(&installed)) { - ASSERT_TRUE(installer_test::UninstallAll()); - } - } - - virtual void TearDown() { - installer_test::UninstallAll(); - } - - protected: - static void SetUpTestCase() { - std::string build_under_test; - const CommandLine* cmd = CommandLine::ForCurrentProcess(); - build_under_test = cmd->GetSwitchValueASCII(switches::kInstallerTestBuild); - if (build_under_test.empty()) - provider_ = new InstallerPathProvider(); - else - provider_ = new InstallerPathProvider(build_under_test); - ASSERT_FALSE(provider_->GetCurrentBuild().empty()); - ASSERT_TRUE(provider_->GetFullInstaller(&full_installer_)); - ASSERT_TRUE(provider_->GetPreviousInstaller(&previous_installer_)); - ASSERT_TRUE(provider_->GetDiffInstaller(&diff_installer_)); - ASSERT_TRUE( - provider_->GetSignedStandaloneInstaller(&standalone_installer_)); - ASSERT_TRUE(provider_->GetMiniInstaller(&mini_installer_)); - } - - static void TearDownTestCase() { - delete provider_; - provider_ = NULL; - } - - static InstallerPathProvider* provider_; - static base::FilePath full_installer_; - static base::FilePath previous_installer_; - static base::FilePath diff_installer_; - static base::FilePath standalone_installer_; - static base::FilePath mini_installer_; -}; - -InstallerPathProvider* MiniInstallTest::provider_; -base::FilePath MiniInstallTest::full_installer_; -base::FilePath MiniInstallTest::previous_installer_; -base::FilePath MiniInstallTest::diff_installer_; -base::FilePath MiniInstallTest::standalone_installer_; -base::FilePath MiniInstallTest::mini_installer_; - -} // namespace - -#if defined(GOOGLE_CHROME_BUILD) -// Could use a parameterized gtest to slim down this list of tests, but since -// these tests will often be run manually, don't want to have obscure test -// names. - -// Install full installer at user level. -TEST_F(MiniInstallTest, FullInstallerUser) { - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -// Install full installer at system level. -TEST_F(MiniInstallTest, FullInstallerSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -// Overinstall full installer. -TEST_F(MiniInstallTest, FullOverPreviousFullUser) { - ASSERT_TRUE(installer_test::Install( - previous_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, FullOverPreviousFullSys) { - ASSERT_TRUE(installer_test::Install(previous_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, FreshChromeFrameUser) { - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChromeFrame())); - ASSERT_TRUE(installer_test::ValidateInstall( - false, - InstallationValidator::CHROME_FRAME_SINGLE, - provider_->GetCurrentBuild())); -} - -// Overinstall full Chrome Frame installer while IE browser is running. -TEST_F(MiniInstallTest, FullFrameOverPreviousFullIERunningSys) { - installer_test::LaunchIE("http://www.google.com"); - ASSERT_TRUE(installer_test::Install(previous_installer_, - SwitchBuilder().AddChromeFrame().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_SINGLE, - provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChromeFrame().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_SINGLE, - provider_->GetCurrentBuild())); -} - -// Overinstall diff installer. -TEST_F(MiniInstallTest, DiffOverPreviousFullUser) { - ASSERT_TRUE(installer_test::Install( - previous_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install( - diff_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, DiffOverPreviousFullSys) { - ASSERT_TRUE(installer_test::Install(previous_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install(diff_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -// Overinstall diff Chrome Frame installer while IE browser is running. -TEST_F(MiniInstallTest, DiffFrameOverPreviousFullIERunningSys) { - installer_test::LaunchIE("http://www.google.com"); - ASSERT_TRUE(installer_test::Install(previous_installer_, - SwitchBuilder().AddChromeFrame().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_SINGLE, - provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install(diff_installer_, - SwitchBuilder().AddChromeFrame().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_SINGLE, - provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, InstallChromeMultiOverChromeSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -// Repair version folder. -TEST_F(MiniInstallTest, RepairFolderOnFullUser) { - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); - base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - ASSERT_TRUE(installer_test::DeleteInstallDirectory( - false, // system level - InstallationValidator::CHROME_SINGLE)); - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, RepairFolderOnFullSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); - base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - ASSERT_TRUE(installer_test::DeleteInstallDirectory( - true, // system level - InstallationValidator::CHROME_SINGLE)); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -// Repair registry. -TEST_F(MiniInstallTest, RepairRegistryOnFullUser) { - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); - base::CleanupProcesses(installer::kChromeExe, base::TimeDelta(), - content::RESULT_CODE_HUNG, NULL); - ASSERT_TRUE(installer_test::DeleteRegistryKey( - false, // system level - InstallationValidator::CHROME_SINGLE, 0)); // no WOW64 - ASSERT_TRUE( - installer_test::Install(full_installer_, SwitchBuilder().AddChrome())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, RepairRegistryOnFullSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); - ASSERT_TRUE(installer_test::DeleteRegistryKey( - true, // system level - InstallationValidator::CHROME_SINGLE, 0)); // no WOW64 - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_SINGLE, provider_->GetCurrentBuild())); -} - -// Run full Chrome Frame install then uninstall it while IE browser is running. -TEST_F(MiniInstallTest, FullInstallAndUnInstallChromeFrameWithIERunning) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChromeFrame().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_SINGLE, - provider_->GetCurrentBuild())); - // Launch IE and let TearDown step perform uninstall. - installer_test::LaunchIE("http://www.google.com"); -} - -// Install standalone. -TEST_F(MiniInstallTest, InstallStandaloneUser) { - ASSERT_TRUE(installer_test::Install(standalone_installer_)); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -// This test doesn't make sense. Disabling for now. -TEST_F(MiniInstallTest, DISABLED_MiniInstallerOverChromeMetaInstallerTest) { -} - -// Encountering issue 9593. Disabling temporarily. -TEST_F(MiniInstallTest, - DISABLED_InstallLatestStableFullInstallerOverChromeMetaInstaller) { -} - -// Encountering issue 9593. Disabling temporarily. -TEST_F(MiniInstallTest, - DISABLED_InstallLatestDevFullInstallerOverChromeMetaInstallerTest) { -} - -TEST_F(MiniInstallTest, - InstallChromeUsingMultiInstallUser) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, - InstallChromeUsingMultiInstallSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, InstallChromeAndChromeFrameMultiInstallUser) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddChromeFrame().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - false, - InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, - provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, InstallChromeAndChromeFrameMultiInstallSys) { - ASSERT_TRUE(installer_test::Install( - full_installer_, SwitchBuilder().AddChrome() - .AddChromeFrame().AddMultiInstall().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, - provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, InstallChromeFrameUsingMultiInstallUser) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChromeFrame().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - false, - InstallationValidator::CHROME_FRAME_MULTI, - provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, InstallChromeFrameUsingMultiInstallSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChromeFrame().AddMultiInstall().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_MULTI, - provider_->GetCurrentBuild())); -} - -// Chrome Frame is in use while Chrome is install. -TEST_F(MiniInstallTest, InstallChromeWithExistingChromeFrameMultiInstallUser) { - ASSERT_TRUE(installer_test::Install(previous_installer_, - SwitchBuilder().AddChromeFrame().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - false, - InstallationValidator::CHROME_FRAME_MULTI, - provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - false, - InstallationValidator::CHROME_FRAME_MULTI_CHROME_MULTI, - provider_->GetCurrentBuild())); -} - -// Chrome Frame is in use while Chrome is install. -TEST_F(MiniInstallTest, InstallChromeWithExistingChromeFrameMultiInstallSys) { - ASSERT_TRUE(installer_test::Install(previous_installer_, - SwitchBuilder().AddChromeFrame().AddMultiInstall().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall( - true, - InstallationValidator::CHROME_FRAME_MULTI, - provider_->GetPreviousBuild())); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, OverInstallChromeWhenInUseUser) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); - installer_test::LaunchChrome(false, false); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(false, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -TEST_F(MiniInstallTest, OverInstallChromeWhenInUseSys) { - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); - installer_test::LaunchChrome(false, true); - ASSERT_TRUE(installer_test::Install(full_installer_, - SwitchBuilder().AddChrome().AddMultiInstall().AddSystemInstall())); - ASSERT_TRUE(installer_test::ValidateInstall(true, - InstallationValidator::CHROME_MULTI, provider_->GetCurrentBuild())); -} - -#endif - -TEST(GenericInstallTest, MiniInstallTestValidWindowsVersion) { - // We run the tests on all supported OSes. - // Make sure the code agrees. - EXPECT_TRUE(InstallUtil::IsOSSupported()); -} - diff --git a/testing/buildbot/chromium.win.json b/testing/buildbot/chromium.win.json index 317f07a..59e4c26 100644 --- a/testing/buildbot/chromium.win.json +++ b/testing/buildbot/chromium.win.json @@ -22,7 +22,6 @@ {"test": "browser_tests", "shard_index": 0, "total_shards": 3}, "content_browsertests", "installer_util_unittests", - "mini_installer_test", "webkit_compositor_bindings_unittests" ] }, @@ -79,7 +78,6 @@ {"test": "browser_tests", "shard_index": 0, "total_shards": 3}, "content_browsertests", "installer_util_unittests", - "mini_installer_test", "webkit_compositor_bindings_unittests" ] }, @@ -146,7 +144,6 @@ {"test": "browser_tests", "shard_index": 0, "total_shards": 3}, "content_browsertests", "installer_util_unittests", - "mini_installer_test", "webkit_compositor_bindings_unittests" ] }, |