| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """PyAuto: Python Interface to Chromium's Automation Proxy. | 7 """PyAuto: Python Interface to Chromium's Automation Proxy. |
| 8 | 8 |
| 9 PyAuto uses swig to expose Automation Proxy interfaces to Python. | 9 PyAuto uses swig to expose Automation Proxy interfaces to Python. |
| 10 For complete documentation on the functionality available, | 10 For complete documentation on the functionality available, |
| (...skipping 3649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3660 Raises: | 3660 Raises: |
| 3661 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 3661 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 3662 """ | 3662 """ |
| 3663 cmd_dict = { 'command': 'SetMute' } | 3663 cmd_dict = { 'command': 'SetMute' } |
| 3664 cmd_dict = { | 3664 cmd_dict = { |
| 3665 'command': 'SetMute', | 3665 'command': 'SetMute', |
| 3666 'mute': mute, | 3666 'mute': mute, |
| 3667 } | 3667 } |
| 3668 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) | 3668 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
| 3669 | 3669 |
| 3670 def CaptureProfilePhoto(self): |
| 3671 """Captures user profile photo on ChromeOS. |
| 3672 |
| 3673 This is done by driving the TakePhotoDialog. The image file is |
| 3674 saved on disk and its path is set in the local state preferences. |
| 3675 |
| 3676 A user needs to be logged-in as a precondition. Note that the UI is not |
| 3677 destroyed afterwards, a browser restart is necessary if you want |
| 3678 to interact with the browser after this call in the same test case. |
| 3679 |
| 3680 Raises: |
| 3681 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 3682 """ |
| 3683 cmd_dict = { 'command': 'CaptureProfilePhoto' } |
| 3684 return self._GetResultFromJSONRequest(cmd_dict) |
| 3685 |
| 3670 ## ChromeOS section -- end | 3686 ## ChromeOS section -- end |
| 3671 | 3687 |
| 3672 | 3688 |
| 3673 class _RemoteProxy(): | 3689 class _RemoteProxy(): |
| 3674 """Class for PyAuto remote method calls. | 3690 """Class for PyAuto remote method calls. |
| 3675 | 3691 |
| 3676 Use this class along with RemoteHost.testRemoteHost to establish a PyAuto | 3692 Use this class along with RemoteHost.testRemoteHost to establish a PyAuto |
| 3677 connection with another machine and make remote PyAuto calls. The RemoteProxy | 3693 connection with another machine and make remote PyAuto calls. The RemoteProxy |
| 3678 mimics a PyAuto object, so all json-style PyAuto calls can be made on it. | 3694 mimics a PyAuto object, so all json-style PyAuto calls can be made on it. |
| 3679 | 3695 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4178 successful = result.wasSuccessful() | 4194 successful = result.wasSuccessful() |
| 4179 if not successful: | 4195 if not successful: |
| 4180 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 4196 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 4181 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 4197 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 4182 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 4198 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 4183 sys.exit(not successful) | 4199 sys.exit(not successful) |
| 4184 | 4200 |
| 4185 | 4201 |
| 4186 if __name__ == '__main__': | 4202 if __name__ == '__main__': |
| 4187 Main() | 4203 Main() |
| OLD | NEW |