| OLD | NEW |
| 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 5581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5592 cmd_dict = { 'command': 'GetTimeInfo' } | 5592 cmd_dict = { 'command': 'GetTimeInfo' } |
| 5593 if self.GetLoginInfo()['is_logged_in']: | 5593 if self.GetLoginInfo()['is_logged_in']: |
| 5594 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) | 5594 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) |
| 5595 else: | 5595 else: |
| 5596 return self._GetResultFromJSONRequest(cmd_dict, windex=None) | 5596 return self._GetResultFromJSONRequest(cmd_dict, windex=None) |
| 5597 | 5597 |
| 5598 def SetTimezone(self, timezone): | 5598 def SetTimezone(self, timezone): |
| 5599 """Sets the timezone on ChromeOS. A user must be logged in. | 5599 """Sets the timezone on ChromeOS. A user must be logged in. |
| 5600 | 5600 |
| 5601 The timezone is the relative path to the timezone file in | 5601 The timezone is the relative path to the timezone file in |
| 5602 /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles | 5602 /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles is |
| 5603 is 'America/Los_Angeles'. | 5603 'America/Los_Angeles'. For a list of valid timezones see |
| 5604 'chrome/browser/chromeos/system/timezone_settings.cc'. |
| 5604 | 5605 |
| 5605 This method does not return indication of success or failure. | 5606 This method does not return indication of success or failure. |
| 5606 If the timezone is invalid, it falls back to UTC/GMT. | 5607 If the timezone is it falls back to a valid timezone. |
| 5607 | 5608 |
| 5608 Raises: | 5609 Raises: |
| 5609 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 5610 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 5610 """ | 5611 """ |
| 5611 cmd_dict = { | 5612 cmd_dict = { |
| 5612 'command': 'SetTimezone', | 5613 'command': 'SetTimezone', |
| 5613 'timezone': timezone, | 5614 'timezone': timezone, |
| 5614 } | 5615 } |
| 5615 self._GetResultFromJSONRequest(cmd_dict, windex=None) | 5616 self._GetResultFromJSONRequest(cmd_dict, windex=None) |
| 5616 | 5617 |
| (...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6545 successful = result.wasSuccessful() | 6546 successful = result.wasSuccessful() |
| 6546 if not successful: | 6547 if not successful: |
| 6547 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6548 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 6548 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6549 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 6549 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6550 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 6550 sys.exit(not successful) | 6551 sys.exit(not successful) |
| 6551 | 6552 |
| 6552 | 6553 |
| 6553 if __name__ == '__main__': | 6554 if __name__ == '__main__': |
| 6554 Main() | 6555 Main() |
| OLD | NEW |