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 |
11 import pyauto | 11 import pyauto |
12 import pyauto_errors | 12 import pyauto_errors |
| 13 import test_utils |
13 | 14 |
14 | 15 |
15 sys.path.append('/usr/local') # To make autotest libs importable. | 16 sys.path.append('/usr/local') # To make autotest libs importable. |
16 from autotest.cros import cros_ui | 17 from autotest.cros import cros_ui |
17 from autotest.cros import cryptohome | 18 from autotest.cros import cryptohome |
18 | 19 |
19 | 20 |
20 class ChromeosLogin(pyauto.PyUITest): | 21 class ChromeosLogin(pyauto.PyUITest): |
21 """TestCases for Logging into ChromeOS.""" | 22 """TestCases for Logging into ChromeOS.""" |
22 | 23 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 msg='/home/chronos/__magic__ did not persist across login sessions') | 215 msg='/home/chronos/__magic__ did not persist across login sessions') |
215 self.assertTrue(os.path.exists('/home/chronos/user/__magic__'), | 216 self.assertTrue(os.path.exists('/home/chronos/user/__magic__'), |
216 msg='/home/chronos/user/__magic__ did not persist across ' | 217 msg='/home/chronos/user/__magic__ did not persist across ' |
217 'login sessions') | 218 'login sessions') |
218 | 219 |
219 _VerifyProfile() | 220 _VerifyProfile() |
220 self.Logout() | 221 self.Logout() |
221 self.testGoodLogin() # Re-login with same account. | 222 self.testGoodLogin() # Re-login with same account. |
222 _VerifyProfile() | 223 _VerifyProfile() |
223 | 224 |
| 225 def testGuestCrosh(self): |
| 226 """Verify we can use crosh in guest mode.""" |
| 227 self.LoginAsGuest() |
| 228 login_info = self.GetLoginInfo() |
| 229 self.assertTrue(login_info['is_logged_in'], msg='Not logged in at all.') |
| 230 self.assertTrue(login_info['is_guest'], msg='Not logged in as guest.') |
| 231 for _ in range(self.GetBrowserWindowCount()): |
| 232 self.CloseBrowserWindow(0) |
| 233 test_utils.OpenCroshVerification(self) |
| 234 |
| 235 # Verify crosh prompt. |
| 236 self.WaitForHtermText(text='crosh> ', |
| 237 msg='Could not find "crosh> " prompt') |
| 238 self.assertTrue( |
| 239 self.GetHtermRowsText(start=0, end=2).endswith('crosh> '), |
| 240 msg='Could not find "crosh> " prompt') |
| 241 |
| 242 # Run a crosh command. |
| 243 self.SendKeysToHterm('help\\n') |
| 244 self.WaitForHtermText(text='help_advanced', |
| 245 msg='Could not find "help_advanced" in help output.') |
| 246 |
| 247 # Exit crosh and close tab. |
| 248 self.SendKeysToHterm('exit\\n') |
| 249 self.WaitForHtermText(text='command crosh completed with exit code 0', |
| 250 msg='Could not exit crosh.') |
| 251 |
224 | 252 |
225 if __name__ == '__main__': | 253 if __name__ == '__main__': |
226 pyauto_functional.Main() | 254 pyauto_functional.Main() |
OLD | NEW |