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

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 10388107: [chromeos] Fix Logout automation when no browser windows are present. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/chromeos_login.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """PyAuto: Python Interface to Chromium's Automation Proxy. 6 """PyAuto: Python Interface to Chromium's Automation Proxy.
7 7
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. 8 PyAuto uses swig to expose Automation Proxy interfaces to Python.
9 For complete documentation on the functionality available, 9 For complete documentation on the functionality available,
10 run pydoc on this file. 10 run pydoc on this file.
(...skipping 4099 matching lines...) Expand 10 before | Expand all | Expand 10 after
4110 observer_id = self._AddLoginEventObserver() 4110 observer_id = self._AddLoginEventObserver()
4111 ret = self.ExecuteJavascriptInOOBEWebUI(""" 4111 ret = self.ExecuteJavascriptInOOBEWebUI("""
4112 chrome.send("completeLogin", ["%s", "%s"] ); 4112 chrome.send("completeLogin", ["%s", "%s"] );
4113 window.domAutomationController.send("success");""" % 4113 window.domAutomationController.send("success");""" %
4114 (username, password)); 4114 (username, password));
4115 return self.GetNextEvent(observer_id).get('error_string') 4115 return self.GetNextEvent(observer_id).get('error_string')
4116 4116
4117 def Logout(self): 4117 def Logout(self):
4118 """Log out from ChromeOS and wait for session_manager to come up. 4118 """Log out from ChromeOS and wait for session_manager to come up.
4119 4119
4120 May return before logout is complete and 4120 This is equivalent to pressing the 'Sign out' button from the
4121 gives no indication of success or failure. 4121 aura shell tray when logged in.
4122 Should be logged in to work. 4122
4123 Should be logged in to work. Re-initializes the automation channel
4124 after logout.
4123 """ 4125 """
4124 assert self.GetLoginInfo()['is_logged_in'], \ 4126 assert self.GetLoginInfo()['is_logged_in'], \
4125 'Trying to log out when already logged out.' 4127 'Trying to log out when already logged out.'
4126 assert self.WaitForSessionManagerRestart( 4128 def _SignOut():
4127 lambda: self.ApplyAccelerator(IDC_EXIT)), \ 4129 cmd_dict = { 'command': 'SignOut' }
4130 self._GetResultFromJSONRequest(cmd_dict, windex=None)
4131 assert self.WaitForSessionManagerRestart(_SignOut), \
4128 'Session manager did not restart after logout.' 4132 'Session manager did not restart after logout.'
4129 self.__SetUp() 4133 self.__SetUp()
4130 4134
4131 def LockScreen(self): 4135 def LockScreen(self):
4132 """Locks the screen on chromeos. 4136 """Locks the screen on chromeos.
4133 4137
4134 Waits until screen is locked. 4138 Waits until screen is locked.
4135 Should be logged in and screen should not be locked to work. 4139 Should be logged in and screen should not be locked to work.
4136 4140
4137 Raises: 4141 Raises:
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
5742 successful = result.wasSuccessful() 5746 successful = result.wasSuccessful()
5743 if not successful: 5747 if not successful:
5744 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 5748 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
5745 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 5749 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
5746 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 5750 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
5747 sys.exit(not successful) 5751 sys.exit(not successful)
5748 5752
5749 5753
5750 if __name__ == '__main__': 5754 if __name__ == '__main__':
5751 Main() 5755 Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/chromeos_login.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698