- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / mini_installer_test / installer_test_util.h
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.
4
5 #ifndef CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_
6 #define CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_
7
8 #include <vector>
9
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"
14
15 namespace installer_test {
16
17 struct InstalledProduct {
18   std::string version;
19   installer::InstallationValidator::InstallationType type;
20   bool system;
21 };
22
23 // Utility functions used to test Chrome installation.
24
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(
29     bool system_level,
30     installer::InstallationValidator::InstallationType type);
31
32 // Deletes the Chrome Windows registry entry.
33 // Returns true if successful, otherwise false.
34 bool DeleteRegistryKey(
35     bool system_level,
36     installer::InstallationValidator::InstallationType type);
37
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);
42
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);
48
49 // Returns the version of the specified |product|.
50 std::string GetVersion(
51     installer::InstallationValidator::InstallationType product);
52
53 // Gets a list of installed products.
54 // Returns true if there are installed products.
55 bool GetInstalledProducts(std::vector<InstalledProduct>* products);
56
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);
61
62 // Uninstall all Chrome or Chrome Frame installations.
63 bool UninstallAll();
64
65 // Uninstall the product specified by |system_level| and |type|.
66 bool Uninstall(
67     bool system_level,
68     installer::InstallationValidator::InstallationType type);
69
70 // Uninstall the product specified by |system_level| and |product|.
71 bool Uninstall(
72     bool system_level,
73     BrowserDistribution::Type product);
74
75 bool ValidateInstall(
76      bool system_level,
77      installer::InstallationValidator::InstallationType expected,
78      const std::string& version);
79
80 // Run and wait for command to finish.
81 // Returns true if successful, otherwise false.
82 bool RunAndWaitForCommandToFinish(CommandLine command);
83
84 }  // namespace
85
86 #endif  // CHROME_TEST_MINI_INSTALLER_TEST_INSTALLER_TEST_UTIL_H_
87