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

Unified Diff: chrome/test/pyautolib/chromeos/suid_actions.py

Issue 9960074: Add a test for the "ephemeral_users_enabled" device policy (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments addressed. Tests clearing of local state as well now. Created 8 years, 8 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
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())

Powered by Google App Engine
This is Rietveld 408576698