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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
dennis_jeffrey 2011/11/17 02:38:25 Please modify the description of this CL so that i
deepakg 2011/11/17 23:21:15 Done.
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 7
8 import pyauto_functional 8 import pyauto_functional
9 import chromeos_network # pyauto_functional must come before chromeos_network 9 import chromeos_network # pyauto_functional must come before chromeos_network
10 import pyauto_utils 10 import pyauto_utils
11 11
12 12
13 class ChromeosWifiFunctional(chromeos_network.PyNetworkUITest): 13 class ChromeosWifiFunctional(chromeos_network.PyNetworkUITest):
14 """Tests for ChromeOS wifi functionality. 14 """Tests for ChromeOS wifi functionality.
15 15
16 These tests should be run within vacinity of the power strip where the wifi 16 These tests should be run within vacinity of the power strip where the wifi
17 routers are attached. 17 routers are attached.
18 """ 18 """
19 19
20 def _LoginDevice(self): 20 def _LoginDevice(self, test_account='test_google_account'):
21 """Logs into the device and cleans up flimflam profile.""" 21 """Logs into the device and cleans up flimflam profile."""
dennis_jeffrey 2011/11/17 02:38:25 Add an "Args:" section to this docstring that desc
deepakg 2011/11/17 23:21:15 Done.
22 if not self.GetLoginInfo()['is_logged_in']: 22 if not self.GetLoginInfo()['is_logged_in']:
23 credentials = self.GetPrivateInfo()['test_google_account'] 23 credentials = self.GetPrivateInfo()[test_account]
24 self.Login(credentials['username'], credentials['password']) 24 self.Login(credentials['username'], credentials['password'])
25 login_info = self.GetLoginInfo() 25 login_info = self.GetLoginInfo()
26 self.assertTrue(login_info['is_logged_in'], msg='Login failed.') 26 self.assertTrue(login_info['is_logged_in'], msg='Login failed.')
27 27
28 ff_dir = '/home/chronos/user/flimflam' 28 ff_dir = '/home/chronos/user/flimflam'
29 self.assertTrue(os.path.isdir(ff_dir), 'User is logged in but user ' 29 self.assertTrue(os.path.isdir(ff_dir), 'User is logged in but user '
30 'flimflam profile is not present.') 30 'flimflam profile is not present.')
31 31
32 # Clean up the items in the flimflam profile directory. 32 # Clean up the items in the flimflam profile directory.
33 for item in os.listdir(ff_dir): 33 for item in os.listdir(ff_dir):
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 error = self.ConnectToWifiRouter(router_name, shared=False) 89 error = self.ConnectToWifiRouter(router_name, shared=False)
90 self.assertFalse(error, 'Failed to connect to wifi network %s. ' 90 self.assertFalse(error, 'Failed to connect to wifi network %s. '
91 'Reason: %s.' % (router['ssid'], error)) 91 'Reason: %s.' % (router['ssid'], error))
92 service_path = self.GetServicePath(router['ssid']) 92 service_path = self.GetServicePath(router['ssid'])
93 self.assertTrue(service_path in self.GetNetworkInfo()['remembered_wifi'], 93 self.assertTrue(service_path in self.GetNetworkInfo()['remembered_wifi'],
94 'Connected wifi was not added to the remembered list.') 94 'Connected wifi was not added to the remembered list.')
95 self.ForgetWifiNetwork(service_path) 95 self.ForgetWifiNetwork(service_path)
96 self.assertFalse(service_path in self.GetNetworkInfo()['remembered_wifi'], 96 self.assertFalse(service_path in self.GetNetworkInfo()['remembered_wifi'],
97 'Connected wifi was not removed from the remembered list.') 97 'Connected wifi was not removed from the remembered list.')
98 98
99 def testConnectToNonSharedOpenNetwork(self):
100 """Can connect to a shared open network and are connected to this
dennis_jeffrey 2011/11/17 02:38:25 'shared' --> 'non-shared'
deepakg 2011/11/17 23:21:15 Done.
101 even after logout.
dennis_jeffrey 2011/11/17 02:38:25 The first line of the docstring should be a 1-line
deepakg 2011/11/17 23:21:15 Done.
102 """
103 router_name = 'Trendnet_639gr_4'
104 self._LoginDevice()
105 router = self._SetupRouter(router_name)
106 error = self.ConnectToWifiRouter(router_name, shared=False)
107 self.assertFalse(error, msg='Failed to connect to wifi network %s. '
108 'Reason: %s.' % (router['ssid'], error))
109 service_path = self.GetServicePath(router['ssid'])
110 self.assertTrue(service_path in self.GetNetworkInfo()['remembered_wifi'],
111 msg='Open wifi is not remembered for the current user.')
112 self.Logout()
113 for path in self.GetNetworkInfo()['wifi_networks']:
114 if path == service_path:
dennis_jeffrey 2011/11/17 02:38:25 If this condition is never true, the test will sti
deepakg 2011/11/17 23:21:15 Done.
115 self.assertTrue(self.GetNetworkInfo()['wifi_networks'][path]['status']
116 == 'Association', msg='We are not connected to the'
117 ' shared open network after logout.')
dennis_jeffrey 2011/11/17 02:38:25 I think it would be a little cleaner to indent lik
dennis_jeffrey 2011/11/17 02:38:25 'shared' --> 'non-shared'
deepakg 2011/11/17 23:21:15 This will push the characters beyond the 80 charac
deepakg 2011/11/17 23:21:15 Done.
118 break;
119
120 def testConnectToSharedOpenNetwork(self):
121 """Can connect to a shared open network and it is in the remembered
122 network list for all the users.
dennis_jeffrey 2011/11/17 02:38:25 The first line of the docstring should fit onto a
deepakg 2011/11/17 23:21:15 Done.
123 """
124 router_name = 'Trendnet_639gr_4'
125 self._LoginDevice()
126 router = self._SetupRouter(router_name)
127 error = self.ConnectToWifiRouter(router_name, shared=True)
128 self.assertFalse(error, msg='Failed to connect to wifi network %s. '
129 'Reason: %s.' % (router['ssid'], error))
130 service_path = self.GetServicePath(router['ssid'])
131 self.assertTrue(service_path in self.GetNetworkInfo()['remembered_wifi'],
132 msg='Open Wifi is not remembered for the current user.')
133 self.Logout()
134 self._LoginDevice(test_account='test_google_account_2')
135 self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
136 msg='Open network is not shared with other users.')
137
138 def testConnectToSharedHiddenNetwork(self):
139 """Can connect to shared hidden network and verify that its shared."""
dennis_jeffrey 2011/11/17 02:38:25 'its' --> 'it's'
deepakg 2011/11/17 23:21:15 Done.
140 router_name = "Netgear_WGR614"
141 self._LoginDevice()
142 router = self._SetupRouter(router_name)
143 error = self.ConnectToWifiRouter(router_name)
144 self.assertFalse(error, msg='Failed to connect to hidden network %s. '
145 'Reason: %s.' % (router['ssid'], error))
146 service_path = self.GetServicePath(router['ssid'])
147 self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
148 msg='Hidden network is not added to the remembered list.')
149 self.Logout()
150 self._LoginDevice(test_account='test_google_account_2')
151 self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
152 msg='Shared Hidden network is not in other users '
dennis_jeffrey 2011/11/17 02:38:25 'users' --> 'user's'
deepakg 2011/11/17 23:21:15 Done.
153 'remembered list.')
154
155 def testConnectToNonSharedHiddenNetwork(self):
156 """Can connect to a non-shared hidden network and
157 verify that its not shared.
dennis_jeffrey 2011/11/17 02:38:25 'its' --> 'it's'
dennis_jeffrey 2011/11/17 02:38:25 The first line of the docstring should fit onto a
deepakg 2011/11/17 23:21:15 Done.
deepakg 2011/11/17 23:21:15 Done.
158 """
159 router_name = "Linksys_WRT54GL"
160 self._LoginDevice()
161 router = self._SetupRouter(router_name)
162 error = self.ConnectToWifiRouter(router_name, shared=False)
163 self.assertFalse(error, msg='Failed to connect to hidden network %s. '
164 'Reason: %s.' % (router['ssid'], error))
165 service_path = self.GetServicePath(router['ssid'])
166 self.assertTrue(service_path in self.NetworkScan()['remembered_wifi'],
167 msg='Hidden network is not added to the remembered list.')
168 self.Logout()
169 self._LoginDevice(test_account='test_google_account_2')
170 self.assertFalse(service_path in self.NetworkScan()['remembered_wifi'],
171 msg='Non-shared Hidden network is shared.')
172
99 173
100 if __name__ == '__main__': 174 if __name__ == '__main__':
101 pyauto_functional.Main() 175 pyauto_functional.Main()
OLDNEW
« 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