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

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

Issue 9583034: PyAuto tests derived from PolicyTestBase now clear the profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
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 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after
3671 May return before logout is complete and 3671 May return before logout is complete and
3672 gives no indication of success or failure. 3672 gives no indication of success or failure.
3673 Should be logged in to work. 3673 Should be logged in to work.
3674 """ 3674 """
3675 assert self.GetLoginInfo()['is_logged_in'], \ 3675 assert self.GetLoginInfo()['is_logged_in'], \
3676 'Trying to log out when already logged out.' 3676 'Trying to log out when already logged out.'
3677 assert self.WaitForSessionManagerRestart( 3677 assert self.WaitForSessionManagerRestart(
3678 lambda: self.ApplyAccelerator(IDC_EXIT)), \ 3678 lambda: self.ApplyAccelerator(IDC_EXIT)), \
3679 'Session manager did not restart after logout.' 3679 'Session manager did not restart after logout.'
3680 3680
3681 self.setUp() 3681 PyUITest.setUp(self)
Nirnimesh 2012/03/03 01:24:15 why?
frankf 2012/03/03 01:54:13 I don't want Logout() to call the derived class's
dtu 2012/03/03 02:14:41 The intent in Logout() and Signout() is to do only
Nirnimesh 2012/03/03 02:22:01 Makes sense.
frankf 2012/03/03 03:48:05 Agree. Now we have setUp(), SetUp(), __SetUp() :)
3682 3682
3683 def LockScreen(self): 3683 def LockScreen(self):
3684 """Locks the screen on chromeos. 3684 """Locks the screen on chromeos.
3685 3685
3686 Waits until screen is locked. 3686 Waits until screen is locked.
3687 Should be logged in and screen should not be locked to work. 3687 Should be logged in and screen should not be locked to work.
3688 3688
3689 Raises: 3689 Raises:
3690 pyauto_errors.JSONInterfaceError if the automation call returns an error. 3690 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3691 """ 3691 """
(...skipping 27 matching lines...) Expand all
3719 Effectively the same as clicking the "Sign out" link on the screen locker. 3719 Effectively the same as clicking the "Sign out" link on the screen locker.
3720 Screen should be locked for this to work. 3720 Screen should be locked for this to work.
3721 3721
3722 Raises: 3722 Raises:
3723 pyauto_errors.JSONInterfaceError if the automation call returns an error. 3723 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3724 """ 3724 """
3725 cmd_dict = { 'command': 'SignoutInScreenLocker' } 3725 cmd_dict = { 'command': 'SignoutInScreenLocker' }
3726 assert self.WaitForSessionManagerRestart( 3726 assert self.WaitForSessionManagerRestart(
3727 lambda: self._GetResultFromJSONRequest(cmd_dict, windex=None)), \ 3727 lambda: self._GetResultFromJSONRequest(cmd_dict, windex=None)), \
3728 'Session manager did not restart after logout.' 3728 'Session manager did not restart after logout.'
3729 self.setUp() 3729 PyUITest.setUp(self)
3730 3730
3731 def GetBatteryInfo(self): 3731 def GetBatteryInfo(self):
3732 """Get details about battery state. 3732 """Get details about battery state.
3733 3733
3734 Returns: 3734 Returns:
3735 A dictionary with the following keys: 3735 A dictionary with the following keys:
3736 3736
3737 'battery_is_present': bool 3737 'battery_is_present': bool
3738 'line_power_on': bool 3738 'line_power_on': bool
3739 if 'battery_is_present': 3739 if 'battery_is_present':
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
5047 successful = result.wasSuccessful() 5047 successful = result.wasSuccessful()
5048 if not successful: 5048 if not successful:
5049 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 5049 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
5050 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 5050 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
5051 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 5051 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
5052 sys.exit(not successful) 5052 sys.exit(not successful)
5053 5053
5054 5054
5055 if __name__ == '__main__': 5055 if __name__ == '__main__':
5056 Main() 5056 Main()
OLDNEW
« chrome/test/pyautolib/policy_base.py ('K') | « chrome/test/pyautolib/policy_base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698