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

Unified Diff: functional/chromeos_wifi_functional.py

Issue 8586013: Added 4 new pyauto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: '' Created 9 years, 1 month 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: functional/chromeos_wifi_functional.py
===================================================================
--- functional/chromeos_wifi_functional.py (revision 110222)
+++ functional/chromeos_wifi_functional.py (working copy)
@@ -17,10 +17,14 @@
routers are attached.
"""
- def _LoginDevice(self):
- """Logs into the device and cleans up flimflam profile."""
+ def _LoginDevice(self, test_account='test_google_account'):
+ """Logs into the device and cleans up flimflam profile.
+
+ Args:
+ test_account: The account used to login to the device.
+ """
if not self.GetLoginInfo()['is_logged_in']:
- credentials = self.GetPrivateInfo()['test_google_account']
+ credentials = self.GetPrivateInfo()[test_account]
self.Login(credentials['username'], credentials['password'])
login_info = self.GetLoginInfo()
self.assertTrue(login_info['is_logged_in'], msg='Login failed.')
@@ -58,6 +62,33 @@
is_hidden=router.get('hidden'))
return router
+ def _VerifyIfConnectedToNetwork(self, network_ssid, status='Online state'):
+ """Verify if we are connected to the network.
+
+ The test calling this function will fail for one of these three reasons:
+ 1. The server path for the SSID is not found.
+ 2. If we are not connected to the network.
+ 3. If we did not find the network in the wifi_networks list.
+
+ Args:
+ newtork_ssid: The network to which we are supposed to be connected to.
+ status: The status that we expect the network to have, by default it
+ would be 'Online state'.
+ """
+ service_path = self.GetServicePath(network_ssid)
+ self.assertTrue(service_path is not None,
+ msg='Could not find a service path for the given ssid %s.' %
+ network_ssid)
+ for path in self.NetworkScan()['wifi_networks']:
+ if path == service_path:
+ self.assertTrue(
+ self.NetworkScan()['wifi_networks'][path]['status'] == status,
+ msg='Not connected to the network %s.' % network_ssid)
dennis_jeffrey 2011/11/22 00:32:23 Maybe this error should be something like "Unexpec
deepakg 2011/11/22 01:06:22 Done.
+ break;
+ else:
+ self.assertTrue(False, msg='Did not find the network %s in the'
dennis_jeffrey 2011/11/22 00:32:23 You can just directly do a "self.fail" here.
dennis_jeffrey 2011/11/22 00:32:23 add a space right after 'the' at the end of this s
deepakg 2011/11/22 01:06:22 Done.
deepakg 2011/11/22 01:06:22 Done.
+ 'wifi_networks list.' % network_ssid)
+
def testConnectShareEncryptedNetwork(self):
"""A shared encrypted network can connect and is remembered.
@@ -96,6 +127,81 @@
self.assertFalse(service_path in self.GetNetworkInfo()['remembered_wifi'],
'Connected wifi was not removed from the remembered list.')
+ def testConnectToSharedOpenNetwork(self):
+ """Can connect to a shared open network.
+ Verify that the connected network is in the remembered network list
+ for all the users.
+ """
+ router_name = 'Trendnet_639gr_4'
+ self._LoginDevice()
+ router = self._SetupRouter(router_name)
+ error = self.ConnectToWifiRouter(router_name)
+ self.assertFalse(error, msg='Failed to connect to wifi network %s. '
+ 'Reason: %s.' % (router['ssid'], error))
+ service_path = self.GetServicePath(router['ssid'])
+ self.assertTrue(service_path in self.GetNetworkInfo()['remembered_wifi'],
+ msg='Open wifi is not remembered for the current user.')
+ self.Logout()
+ self._LoginDevice(test_account='test_google_account_2')
+ self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
+ msg='Open network is not shared with other users.')
+
+ def testConnectToSharedHiddenNetwork(self):
+ """Can connect to shared hidden network and verify that it's shared."""
+ router_name = "Netgear_WGR614"
dennis_jeffrey 2011/11/22 00:32:23 prefer single quotes over double quotes when defin
deepakg 2011/11/22 01:06:22 Done.
+ self._LoginDevice()
+ router = self._SetupRouter(router_name)
+ error = self.ConnectToWifiRouter(router_name)
+ self.assertFalse(error, msg='Failed to connect to hidden network %s. '
+ 'Reason: %s.' % (router['ssid'], error))
+ service_path = self.GetServicePath(router['ssid'])
+ self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
+ msg='Hidden network is not added to the remembered list.')
+ self.Logout()
+ self._LoginDevice(test_account='test_google_account_2')
+ self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
+ msg='Shared hidden network is not in other user\'s '
+ 'remembered list.')
+
+ def testConnectToNonSharedHiddenNetwork(self):
+ """Can connect to a non-shared hidden network.
+
+ Verify that it is not shared with other users.
+ """
+ router_name = "Linksys_WRT54GL"
dennis_jeffrey 2011/11/22 00:32:23 prefer single quotes over double quotes when defin
deepakg 2011/11/22 01:06:22 Done.
+ self._LoginDevice()
+ router = self._SetupRouter(router_name)
+ error = self.ConnectToWifiRouter(router_name, shared=False)
+ self.assertFalse(error, msg='Failed to connect to hidden network %s. '
+ 'Reason: %s.' % (router['ssid'], error))
+ service_path = self.GetServicePath(router['ssid'])
+ self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
+ msg='Hidden network is not added to the remembered list.')
+ self.Logout()
+ self._LoginDevice(test_account='test_google_account_2')
+ self.assertFalse(service_path in self.NetworkScan()['remembered_wifi'],
+ msg='Non-shared hidden network %s is shared.'
+ % router['ssid'])
+
+ def testConnectToEncryptedNetworkInLoginScreen(self):
+ """Can connect to encrypted network in login screen.
+
+ Verify that this network is in the remembered list after login.
+ """
+ router_name = 'Belkin_G'
+ if self.GetLoginInfo()['is_logged_in']:
+ self.Logout()
+ router = self._SetupRouter(router_name)
+ error = self.ConnectToWifiRouter(router_name)
+ self.assertFalse(error, 'Failed to connect to wifi network %s. '
+ 'Reason: %s.' % (router['ssid'], error))
+ service_path = self.GetServicePath(router['ssid'])
+ self._VerifyIfConnectedToNetwork(router['ssid'], 'Connected')
+ self._LoginDevice()
+ self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
+ msg='Network is not added to the remembered list.')
+
+
if __name__ == '__main__':
pyauto_functional.Main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698