Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 6737035: Proxy settings automation hooks and related proxy settings fixes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial commit. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 """Causes ChromeOS to scan for available wifi networks. 2499 """Causes ChromeOS to scan for available wifi networks.
2500 2500
2501 Blocks until scanning is complete. 2501 Blocks until scanning is complete.
2502 2502
2503 Raises: 2503 Raises:
2504 pyauto_errors.JSONInterfaceError if the automation call returns an error. 2504 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2505 """ 2505 """
2506 cmd_dict = { 'command': 'NetworkScan' } 2506 cmd_dict = { 'command': 'NetworkScan' }
2507 self._GetResultFromJSONRequest(cmd_dict, windex=-1) 2507 self._GetResultFromJSONRequest(cmd_dict, windex=-1)
2508 2508
2509 PROXY_TYPE_DIRECT = 1
2510 PROXY_TYPE_MANUAL = 2
2511 PROXY_TYPE_PAC = 3
2512
2513 def GetProxySettings(self):
2514 """Get current proxy settings.
2515
2516 Returns:
2517 A dictionary. See SetProxySetting() below
2518 for the full list of possible dictionary keys.
2519
2520 Samples:
2521 { u'ignorelist': [],
2522 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.
2523 u'type': 1}
2524
2525 { u'ignorelist': [u'www.example.com', u'www.example2.com'],
2526 u'single': True,
2527 u'singlehttp': u'24.27.78.152',
2528 u'singlehttpport': 1728,
2529 u'type': 2}
2530
2531 { u'ignorelist': [],
2532 u'pacurl': u'http://example.com/config.pac',
2533 u'single': False,
2534 u'type': 3}
2535
2536 Raises:
2537 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2538 """
2539 cmd_dict = { 'command': 'GetProxySettings' }
2540 return self._GetResultFromJSONRequest(cmd_dict, windex=-1)
2541
2542 def SetProxySetting(self, key, value):
2543 """Set a proxy setting.
2544
2545 Valid settings are:
2546 '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.
2547 PROXY_TYPE_DIRECT, PROXY_TYPE_MANUAL, PROXY_TYPE_PAC.
2548 'ignorelist' : list - The list of hosts and domains to ignore.
2549
2550 These settings set 'type' to PROXY_TYPE_MANUAL:
2551 'single' : boolean - Whether to use the same proxy for all protocols.
2552
2553 These settings set 'single' to True:
2554 'singlehttp' : string - If single is true, the proxy address to use.
2555 'singlehttpport' : int - If single is true, the proxy port to use.
2556
2557 These settings set 'single' to False:
2558 'httpurl' : string - HTTP proxy address.
2559 'httpport' : int - HTTP proxy port.
2560 'httpsurl' : string - Secure HTTP proxy address.
2561 'httpsport' : int - Secure HTTP proxy port.
2562 'ftpurl' : string - FTP proxy address.
2563 'ftpport' : int - FTP proxy port.
2564 'socks' : string - SOCKS host address.
2565 'socksport' : int - SOCKS host port.
2566
2567 This setting sets 'type' to PROXY_TYPE_PAC:
2568 'pacurl' : string - Autoconfiguration URL.
2569
2570 Examples:
2571 # Sets direct internet connection, no proxy.
2572 self.SetProxySetting('type', self.PROXY_TYPE_DIRECT)
2573
2574 # Sets manual proxy configuration, same proxy for all protocols.
2575 self.SetProxySetting('singlehttp', '24.27.78.152')
2576 self.SetProxySetting('singlehttpport', 1728)
2577 self.SetProxySetting('ignorelist', ['www.example.com', 'example2.com'])
2578
2579 # Sets automatic proxy configuration with the specified PAC url.
2580 self.SetProxySetting('pacurl', 'http://example.com/config.pac')
2581
2582 Raises:
2583 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2584 """
2585 cmd_dict = {
2586 'command': 'SetProxySetting',
2587 'key': key,
2588 'value': value,
2589 }
2590 return self._GetResultFromJSONRequest(cmd_dict, windex=-1)
2591
2509 def ConnectToWifiNetwork(self, service_path, 2592 def ConnectToWifiNetwork(self, service_path,
2510 password='', identity='', certpath=''): 2593 password='', identity='', certpath=''):
2511 """Connect to a wifi network by its service path. 2594 """Connect to a wifi network by its service path.
2512 2595
2513 Blocks until connection succeeds or fails. 2596 Blocks until connection succeeds or fails.
2514 2597
2515 Returns: 2598 Returns:
2516 A tuple. 2599 A tuple.
2517 The first element is True on success and False on failure. 2600 The first element is True on success and False on failure.
2518 The second element is None on success or an error string on failure. 2601 The second element is None on success or an error string on failure.
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2937 if self._options.verbose: 3020 if self._options.verbose:
2938 verbosity = 2 3021 verbosity = 2
2939 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) 3022 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite)
2940 del loaded_tests # Need to destroy test cases before the suite 3023 del loaded_tests # Need to destroy test cases before the suite
2941 del pyauto_suite 3024 del pyauto_suite
2942 sys.exit(not result.wasSuccessful()) 3025 sys.exit(not result.wasSuccessful())
2943 3026
2944 3027
2945 if __name__ == '__main__': 3028 if __name__ == '__main__':
2946 Main() 3029 Main()
OLDNEW
« chrome/test/functional/chromeos_wifi.py ('K') | « chrome/test/functional/chromeos_wifi.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698