| 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 3589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3600 Raises: | 3600 Raises: |
| 3601 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 3601 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 3602 """ | 3602 """ |
| 3603 cmd_dict = { 'command': 'SetMute' } | 3603 cmd_dict = { 'command': 'SetMute' } |
| 3604 cmd_dict = { | 3604 cmd_dict = { |
| 3605 'command': 'SetMute', | 3605 'command': 'SetMute', |
| 3606 'mute': mute, | 3606 'mute': mute, |
| 3607 } | 3607 } |
| 3608 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) | 3608 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
| 3609 | 3609 |
| 3610 def CaptureProfilePhoto(self): |
| 3611 """Captures user profile photo on ChromeOS. |
| 3612 |
| 3613 This is done by driving the TakePhotoDialog. The image file is |
| 3614 saved on disk and its path is set in the local state preferences. |
| 3615 |
| 3616 A user needs to be logged-in as a precaution. Image capture is |
| 3617 synchronous but the file write is not. |
| 3618 |
| 3619 Raises: |
| 3620 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 3621 """ |
| 3622 cmd_dict = { 'command': 'CaptureProfilePhoto' } |
| 3623 return self._GetResultFromJSONRequest(cmd_dict) |
| 3624 |
| 3610 ## ChromeOS section -- end | 3625 ## ChromeOS section -- end |
| 3611 | 3626 |
| 3612 | 3627 |
| 3613 class _RemoteProxy(): | 3628 class _RemoteProxy(): |
| 3614 """Class for PyAuto remote method calls. | 3629 """Class for PyAuto remote method calls. |
| 3615 | 3630 |
| 3616 Use this class along with RemoteHost.testRemoteHost to establish a PyAuto | 3631 Use this class along with RemoteHost.testRemoteHost to establish a PyAuto |
| 3617 connection with another machine and make remote PyAuto calls. The RemoteProxy | 3632 connection with another machine and make remote PyAuto calls. The RemoteProxy |
| 3618 mimics a PyAuto object, so all json-style PyAuto calls can be made on it. | 3633 mimics a PyAuto object, so all json-style PyAuto calls can be made on it. |
| 3619 | 3634 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4118 successful = result.wasSuccessful() | 4133 successful = result.wasSuccessful() |
| 4119 if not successful: | 4134 if not successful: |
| 4120 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 4135 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 4121 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 4136 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 4122 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 4137 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 4123 sys.exit(not successful) | 4138 sys.exit(not successful) |
| 4124 | 4139 |
| 4125 | 4140 |
| 4126 if __name__ == '__main__': | 4141 if __name__ == '__main__': |
| 4127 Main() | 4142 Main() |
| OLD | NEW |