Index: chrome/test/pyautolib/pyauto.py |
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py |
index 9497f4298e204c8c925abcbf105b13e010400759..a1de2975d0071f9189eb057334f6624bbcedb8d2 100644 |
--- a/chrome/test/pyautolib/pyauto.py |
+++ b/chrome/test/pyautolib/pyauto.py |
@@ -2506,6 +2506,89 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase): |
cmd_dict = { 'command': 'NetworkScan' } |
self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
+ PROXY_TYPE_DIRECT = 1 |
+ PROXY_TYPE_MANUAL = 2 |
+ PROXY_TYPE_PAC = 3 |
+ |
+ def GetProxySettings(self): |
+ """Get current proxy settings. |
+ |
+ Returns: |
+ A dictionary. See SetProxySetting() below |
+ for the full list of possible dictionary keys. |
+ |
+ Samples: |
+ { u'ignorelist': [], |
+ u'single': False, |
stanleyw
2011/04/04 22:13:27
For error throwing, type as a string instead of in
dtu
2011/04/04 22:48:57
Added GetProxyTypeName(). Hope that is sufficient.
|
+ u'type': 1} |
+ |
+ { u'ignorelist': [u'www.example.com', u'www.example2.com'], |
+ u'single': True, |
+ u'singlehttp': u'24.27.78.152', |
+ u'singlehttpport': 1728, |
+ u'type': 2} |
+ |
+ { u'ignorelist': [], |
+ u'pacurl': u'http://example.com/config.pac', |
+ u'single': False, |
+ u'type': 3} |
+ |
+ Raises: |
+ pyauto_errors.JSONInterfaceError if the automation call returns an error. |
+ """ |
+ cmd_dict = { 'command': 'GetProxySettings' } |
+ return self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
+ |
+ def SetProxySetting(self, key, value): |
+ """Set a proxy setting. |
+ |
+ Valid settings are: |
+ 'type' : int - Type of proxy. Should be one of: |
Nirnimesh
2011/04/04 21:38:27
remove the space before :
Repeat below
dtu
2011/04/04 22:48:57
Done.
|
+ PROXY_TYPE_DIRECT, PROXY_TYPE_MANUAL, PROXY_TYPE_PAC. |
+ 'ignorelist' : list - The list of hosts and domains to ignore. |
+ |
+ These settings set 'type' to PROXY_TYPE_MANUAL: |
+ 'single' : boolean - Whether to use the same proxy for all protocols. |
+ |
+ These settings set 'single' to True: |
+ 'singlehttp' : string - If single is true, the proxy address to use. |
+ 'singlehttpport' : int - If single is true, the proxy port to use. |
+ |
+ These settings set 'single' to False: |
+ 'httpurl' : string - HTTP proxy address. |
+ 'httpport' : int - HTTP proxy port. |
+ 'httpsurl' : string - Secure HTTP proxy address. |
+ 'httpsport' : int - Secure HTTP proxy port. |
+ 'ftpurl' : string - FTP proxy address. |
+ 'ftpport' : int - FTP proxy port. |
+ 'socks' : string - SOCKS host address. |
+ 'socksport' : int - SOCKS host port. |
+ |
+ This setting sets 'type' to PROXY_TYPE_PAC: |
+ 'pacurl' : string - Autoconfiguration URL. |
+ |
+ Examples: |
+ # Sets direct internet connection, no proxy. |
+ self.SetProxySetting('type', self.PROXY_TYPE_DIRECT) |
+ |
+ # Sets manual proxy configuration, same proxy for all protocols. |
+ self.SetProxySetting('singlehttp', '24.27.78.152') |
+ self.SetProxySetting('singlehttpport', 1728) |
+ self.SetProxySetting('ignorelist', ['www.example.com', 'example2.com']) |
+ |
+ # Sets automatic proxy configuration with the specified PAC url. |
+ self.SetProxySetting('pacurl', 'http://example.com/config.pac') |
+ |
+ Raises: |
+ pyauto_errors.JSONInterfaceError if the automation call returns an error. |
+ """ |
+ cmd_dict = { |
+ 'command': 'SetProxySetting', |
+ 'key': key, |
+ 'value': value, |
+ } |
+ return self._GetResultFromJSONRequest(cmd_dict, windex=-1) |
+ |
def ConnectToWifiNetwork(self, service_path, |
password='', identity='', certpath=''): |
"""Connect to a wifi network by its service path. |