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

Side by Side Diff: client/site_tests/login_DBusCalls/login_DBusCalls.py

Issue 5216005: autotest: Test RestartEntd dbus call (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: Respond to rgindas comments Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/site_tests/login_DBusCalls/control ('k') | server/site_tests/suites/control.regression » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import logging, os
6 from autotest_lib.client.bin import chromeos_constants, site_log_reader
7 from autotest_lib.client.bin import site_ui_test, site_utils
8 from autotest_lib.client.common_lib import error, utils
9
10 _SESSION_MANAGER_DEST='org.chromium.SessionManager'
11 _SESSION_MANAGER_OBJECT='org.chromium.SessionManagerInterface'
12 _SESSION_MANAGER_PATH='/org/chromium/SessionManager'
13
14 class login_DBusCalls(site_ui_test.UITest):
15 version = 1
16
17 def _call_session_manager_method(self, method, user='chronos'):
18 """Call session manager dbus method as given user.
19
20 We assume the method exists and succeeds.
21
22 Args:
23 method: name of method
24 user: system user to run as
25 Returns:
26 None
27 """
28 utils.system('su %s -c \'dbus-send --system --type=method_call '
29 '--print-reply --dest=%s %s %s.%s\'' %
30 (user, _SESSION_MANAGER_DEST, _SESSION_MANAGER_PATH,
31 _SESSION_MANAGER_OBJECT, method))
32
33
34 def _test_restart_entd(self):
35 """Test the RestartEntd method."""
36 message_log = site_log_reader.LogReader()
37 message_log.set_start_by_current()
38 ui_log = site_log_reader.LogReader(chromeos_constants.UI_LOG)
39 ui_log.set_start_by_current()
40 # Make sure we can call RestartEntd from user chronos.
41 self._call_session_manager_method('RestartEntd')
42 try:
43 site_utils.poll_for_condition(
44 lambda: ui_log.can_find('Restart was successful'),
45 timeout=30,
46 exception=error.TestFail(
47 'Found no ui log message about attempting to restart entd'))
48 finally:
49 logging.debug('UI log from RestartEntd: ' +
50 ui_log.get_logs())
51
52 grep_bait = 'entdwife.sh: Username: ' + self.username
53 try:
54 site_utils.poll_for_condition(
55 lambda: message_log.can_find(grep_bait),
56 timeout=30,
57 exception=error.TestFail('Did not find %s in message log' %
58 grep_bait))
59 finally:
60 logging.debug('Message log from RestartEntd: ' +
61 message_log.get_logs())
62
63
64 def run_once(self):
65 self.login()
66 self._test_restart_entd()
OLDNEW
« no previous file with comments | « client/site_tests/login_DBusCalls/control ('k') | server/site_tests/suites/control.regression » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698