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 5695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5706 cmd_dict = { 'command': 'GetTimeInfo' } | 5706 cmd_dict = { 'command': 'GetTimeInfo' } |
5707 if self.GetLoginInfo()['is_logged_in']: | 5707 if self.GetLoginInfo()['is_logged_in']: |
5708 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) | 5708 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) |
5709 else: | 5709 else: |
5710 return self._GetResultFromJSONRequest(cmd_dict, windex=None) | 5710 return self._GetResultFromJSONRequest(cmd_dict, windex=None) |
5711 | 5711 |
5712 def SetTimezone(self, timezone): | 5712 def SetTimezone(self, timezone): |
5713 """Sets the timezone on ChromeOS. A user must be logged in. | 5713 """Sets the timezone on ChromeOS. A user must be logged in. |
5714 | 5714 |
5715 The timezone is the relative path to the timezone file in | 5715 The timezone is the relative path to the timezone file in |
5716 /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles | 5716 /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles is |
5717 is 'America/Los_Angeles'. | 5717 'America/Los_Angeles'. For a list of valid timezones see |
| 5718 'chrome/browser/chromeos/system/timezone_settings.cc'. |
5718 | 5719 |
5719 This method does not return indication of success or failure. | 5720 This method does not return indication of success or failure. |
5720 If the timezone is invalid, it falls back to UTC/GMT. | 5721 If the timezone is it falls back to a valid timezone. |
5721 | 5722 |
5722 Raises: | 5723 Raises: |
5723 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 5724 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
5724 """ | 5725 """ |
5725 cmd_dict = { | 5726 cmd_dict = { |
5726 'command': 'SetTimezone', | 5727 'command': 'SetTimezone', |
5727 'timezone': timezone, | 5728 'timezone': timezone, |
5728 } | 5729 } |
5729 self._GetResultFromJSONRequest(cmd_dict, windex=None) | 5730 self._GetResultFromJSONRequest(cmd_dict, windex=None) |
5730 | 5731 |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6659 successful = result.wasSuccessful() | 6660 successful = result.wasSuccessful() |
6660 if not successful: | 6661 if not successful: |
6661 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6662 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
6662 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6663 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
6663 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6664 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
6664 sys.exit(not successful) | 6665 sys.exit(not successful) |
6665 | 6666 |
6666 | 6667 |
6667 if __name__ == '__main__': | 6668 if __name__ == '__main__': |
6668 Main() | 6669 Main() |
OLD | NEW |