| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import pyauto_functional | |
| 7 import chromeos_network # pyauto_functional must come before chromeos_network | |
| 8 | |
| 9 | |
| 10 class ChromeosWifiCompliance(chromeos_network.PyNetworkUITest): | |
| 11 """Tests for ChromeOS wifi complaince. | |
| 12 | |
| 13 These tests should be run within vacinity of the power strip where the wifi | |
| 14 routers are attached. | |
| 15 """ | |
| 16 | |
| 17 def _BasicConnectRouterCompliance(self, router_name): | |
| 18 """Generic basic test routine for connecting to a router. | |
| 19 | |
| 20 Args: | |
| 21 router_name: The name of the router. | |
| 22 """ | |
| 23 self.InitWifiPowerStrip() | |
| 24 router = self.GetRouterConfig(router_name) | |
| 25 self.RouterPower(router_name, True) | |
| 26 | |
| 27 # If the wifi network is expected to be invisible, the following | |
| 28 # line should timeout which is expected. | |
| 29 wifi_visible = self.WaitUntilWifiNetworkAvailable(router['ssid'], | |
| 30 is_hidden=router.get('hidden')) | |
| 31 | |
| 32 # Note, we expect wifi_visible and 'hidden' status to be opposites. | |
| 33 # The test fails if the network visibility is not as expected. | |
| 34 if wifi_visible == router.get('hidden', False): | |
| 35 self.fail('We expected wifi network "%s" to be %s, but it was not.' % | |
| 36 (router['ssid'], | |
| 37 {True: 'hidden', False: 'visible'}[router.get('hidden', | |
| 38 False)])) | |
| 39 | |
| 40 # Verify connect did not have any errors. | |
| 41 error = self.ConnectToWifiRouter(router_name) | |
| 42 self.assertFalse(error, 'Failed to connect to wifi network %s. ' | |
| 43 'Reason: %s.' % (router['ssid'], error)) | |
| 44 | |
| 45 # Verify the network we connected to. | |
| 46 ssid = self.GetConnectedWifi() | |
| 47 self.assertEqual(ssid, router['ssid'], | |
| 48 'Did not successfully connect to wifi network %s.' % ssid) | |
| 49 | |
| 50 self.DisconnectFromWifiNetwork() | |
| 51 | |
| 52 def testConnectBelkinG(self): | |
| 53 """Test connecting to the Belkin G router.""" | |
| 54 self._BasicConnectRouterCompliance('Belkin_G') | |
| 55 | |
| 56 def testConnectBelkinNPlus(self): | |
| 57 """Test connecting to the Belkin N+ router.""" | |
| 58 self._BasicConnectRouterCompliance('Belkin_N+') | |
| 59 | |
| 60 def testConnectDLinkN150(self): | |
| 61 """Test connecting to the D-Link N150 router.""" | |
| 62 self._BasicConnectRouterCompliance('D-Link_N150') | |
| 63 | |
| 64 def testConnectLinksysE3000(self): | |
| 65 """Test connecting to the Linksys E3000 router. | |
| 66 | |
| 67 The LinksysE3000 supports broadcasting of up to 2 SSID's. | |
| 68 This test will try connecting to each of them one at a time. | |
| 69 """ | |
| 70 self._BasicConnectRouterCompliance('LinksysE3000') | |
| 71 self._BasicConnectRouterCompliance('LinksysE3000_2') | |
| 72 | |
| 73 def testConnectLinksysWRT54G2(self): | |
| 74 """Test connecting to the Linksys WRT54G2 router.""" | |
| 75 self._BasicConnectRouterCompliance('Linksys_WRT54G2') | |
| 76 | |
| 77 def testConnectLinksysWRT54GL(self): | |
| 78 """Test connecting to the LinksysWRT54GL router.""" | |
| 79 self._BasicConnectRouterCompliance('Linksys_WRT54GL') | |
| 80 | |
| 81 def testConnectNetgearN300(self): | |
| 82 """Test connecting to the Netgear N300 router.""" | |
| 83 self._BasicConnectRouterCompliance('Netgear_N300') | |
| 84 | |
| 85 def testConnectNetgearWGR614(self): | |
| 86 """Test connecting to the Netgear WGR 614 router.""" | |
| 87 self._BasicConnectRouterCompliance('Netgear_WGR614') | |
| 88 | |
| 89 def testConnectNfiniti(self): | |
| 90 """Test connecting to the Nfiniti router.""" | |
| 91 self._BasicConnectRouterCompliance('Nfiniti') | |
| 92 | |
| 93 def testConnectSMCWBR145(self): | |
| 94 """Test connecting to the SMC WBR 145 router.""" | |
| 95 self._BasicConnectRouterCompliance('SMC_WBR145') | |
| 96 | |
| 97 def testConnectTrendnet_639gr(self): | |
| 98 """Test connecting to the Trendnet 639gr router. | |
| 99 | |
| 100 The LinksysE3000 supports broadcasting of up to 4 SSID's. | |
| 101 This test will try connecting to each of them one at a time. | |
| 102 """ | |
| 103 self._BasicConnectRouterCompliance('Trendnet_639gr') | |
| 104 self._BasicConnectRouterCompliance('Trendnet_639gr_2') | |
| 105 self._BasicConnectRouterCompliance('Trendnet_639gr_3') | |
| 106 self._BasicConnectRouterCompliance('Trendnet_639gr_4') | |
| 107 | |
| 108 | |
| 109 if __name__ == '__main__': | |
| 110 pyauto_functional.Main() | |
| OLD | NEW |