Index: chrome/test/pyautolib/chromeos_network.py |
=================================================================== |
--- chrome/test/pyautolib/chromeos_network.py (revision 134390) |
+++ chrome/test/pyautolib/chromeos_network.py (working copy) |
@@ -251,71 +251,6 @@ |
self.TurnOffAllRouters = self._wifi_power_strip.TurnOffAllRouters |
self.GetRouterConfig = self._wifi_power_strip.GetRouterConfig |
- def WaitUntilWifiNetworkAvailable(self, ssid, timeout=60, is_hidden=False): |
- """Waits until the given network is available. |
- |
- Routers that are just turned on may take up to 1 minute upon turning them |
- on to broadcast their SSID. |
- |
- Args: |
- ssid: SSID of the service we want to connect to. |
- timeout: timeout (in seconds) |
- |
- Raises: |
- Exception if timeout duration has been hit before wifi router is seen. |
- |
- Returns: |
- True, when the wifi network is seen within the timout period. |
- False, otherwise. |
- """ |
- def _GotWifiNetwork(): |
- # Returns non-empty array if desired SSID is available. |
- try: |
- return [wifi for wifi in |
- self.NetworkScan().get('wifi_networks', {}).values() |
- if wifi.get('name') == ssid] |
- except pyauto_errors.JSONInterfaceError: |
- # Temporary fix until crosbug.com/14174 is fixed. |
- # NetworkScan is only used in updating the list of networks so errors |
- # thrown by it are not critical to the results of wifi tests that use |
- # this method. |
- return False |
- |
- # The hidden AP's will always be on, thus we will assume it is ready to |
- # connect to. |
- if is_hidden: |
- return bool(_GotWifiNetwork()) |
- |
- return self.WaitUntil(_GotWifiNetwork, timeout=timeout, retry_sleep=1) |
- |
- def GetConnectedWifi(self): |
- """Returns the SSID of the currently connected wifi network. |
- |
- Returns: |
- The SSID of the connected network or None if we're not connected. |
- """ |
- service_list = self.GetNetworkInfo() |
- connected_service_path = service_list.get('connected_wifi') |
- if 'wifi_networks' in service_list and \ |
- connected_service_path in service_list['wifi_networks']: |
- return service_list['wifi_networks'][connected_service_path]['name'] |
- |
- def GetServicePath(self, ssid): |
- """Returns the service path associated with an SSID. |
- |
- Args: |
- ssid: String defining the SSID we are searching for. |
- |
- Returns: |
- The service path or None if SSID does not exist. |
- """ |
- service_list = self.GetNetworkInfo() |
- service_list = service_list.get('wifi_networks', []) |
- for service_path, service_obj in service_list.iteritems(): |
- if service_obj['name'] == ssid: |
- return service_path |
- return None |
- |
def ConnectToWifiRouter(self, router_name, shared=True): |
"""Connects to a router by name. |