Index: chrome/test/mini_installer/test_installer.py |
diff --git a/chrome/test/mini_installer/test_installer.py b/chrome/test/mini_installer/test_installer.py |
index e0614243b0ee51d3c5219d77e050f43e494f4bb3..b4c08ff90b5aff1f187aa988e6c9d93252b4c226 100644 |
--- a/chrome/test/mini_installer/test_installer.py |
+++ b/chrome/test/mini_installer/test_installer.py |
@@ -69,7 +69,7 @@ class InstallerTest(unittest.TestCase): |
self.assertEqual(1, len(self._test) % 2, |
'The length of test array must be odd') |
- # TODO(sukolsak): run a reset command that puts the machine in clean state. |
+ self._RunCleanCommand() |
state = self._test[0] |
self._VerifyState(state) |
@@ -118,6 +118,19 @@ class InstallerTest(unittest.TestCase): |
self.fail('Command %s returned non-zero exit status %s' % ( |
resolved_command, exit_status)) |
+ def _RunCleanCommand(self): |
+ """Puts the machine in the clean state (i.e. Chrome not installed).""" |
+ # TODO(sukolsak): Read the clean state from the config file and clean |
+ # the machine according to it. |
+ # TODO(sukolsak): Handle Chrome SxS installs. |
+ command = ('python uninstall_chrome.py ' |
+ '--chrome-long-name="$CHROME_LONG_NAME" --silent & ' |
+ 'python uninstall_chrome.py ' |
+ '--chrome-long-name="$CHROME_LONG_NAME" --system-level --silent') |
+ resolved_command = self._path_resolver.ResolvePath(command) |
+ script_dir = os.path.dirname(os.path.abspath(__file__)) |
+ subprocess.call(resolved_command, shell=True, cwd=script_dir) |
+ |
def MergePropertyDictionaries(current_property, new_property): |
"""Merges the new property dictionary into the current property dictionary. |
@@ -211,11 +224,20 @@ def main(): |
'Release or Debug directory)') |
parser.add_option('--target', default='Release', |
help='Build target (Release or Debug)') |
+ parser.add_option('--force-clean', action='store_true', dest='force_clean', |
+ default=False, help='Force cleaning existing installations') |
options, args = parser.parse_args() |
if len(args) != 1: |
parser.error('Incorrect number of arguments.') |
config_filename = args[0] |
+ if not options.force_clean: |
+ prompt = ('Warning: This script will uninstall Chrome or Chromium if they ' |
gab
2013/09/13 15:06:19
Instead of always prompting how about an option on
sukolsak
2013/09/13 15:59:33
Then we will only warn the user only when the regi
gab
2013/09/13 20:12:55
I'd say yes, I think we shouldn't delete a real/fu
sukolsak
2013/09/13 23:11:14
Done.
|
+ 'are installed. Do you want to continue? (y/N) ') |
+ if raw_input(prompt).strip() != 'y': |
+ print >> sys.stderr, 'User aborted' |
+ return 1 |
+ |
mini_installer_path = os.path.join(options.build_dir, options.target, |
'mini_installer.exe') |
assert os.path.exists(mini_installer_path), ('Could not find file %s' % |