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 6018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6029 cmd_dict = { 'command': 'GetTimeInfo' } | 6029 cmd_dict = { 'command': 'GetTimeInfo' } |
6030 if self.GetLoginInfo()['is_logged_in']: | 6030 if self.GetLoginInfo()['is_logged_in']: |
6031 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) | 6031 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) |
6032 else: | 6032 else: |
6033 return self._GetResultFromJSONRequest(cmd_dict, windex=None) | 6033 return self._GetResultFromJSONRequest(cmd_dict, windex=None) |
6034 | 6034 |
6035 def SetTimezone(self, timezone): | 6035 def SetTimezone(self, timezone): |
6036 """Sets the timezone on ChromeOS. A user must be logged in. | 6036 """Sets the timezone on ChromeOS. A user must be logged in. |
6037 | 6037 |
6038 The timezone is the relative path to the timezone file in | 6038 The timezone is the relative path to the timezone file in |
6039 /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles | 6039 /usr/share/zoneinfo. For example, /usr/share/zoneinfo/America/Los_Angeles is |
6040 is 'America/Los_Angeles'. | 6040 'America/Los_Angeles'. For a list of valid timezones see |
| 6041 'chrome/browser/chromeos/system/timezone_settings.cc'. |
6041 | 6042 |
6042 This method does not return indication of success or failure. | 6043 This method does not return indication of success or failure. |
6043 If the timezone is invalid, it falls back to UTC/GMT. | 6044 If the timezone is it falls back to a valid timezone. |
6044 | 6045 |
6045 Raises: | 6046 Raises: |
6046 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 6047 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
6047 """ | 6048 """ |
6048 cmd_dict = { | 6049 cmd_dict = { |
6049 'command': 'SetTimezone', | 6050 'command': 'SetTimezone', |
6050 'timezone': timezone, | 6051 'timezone': timezone, |
6051 } | 6052 } |
6052 self._GetResultFromJSONRequest(cmd_dict, windex=None) | 6053 self._GetResultFromJSONRequest(cmd_dict, windex=None) |
6053 | 6054 |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6982 successful = result.wasSuccessful() | 6983 successful = result.wasSuccessful() |
6983 if not successful: | 6984 if not successful: |
6984 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6985 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
6985 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6986 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
6986 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6987 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
6987 sys.exit(not successful) | 6988 sys.exit(not successful) |
6988 | 6989 |
6989 | 6990 |
6990 if __name__ == '__main__': | 6991 if __name__ == '__main__': |
6991 Main() | 6992 Main() |
OLD | NEW |