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

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: Fix reversed logic in debug output. 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..96e8ede4f43895879f9dc0920a0f09944b9c6dd7 100755
--- a/chrome/test/pyautolib/chromeos/suid_actions.py
+++ b/chrome/test/pyautolib/chromeos/suid_actions.py
@@ -12,15 +12,19 @@ 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
+# TODO(bartfab): Remove when crosbug.com/20709 is fixed.
+sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
+from pyauto import AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE
+
class SuidAction(object):
"""Helper to perform some super-user actions on ChromeOS."""
@@ -65,6 +69,38 @@ class SuidAction(object):
"""Remove any existing cryptohome vaults."""
cryptohome.remove_all_vaults()
+ def TryToDisableLocalStateAutoClearing(self):
+ """Try to disable clearing of the local state on session manager startup.
+
+ This will fail if rootfs verification is on.
+ TODO(bartfab): Remove this method when crosbug.com/20709 is fixed.
+ """
+ os.system('mount -o remount,rw /')
+ os.remove(AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE)
+ os.system('mount -o remount,ro /')
+ if os.path.exists(AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE):
+ logging.debug('Failed to remove %s. Session manager will clear local '
+ 'state on startup.' % AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE)
+ else:
+ logging.debug('Removed %s. Session manager will not clear local state on '
+ 'startup.' % AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE)
+
+ def TryToEnableLocalStateAutoClearing(self):
+ """Try to enable clearing of the local state on session manager startup.
+
+ This will fail if rootfs verification is on.
+ TODO(bartfab): Remove this method when crosbug.com/20709 is fixed.
+ """
+ os.system('mount -o remount,rw /')
+ open(AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE, 'w').close()
+ os.system('mount -o remount,ro /')
+ if os.path.exists(AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE):
+ logging.debug('Created %s. Session manager will clear local state on '
+ 'startup.' % AUTO_CLEAR_LOCAL_STATE_MAGIC_FILE)
+ else:
+ logging.debug('Failed to create %s. Session manager will not 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