Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8552)

Unified Diff: chrome/test/mini_installer/test_installer.py

Issue 23523045: Clean the machine before running commands in the mini_installer test framework. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Address robertshield's comment. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b2280fc143bc161ffa51103621c10be3123605f0 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()
gab 2013/09/10 22:19:05 This shouldn't always be run by default imo... as
grt (UTC plus 2) 2013/09/11 03:01:41 I like the idea of: 1) having the test fail if it
sukolsak 2013/09/13 09:10:21 Done.
sukolsak 2013/09/13 09:10:21 Done. Checking whether Chrome is installed (and i
state = self._test[0]
self._VerifyState(state)
@@ -118,6 +118,20 @@ 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" & '
+ 'python uninstall_chrome.py '
+ '--chrome-long-name="$CHROME_LONG_NAME" --system-level')
+ resolved_command = self._path_resolver.ResolvePath(command)
+ script_dir = os.path.dirname(os.path.abspath(__file__))
gab 2013/09/10 22:19:05 Since we now need |script_dir| in more than one pl
sukolsak 2013/09/13 09:10:21 |script_dir| doesn't seem like a state of an objec
+ subprocess.call(resolved_command, shell=True, cwd=script_dir,
+ stderr=open(os.devnull, 'w'))
gab 2013/09/10 22:19:05 So we trash all stderr output :(... why? If it's o
sukolsak 2013/09/13 09:10:21 Done.
+
def MergePropertyDictionaries(current_property, new_property):
"""Merges the new property dictionary into the current property dictionary.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698