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

Unified Diff: client/cros/login.py

Issue 6546062: Up process priority during login. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Upped priority to 20. Created 9 years, 10 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: client/cros/login.py
diff --git a/client/cros/login.py b/client/cros/login.py
index 60ad0371ca5a8c5921aa80ddd262c30863433b1c..af582d8eabb2237f458da6f326a4cac1cab66f07 100644
--- a/client/cros/login.py
+++ b/client/cros/login.py
@@ -11,6 +11,10 @@ from autotest_lib.client.common_lib import error
_DEFAULT_TIMEOUT = 30
+# Priority increase to use when logging in to make sure we aren't descheduled at
+# inopportune times.
+_LOGIN_NICE = 20
+
# Log messages used to signal when we're in a logout situation. Used to detect
# crashes by cros_ui_test.UITest.
LOGOUT_ATTEMPT_MSG = 'cros/login.py: Attempting logout...'
@@ -146,24 +150,28 @@ def attempt_login(username, password, timeout=_DEFAULT_TIMEOUT):
log_reader = cros_logging.LogReader()
log_reader.set_start_by_current()
- ax = cros_ui.get_autox()
- # navigate to login screen
- ax.send_hotkey("Ctrl+Alt+L")
- # escape out of any login screen menus (e.g., the network selection menu)
- ax.send_hotkey("Escape")
- time.sleep(0.5)
- if (username):
- # focus username
- ax.send_hotkey("Alt+U")
- ax.send_text(username)
- # TODO(rginda): remove Tab after http://codereview.chromium.org/1390003
- ax.send_hotkey("Tab")
- # focus password
- ax.send_hotkey("Alt+P")
- ax.send_text(password)
- ax.send_hotkey("Return")
- else:
- ax.send_hotkey("Alt+B") # Browse without signing-in
+ # Up our priority so we don't get descheduled in the middle of sending key
+ # press and key release events.
+ utils.system('renice +%d -p %d' % (_LOGIN_NICE, os.getpid()))
+ try:
+ ax = cros_ui.get_autox()
+ # navigate to login screen
+ ax.send_hotkey("Ctrl+Alt+L")
+ # escape out of any login screen menus (e.g., the network selection menu)
+ ax.send_hotkey("Escape")
+ time.sleep(0.5)
+ if (username):
+ # focus username
+ ax.send_hotkey("Alt+U")
+ ax.send_text(username)
+ # focus password
+ ax.send_hotkey("Alt+P")
+ ax.send_text(password)
+ ax.send_hotkey("Return")
+ else:
+ ax.send_hotkey("Alt+B") # Browse without signing-in
+ finally:
+ utils.system('renice -%d -p %d' % (_LOGIN_NICE, os.getpid()))
wait_for_condition(condition=logged_in,
timeout_msg='Timed out waiting for login',
« 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