OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 | 9 |
10 import pyauto_functional # Must be imported before pyauto | 10 import pyauto_functional # Must be imported before pyauto |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 msg='/home/chronos/__magic__ did not persist across login sessions') | 214 msg='/home/chronos/__magic__ did not persist across login sessions') |
215 self.assertTrue(os.path.exists('/home/chronos/user/__magic__'), | 215 self.assertTrue(os.path.exists('/home/chronos/user/__magic__'), |
216 msg='/home/chronos/user/__magic__ did not persist across ' | 216 msg='/home/chronos/user/__magic__ did not persist across ' |
217 'login sessions') | 217 'login sessions') |
218 | 218 |
219 _VerifyProfile() | 219 _VerifyProfile() |
220 self.Logout() | 220 self.Logout() |
221 self.testGoodLogin() # Re-login with same account. | 221 self.testGoodLogin() # Re-login with same account. |
222 _VerifyProfile() | 222 _VerifyProfile() |
223 | 223 |
224 class CroshLoginTest(pyauto.PyUITest): | |
225 """Tests for crosh in guest mode.""" | |
226 def setUp(self): | |
Nirnimesh
2012/07/25 07:03:45
Do not create a separate class so that you can reu
tturchetto
2012/07/26 22:44:28
Done.
| |
227 pyauto.PyUITest.setUp(self) | |
228 if self.GetLoginInfo()['is_logged_in']: | |
229 self.Logout() | |
230 | |
231 def testGuestCrosh(self): | |
232 """Test we can use crosh in guest mode.""" | |
Nirnimesh
2012/07/25 07:03:45
Test we can use -> Verify
tturchetto
2012/07/26 22:44:28
Done.
| |
233 self.LoginAsGuest() | |
234 login_info = self.GetLoginInfo() | |
235 self.assertTrue(login_info['is_logged_in'], msg='Not logged in at all.') | |
236 self.assertTrue(login_info['is_guest'], msg='Not logged in as guest.') | |
237 for _ in range(self.GetBrowserWindowCount()): | |
238 self.CloseBrowserWindow(0) | |
239 | |
240 self.assertEqual(0, self.GetBrowserWindowCount()) | |
Nirnimesh
2012/07/25 07:03:45
hereafter this test is very similar to the test in
tturchetto
2012/07/26 22:44:28
Done.
| |
241 self.OpenCrosh() | |
242 self.assertEqual(1, self.GetBrowserWindowCount()) | |
243 self.assertEqual(1, self.GetTabCount(),msg='Could not open crosh') | |
244 self.assertEqual('crosh', self.GetActiveTabTitle()) | |
245 | |
246 # Verify crosh prompt. | |
247 self.WaitForHtermText(text='crosh> ', | |
248 msg='Could not find "crosh> " prompt') | |
249 self.assertTrue( | |
250 self.GetHtermRowsText(start=0, end=2).endswith('crosh> '), | |
251 msg='Could not find "crosh> " prompt') | |
252 | |
253 # Run a crosh command. | |
254 self.SendKeysToHterm('help\\n') | |
255 self.WaitForHtermText(text='help_advanced', | |
256 msg='Could not find "help_advanced" in help output.') | |
257 | |
258 # Exit crosh and close tab. | |
259 self.SendKeysToHterm('exit\\n') | |
260 self.WaitForHtermText(text='command crosh completed with exit code 0', | |
261 msg='Could not exit crosh.') | |
262 self.Logout() | |
Nirnimesh
2012/07/25 07:03:45
remove. Not necessary. Line 30 ensures that we get
tturchetto
2012/07/26 22:44:28
Done.
| |
263 | |
224 | 264 |
225 if __name__ == '__main__': | 265 if __name__ == '__main__': |
226 pyauto_functional.Main() | 266 pyauto_functional.Main() |
OLD | NEW |