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

Unified Diff: client/common_lib/site_ui.py

Issue 1203002: add ScreenSaverUnlock autotest and teach ScreenSaverRunning to log in (Closed)
Patch Set: fix copyright year in control file, again Created 10 years, 9 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 | « client/bin/site_login.py ('k') | client/config/autox_unlock.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/common_lib/site_ui.py
diff --git a/client/common_lib/site_ui.py b/client/common_lib/site_ui.py
index cf05cb04115eddb990d96d326a8c70fca50d6ca3..ffc515e5ec977032d28e89d424c04aa61749cb24 100644
--- a/client/common_lib/site_ui.py
+++ b/client/common_lib/site_ui.py
@@ -17,6 +17,33 @@ def xcommand(cmd):
return 'DISPLAY=:0 XAUTHORITY=/home/chronos/.Xauthority ' + cmd
+def xcommand_as(cmd, user='chronos'):
+ """
+ Same as xcommand, except wrapped in a su to the desired user.
+ """
+ return xcommand('su %s -c \'%s\'' % (user, cmd))
+
+
+def xsystem(cmd, timeout=None, ignore_status=False):
+ """
+ Run the command cmd, using utils.system, after adding the necessary
+ setup to connect to the X server.
+ """
+
+ return utils.system(xcommand(cmd), timeout=timeout,
+ ignore_status=ignore_status)
+
+
+def xsystem_as(cmd, user='chronos', timeout=None, ignore_status=False):
+ """
+ Run the command cmd as the given user, using utils.system, after adding
+ the necessary setup to connect to the X server.
+ """
+
+ return utils.system(xcommand_as(cmd, user=user), timeout=timeout,
+ ignore_status=ignore_status)
+
+
class ChromeSession(object):
"""
A class to start and close Chrome sessions.
« no previous file with comments | « client/bin/site_login.py ('k') | client/config/autox_unlock.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698