OLD | NEW |
| (Empty) |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import pyauto_functional # Must come before pyauto (and thus, policy_base). | |
6 import policy_base | |
7 | |
8 | |
9 class ChromeosRetailMode(policy_base.PolicyTestBase): | |
10 """Tests for retail mode.""" | |
11 | |
12 # The inherited setUp() method fakes enterprise enrollment. Setting the mode | |
13 # to 'kiosk' causes enrollment into retail mode instead of the default | |
14 # enterprise mode. | |
15 mode = 'kiosk' | |
16 machine_id = 'KIOSK' | |
17 | |
18 def ShouldOOBESkipToLogin(self): | |
19 # There's no OOBE to skip. | |
20 return False | |
21 | |
22 def _CheckOnRetailModeLoginScreen(self): | |
23 """Checks that the retail mode login screen is visible.""" | |
24 return self.ExecuteJavascriptInOOBEWebUI( | |
25 """window.domAutomationController.send( | |
26 !!document.getElementById('demo-login-text')); | |
27 """) | |
28 | |
29 def Login(self): | |
30 """Login to retail mode by simulating a mouse click.""" | |
31 self.ExecuteJavascriptInOOBEWebUI( | |
32 """var event = document.createEvent("MouseEvent"); | |
33 event.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, | |
34 false, false, false, false, 0, null); | |
35 window.domAutomationController.send( | |
36 document.getElementById('page').dispatchEvent(event)); | |
37 """) | |
38 | |
39 def testLogin(self): | |
40 """Tests retail mode login.""" | |
41 self.assertTrue(self._CheckOnRetailModeLoginScreen(), | |
42 msg='Expected to be on the retail mode login screen.') | |
43 | |
44 self.Login() | |
45 self.assertTrue(self.GetLoginInfo()['is_logged_in'], | |
46 msg='Expected to be logged in.') | |
47 self.Logout() | |
48 | |
49 | |
50 if __name__ == '__main__': | |
51 pyauto_functional.Main() | |
OLD | NEW |