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

Unified Diff: chrome/test/pyautolib/chromeos_network.py

Issue 10264012: Move WaitUntilWifiNetworkAvailable and GetServicePath to pyauto so it can be reached from autotest (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | chrome/test/pyautolib/pyauto.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | chrome/test/pyautolib/pyauto.py » ('j') | chrome/test/pyautolib/pyauto.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698