| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 One of the equivalent names in chrome/common/pref_names.h could | 1164 One of the equivalent names in chrome/common/pref_names.h could |
| 1165 also be used. | 1165 also be used. |
| 1166 value: the value to be set. It could be plain values like int, bool, | 1166 value: the value to be set. It could be plain values like int, bool, |
| 1167 string or complex ones like list. | 1167 string or complex ones like list. |
| 1168 The user has to ensure that the right value is specified for the | 1168 The user has to ensure that the right value is specified for the |
| 1169 right key. It's useful to dump the preferences first to determine | 1169 right key. It's useful to dump the preferences first to determine |
| 1170 what type is expected for a particular preference path. | 1170 what type is expected for a particular preference path. |
| 1171 """ | 1171 """ |
| 1172 cmd_dict = { | 1172 cmd_dict = { |
| 1173 'command': 'SetLocalStatePrefs', | 1173 'command': 'SetLocalStatePrefs', |
| 1174 'windex': 0, |
| 1174 'path': path, | 1175 'path': path, |
| 1175 'value': value, | 1176 'value': value, |
| 1176 } | 1177 } |
| 1177 self._GetResultFromJSONRequest(cmd_dict) | 1178 self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
| 1178 | 1179 |
| 1179 def GetPrefsInfo(self): | 1180 def GetPrefsInfo(self): |
| 1180 """Return info about preferences. | 1181 """Return info about preferences. |
| 1181 | 1182 |
| 1182 This represents a snapshot of the preferences. If you expect preferences | 1183 This represents a snapshot of the preferences. If you expect preferences |
| 1183 to have changed, you need to call this method again to get a fresh | 1184 to have changed, you need to call this method again to get a fresh |
| 1184 snapshot. | 1185 snapshot. |
| 1185 | 1186 |
| 1186 Returns: | 1187 Returns: |
| 1187 an instance of prefs_info.PrefsInfo | 1188 an instance of prefs_info.PrefsInfo |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1207 One of the equivalent names in chrome/common/pref_names.h could | 1208 One of the equivalent names in chrome/common/pref_names.h could |
| 1208 also be used. | 1209 also be used. |
| 1209 value: the value to be set. It could be plain values like int, bool, | 1210 value: the value to be set. It could be plain values like int, bool, |
| 1210 string or complex ones like list. | 1211 string or complex ones like list. |
| 1211 The user has to ensure that the right value is specified for the | 1212 The user has to ensure that the right value is specified for the |
| 1212 right key. It's useful to dump the preferences first to determine | 1213 right key. It's useful to dump the preferences first to determine |
| 1213 what type is expected for a particular preference path. | 1214 what type is expected for a particular preference path. |
| 1214 """ | 1215 """ |
| 1215 cmd_dict = { | 1216 cmd_dict = { |
| 1216 'command': 'SetPrefs', | 1217 'command': 'SetPrefs', |
| 1218 'windex': 0, |
| 1217 'path': path, | 1219 'path': path, |
| 1218 'value': value, | 1220 'value': value, |
| 1219 } | 1221 } |
| 1220 self._GetResultFromJSONRequest(cmd_dict) | 1222 self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
| 1221 | 1223 |
| 1222 def SendWebkitKeyEvent(self, key_type, key_code, tab_index=0, windex=0): | 1224 def SendWebkitKeyEvent(self, key_type, key_code, tab_index=0, windex=0): |
| 1223 """Send a webkit key event to the browser. | 1225 """Send a webkit key event to the browser. |
| 1224 | 1226 |
| 1225 Args: | 1227 Args: |
| 1226 key_type: the raw key type such as 0 for up and 3 for down. | 1228 key_type: the raw key type such as 0 for up and 3 for down. |
| 1227 key_code: the hex value associated with the keypress (virtual key code). | 1229 key_code: the hex value associated with the keypress (virtual key code). |
| 1228 tab_index: tab index to work on. Defaults to 0 (first tab). | 1230 tab_index: tab index to work on. Defaults to 0 (first tab). |
| 1229 windex: window index to work on. Defaults to 0 (first window). | 1231 windex: window index to work on. Defaults to 0 (first window). |
| 1230 """ | 1232 """ |
| (...skipping 3612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4843 successful = result.wasSuccessful() | 4845 successful = result.wasSuccessful() |
| 4844 if not successful: | 4846 if not successful: |
| 4845 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 4847 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 4846 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 4848 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 4847 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 4849 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 4848 sys.exit(not successful) | 4850 sys.exit(not successful) |
| 4849 | 4851 |
| 4850 | 4852 |
| 4851 if __name__ == '__main__': | 4853 if __name__ == '__main__': |
| 4852 Main() | 4854 Main() |
| OLD | NEW |