| 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 3641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3652 | 3652 |
| 3653 { u'ignorelist': [], | 3653 { u'ignorelist': [], |
| 3654 u'pacurl': u'http://example.com/config.pac', | 3654 u'pacurl': u'http://example.com/config.pac', |
| 3655 u'single': False, | 3655 u'single': False, |
| 3656 u'type': 3} | 3656 u'type': 3} |
| 3657 | 3657 |
| 3658 Raises: | 3658 Raises: |
| 3659 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 3659 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 3660 """ | 3660 """ |
| 3661 cmd_dict = { 'command': 'GetProxySettings' } | 3661 cmd_dict = { 'command': 'GetProxySettings' } |
| 3662 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) | 3662 return self._GetResultFromJSONRequest(cmd_dict, windex=0) |
| 3663 | 3663 |
| 3664 def SetProxySettingsOnChromeOS(self, key, value): | 3664 def SetProxySettingsOnChromeOS(self, key, value): |
| 3665 """Set a proxy setting on Chrome OS. | 3665 """Set a proxy setting on Chrome OS. |
| 3666 | 3666 |
| 3667 Owner must be logged in for these to persist. | 3667 Owner must be logged in for these to persist. |
| 3668 If user is not logged in or is logged in as non-owner or guest, | 3668 If user is not logged in or is logged in as non-owner or guest, |
| 3669 proxy settings do not persist across browser restarts or login/logout. | 3669 proxy settings do not persist across browser restarts or login/logout. |
| 3670 | 3670 |
| 3671 Valid settings are: | 3671 Valid settings are: |
| 3672 'type': int - Type of proxy. Should be one of: | 3672 'type': int - Type of proxy. Should be one of: |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3706 self.SetProxySettings('pacurl', 'http://example.com/config.pac') | 3706 self.SetProxySettings('pacurl', 'http://example.com/config.pac') |
| 3707 | 3707 |
| 3708 Raises: | 3708 Raises: |
| 3709 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 3709 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 3710 """ | 3710 """ |
| 3711 cmd_dict = { | 3711 cmd_dict = { |
| 3712 'command': 'SetProxySettings', | 3712 'command': 'SetProxySettings', |
| 3713 'key': key, | 3713 'key': key, |
| 3714 'value': value, | 3714 'value': value, |
| 3715 } | 3715 } |
| 3716 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) | 3716 return self._GetResultFromJSONRequest(cmd_dict, windex=0) |
| 3717 | 3717 |
| 3718 def ForgetWifiNetwork(self, service_path): | 3718 def ForgetWifiNetwork(self, service_path): |
| 3719 """Forget a remembered network by its service path. | 3719 """Forget a remembered network by its service path. |
| 3720 | 3720 |
| 3721 This function is equivalent to clicking the 'Forget Network' button in the | 3721 This function is equivalent to clicking the 'Forget Network' button in the |
| 3722 chrome://settings/internet page. This function does not indicate whether | 3722 chrome://settings/internet page. This function does not indicate whether |
| 3723 or not forget succeeded or failed. It is up to the caller to call | 3723 or not forget succeeded or failed. It is up to the caller to call |
| 3724 GetNetworkInfo to check the updated remembered_wifi list to verify the | 3724 GetNetworkInfo to check the updated remembered_wifi list to verify the |
| 3725 service has been removed. | 3725 service has been removed. |
| 3726 | 3726 |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4715 successful = result.wasSuccessful() | 4715 successful = result.wasSuccessful() |
| 4716 if not successful: | 4716 if not successful: |
| 4717 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 4717 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 4718 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 4718 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 4719 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 4719 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 4720 sys.exit(not successful) | 4720 sys.exit(not successful) |
| 4721 | 4721 |
| 4722 | 4722 |
| 4723 if __name__ == '__main__': | 4723 if __name__ == '__main__': |
| 4724 Main() | 4724 Main() |
| OLD | NEW |