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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1032 """Return info about preferences. | 1032 """Return info about preferences. |
1033 | 1033 |
1034 This represents a snapshot of the local state preferences. If you expect | 1034 This represents a snapshot of the local state preferences. If you expect |
1035 local state preferences to have changed, you need to call this method again | 1035 local state preferences to have changed, you need to call this method again |
1036 to get a fresh snapshot. | 1036 to get a fresh snapshot. |
1037 | 1037 |
1038 Returns: | 1038 Returns: |
1039 an instance of prefs_info.PrefsInfo | 1039 an instance of prefs_info.PrefsInfo |
1040 """ | 1040 """ |
1041 return prefs_info.PrefsInfo( | 1041 return prefs_info.PrefsInfo( |
1042 self._SendJSONRequest(0, | 1042 self._SendJSONRequest(-1, |
1043 json.dumps({'command': 'GetLocalStatePrefsInfo'}), | 1043 json.dumps({'command': 'GetLocalStatePrefsInfo'}), |
1044 self.action_max_timeout_ms())) | 1044 self.action_max_timeout_ms())) |
1045 | 1045 |
1046 def SetLocalStatePrefs(self, path, value): | 1046 def SetLocalStatePrefs(self, path, value): |
1047 """Set local state preference for the given path. | 1047 """Set local state preference for the given path. |
1048 | 1048 |
1049 Preferences are stored by Chromium as a hierarchical dictionary. | 1049 Preferences are stored by Chromium as a hierarchical dictionary. |
1050 dot-separated paths can be used to refer to a particular preference. | 1050 dot-separated paths can be used to refer to a particular preference. |
1051 example: "session.restore_on_startup" | 1051 example: "session.restore_on_startup" |
1052 | 1052 |
(...skipping 23 matching lines...) Expand all Loading... |
1076 """Return info about preferences. | 1076 """Return info about preferences. |
1077 | 1077 |
1078 This represents a snapshot of the preferences. If you expect preferences | 1078 This represents a snapshot of the preferences. If you expect preferences |
1079 to have changed, you need to call this method again to get a fresh | 1079 to have changed, you need to call this method again to get a fresh |
1080 snapshot. | 1080 snapshot. |
1081 | 1081 |
1082 Returns: | 1082 Returns: |
1083 an instance of prefs_info.PrefsInfo | 1083 an instance of prefs_info.PrefsInfo |
1084 """ | 1084 """ |
1085 return prefs_info.PrefsInfo( | 1085 return prefs_info.PrefsInfo( |
1086 self._SendJSONRequest(-1, json.dumps({'command': 'GetPrefsInfo'}), | 1086 self._SendJSONRequest(0, json.dumps({'command': 'GetPrefsInfo'}), |
1087 self.action_max_timeout_ms())) | 1087 self.action_max_timeout_ms())) |
1088 | 1088 |
1089 def SetPrefs(self, path, value): | 1089 def SetPrefs(self, path, value): |
1090 """Set preference for the given path. | 1090 """Set preference for the given path. |
1091 | 1091 |
1092 Preferences are stored by Chromium as a hierarchical dictionary. | 1092 Preferences are stored by Chromium as a hierarchical dictionary. |
1093 dot-separated paths can be used to refer to a particular preference. | 1093 dot-separated paths can be used to refer to a particular preference. |
1094 example: "session.restore_on_startup" | 1094 example: "session.restore_on_startup" |
1095 | 1095 |
1096 Some preferences are managed, that is, they cannot be changed by the | 1096 Some preferences are managed, that is, they cannot be changed by the |
(...skipping 3670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4767 successful = result.wasSuccessful() | 4767 successful = result.wasSuccessful() |
4768 if not successful: | 4768 if not successful: |
4769 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 4769 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
4770 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 4770 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
4771 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 4771 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
4772 sys.exit(not successful) | 4772 sys.exit(not successful) |
4773 | 4773 |
4774 | 4774 |
4775 if __name__ == '__main__': | 4775 if __name__ == '__main__': |
4776 Main() | 4776 Main() |
OLD | NEW |