Index: chrome/test/pyautolib/chromeos/suid_actions.py |
diff --git a/chrome/test/pyautolib/chromeos/suid_actions.py b/chrome/test/pyautolib/chromeos/suid_actions.py |
index fe8d311bfb1319500e14283489f91eb54a031490..e5e525cb35c8317ccf6b4fb2e5f42b70efdbf0fa 100755 |
--- a/chrome/test/pyautolib/chromeos/suid_actions.py |
+++ b/chrome/test/pyautolib/chromeos/suid_actions.py |
@@ -12,15 +12,17 @@ Usage: |
sudo python suid_actions.py --action=CleanFlimflamDirs |
""" |
+import logging |
import optparse |
import os |
import shutil |
import sys |
- |
sys.path.append('/usr/local') # to import autotest libs. |
from autotest.cros import cryptohome |
+_AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE = '/root/.forget_usernames' |
+ |
class SuidAction(object): |
"""Helper to perform some super-user actions on ChromeOS.""" |
@@ -65,6 +67,24 @@ class SuidAction(object): |
"""Remove any existing cryptohome vaults.""" |
cryptohome.remove_all_vaults() |
+ def DisableLocalStateAutoClearing(self): |
Nirnimesh
2012/04/12 01:46:24
If you agree with my previous replies, these need
bartfab (slow)
2012/04/12 12:49:31
To maximize test coverage, I went with the route o
|
+ """Disable clearing of the local state on session manager startup.""" |
+ os.system('mount -o remount,rw /') |
+ os.remove(_AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE) |
+ assert not os.path.exists(_AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE) |
+ os.system('mount -o remount,ro /') |
+ logging.debug('Removed %s. Session manager will not clear local state on ' |
+ 'startup.' % _AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE) |
+ |
+ def EnableLocalStateAutoClearing(self): |
+ """Enable clearing of the local state on session manager startup.""" |
+ os.system('mount -o remount,rw /') |
+ open(_AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE, 'w').close() |
+ assert os.path.exists(_AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE) |
+ os.system('mount -o remount,ro /') |
+ logging.debug('Created %s. Session manager will clear local state on ' |
+ 'startup.' % _AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE) |
+ |
if __name__ == '__main__': |
sys.exit(SuidAction().Run()) |