1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_
6 #define CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_
10 #include "base/command_line.h"
11 #include "base/files/file_path.h"
12 #include "chrome/installer/util/installation_validator.h"
13 #include "chrome/test/mini_installer_test/switch_builder.h"
15 namespace installer_test {
17 struct InstalledProduct {
19 installer::InstallationValidator::InstallationType type;
23 // Utility functions used to test Chrome installation.
25 // Deletes the Chrome installation directory which is found at different
26 // locations depending on the |system_level| and |type|.
27 // Returns true if successful, otherwise false.
28 bool DeleteInstallDirectory(
30 installer::InstallationValidator::InstallationType type);
32 // Deletes the Chrome Windows registry entry.
33 // Returns true if successful, otherwise false.
34 bool DeleteRegistryKey(
36 installer::InstallationValidator::InstallationType type);
38 // Locates the Chrome installation directory based on the
39 // provided |system_level|. Returns true if successful, otherwise false.
40 // Returns true if successful, otherwise false.
41 bool GetChromeInstallDirectory(bool system_level, base::FilePath* path);
43 // Gets the installation directory of either Chrome or Chrome Frame
44 // as specified by the |system_level| and |type|.
45 // Returns true if successful, otherwise false.
46 bool GetInstallDirectory(bool system_level,
47 BrowserDistribution::Type type, base::FilePath* path);
49 // Returns the version of the specified |product|.
50 std::string GetVersion(
51 installer::InstallationValidator::InstallationType product);
53 // Gets a list of installed products.
54 // Returns true if there are installed products.
55 bool GetInstalledProducts(std::vector<InstalledProduct>* products);
57 bool Install(const base::FilePath& installer);
58 bool Install(const base::FilePath& installer, const SwitchBuilder& switches);
59 bool LaunchChrome(bool close_after_launch, bool system_level);
60 bool LaunchIE(const std::string& url);
62 // Uninstall all Chrome or Chrome Frame installations.
65 // Uninstall the product specified by |system_level| and |type|.
68 installer::InstallationValidator::InstallationType type);
70 // Uninstall the product specified by |system_level| and |product|.
73 BrowserDistribution::Type product);
77 installer::InstallationValidator::InstallationType expected,
78 const std::string& version);
80 // Run and wait for command to finish.
81 // Returns true if successful, otherwise false.
82 bool RunAndWaitForCommandToFinish(CommandLine command);
86 #endif // CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_