Index: chrome/test/functional/chromeos_device_policy.py |
diff --git a/chrome/test/functional/chromeos_device_policy.py b/chrome/test/functional/chromeos_device_policy.py |
index 85e6df20fc0996ea9598b050d114aae7b87c14d6..ce1737808ac335a84d92777298ee6d1bab8c9589 100644 |
--- a/chrome/test/functional/chromeos_device_policy.py |
+++ b/chrome/test/functional/chromeos_device_policy.py |
@@ -11,6 +11,15 @@ import policy_base |
class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
"""Tests various ChromeOS device policies.""" |
+ # Cache user credentials for easy lookup. The first user will become the |
+ # owner. |
bartfab (slow)
2012/07/30 08:59:45
Nit: This comment is actually no longer true. Now
|
+ private_info = policy_base.PolicyTestBase.GetPrivateInfo() |
+ credentials = (private_info['prod_enterprise_test_user'], |
+ private_info['prod_enterprise_executive_user'], |
+ private_info['prod_enterprise_sales_user']) |
+ _usernames = [credential['username'] for credential in credentials] |
+ _passwords = [credential['password'] for credential in credentials] |
+ |
def LoginAsGuest(self): |
self.assertFalse(self.GetLoginInfo()['is_logged_in'], |
msg='Expected to be logged out.') |
@@ -31,50 +40,6 @@ class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
self.assertFalse(self.GetLoginInfo()['is_logged_in'], |
msg='Expected to not be logged in.') |
- # TODO(bartfab): Remove this after crosbug.com/20709 is fixed. |
- def TryToDisableLocalStateAutoClearing(self): |
- # Try to disable automatic clearing of the local state. |
- self.TryToDisableLocalStateAutoClearingOnChromeOS() |
- self._local_state_auto_clearing = \ |
- self.IsLocalStateAutoClearingEnabledOnChromeOS() |
- if not self._local_state_auto_clearing: |
- # Prevent the inherited Logout() method from cleaning up /home/chronos |
- # as this also clears the local state. |
- self.set_clear_profile(False) |
- |
- def ExtraChromeFlags(self): |
- """Sets up Chrome to skip OOBE. |
- |
- TODO(bartfab): Ensure OOBE is still skipped when crosbug.com/20709 is fixed. |
- Disabling automatic clearing of the local state has the curious side effect |
- of removing a flag that disables OOBE. This method adds back the flag. |
- """ |
- flags = policy_base.PolicyTestBase.ExtraChromeFlags(self) |
- flags.append('--login-screen=login') |
- return flags |
- |
- def setUp(self): |
- policy_base.PolicyTestBase.setUp(self) |
- # TODO(bartfab): Remove this after crosbug.com/20709 is fixed. |
- self._local_state_auto_clearing = \ |
- self.IsLocalStateAutoClearingEnabledOnChromeOS() |
- |
- # Cache user credentials for easy lookup. The first user will become the |
- # owner. |
- credentials = (self.GetPrivateInfo()['prod_enterprise_test_user'], |
- self.GetPrivateInfo()['prod_enterprise_executive_user'], |
- self.GetPrivateInfo()['prod_enterprise_sales_user']) |
- self._usernames = [credential['username'] for credential in credentials] |
- self._passwords = [credential['password'] for credential in credentials] |
- |
- def tearDown(self): |
- # TODO(bartfab): Remove this after crosbug.com/20709 is fixed. |
- # Try to re-enable automatic clearing of the local state and /home/chronos. |
- if not self._local_state_auto_clearing: |
- self.TryToEnableLocalStateAutoClearingOnChromeOS() |
- self.set_clear_profile(True) |
- policy_base.PolicyTestBase.tearDown(self) |
- |
def _CheckGuestModeAvailableInLoginWindow(self): |
return self.ExecuteJavascriptInOOBEWebUI( |
"""window.domAutomationController.send( |
@@ -113,13 +78,6 @@ class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
self.assertFalse(self._CheckGuestModeAvailableInLoginWindow(), |
msg='Expected guest mode to not be available.') |
- # TODO(bartfab): Remove this after crosbug.com/20709 is fixed. |
- self.TryToDisableLocalStateAutoClearing() |
- if self._local_state_auto_clearing: |
- logging.warn("""Unable to disable local state clearing. Skipping remainder |
- of test.""") |
- return |
- |
# Log in as a regular so that the pod row contains at least one pod and the |
# account picker is shown. |
self.Login(user_index=0, expect_success=True) |
@@ -137,12 +95,6 @@ class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
def testShowUserNamesOnSignin(self): |
"""Checks that the account picker can be enabled/disabled.""" |
- # TODO(bartfab): Remove this after crosbug.com/20709 is fixed. |
- self.TryToDisableLocalStateAutoClearing() |
- if self._local_state_auto_clearing: |
- logging.warn('Unable to disable local state clearing. Skipping test.') |
- return |
- |
# Log in as a regular user so that the pod row contains at least one pod and |
# the account picker can be shown. |
self.Login(user_index=0, expect_success=True) |
@@ -163,8 +115,13 @@ class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
ommitted since the broken behavior should be fixed rather than protected by |
tests. |
""" |
+ # TODO(nirnimesh): Remove show_user_names policy below when |
+ # Login() automation can reliably handle relogin scenario. |
+ # crbug.com/139166 |
+ |
# No whitelist |
- self.SetDevicePolicy({'allow_new_users': True}) |
+ self.SetDevicePolicy({'allow_new_users': True, |
+ 'show_user_names': False}) |
self.Login(user_index=0, expect_success=True) |
self.Logout() |
@@ -174,18 +131,21 @@ class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
self.Logout() |
self.SetDevicePolicy({'allow_new_users': True, |
- 'user_whitelist': []}) |
+ 'user_whitelist': [], |
+ 'show_user_names': False}) |
self.Login(user_index=0, expect_success=True) |
self.Logout() |
# Populated whitelist |
- self.SetDevicePolicy({'user_whitelist': [self._usernames[0]]}) |
+ self.SetDevicePolicy({'user_whitelist': [self._usernames[0]], |
+ 'show_user_names': False}) |
self.Login(user_index=0, expect_success=True) |
self.Logout() |
self.Login(user_index=1, expect_success=False) |
self.SetDevicePolicy({'allow_new_users': True, |
- 'user_whitelist': [self._usernames[0]]}) |
+ 'user_whitelist': [self._usernames[0]], |
+ 'show_user_names': False}) |
self.Login(user_index=0, expect_success=True) |
self.Logout() |
self.Login(user_index=1, expect_success=True) |
@@ -193,19 +153,14 @@ class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
# New users not allowed, populated whitelist |
self.SetDevicePolicy({'allow_new_users': False, |
- 'user_whitelist': [self._usernames[0]]}) |
+ 'user_whitelist': [self._usernames[0]], |
+ 'show_user_names': False}) |
self.Login(user_index=0, expect_success=True) |
self.Logout() |
self.Login(user_index=1, expect_success=False) |
def testUserWhitelistInAccountPicker(self): |
"""Checks that setting a whitelist removes non-whitelisted user pods.""" |
- # TODO(bartfab): Remove this after crosbug.com/20709 is fixed. |
- self.TryToDisableLocalStateAutoClearing() |
- if self._local_state_auto_clearing: |
- logging.warn('Unable to disable local state clearing. Skipping test.') |
- return |
- |
# Disable the account picker so that the login form is shown and the Login() |
# automation call can be used. |
self.PrepareToWaitForLoginFormReload() |