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.
5 import pyauto_functional
# Must come before pyauto (and thus, policy_base).
9 class ChromeosRetailMode(policy_base
.PolicyTestBase
):
10 """Tests for retail mode."""
12 # The inherited setUp() method fakes enterprise enrollment. Setting the mode
13 # to 'kiosk' causes enrollment into retail mode instead of the default
18 def ShouldOOBESkipToLogin(self
):
19 # There's no OOBE to skip.
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'));
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));
40 """Tests retail mode login."""
41 self
.assertTrue(self
._CheckOnRetailModeLoginScreen
(),
42 msg
='Expected to be on the retail mode login screen.')
45 self
.assertTrue(self
.GetLoginInfo()['is_logged_in'],
46 msg
='Expected to be logged in.')
50 if __name__
== '__main__':
51 pyauto_functional
.Main()