| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import pyauto_functional # Must come before pyauto (and thus, policy_base). | 5 import pyauto_functional # Must come before pyauto (and thus, policy_base). |
| 6 import policy_base | 6 import policy_base |
| 7 | 7 |
| 8 | 8 |
| 9 class ChromeosDevicePolicy(policy_base.PolicyTestBase): | 9 class ChromeosDevicePolicy(policy_base.PolicyTestBase): |
| 10 """Tests various ChromeOS device policies.""" | 10 """Tests various ChromeOS device policies.""" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 self.SetDevicePolicy({'show_user_names': True, | 181 self.SetDevicePolicy({'show_user_names': True, |
| 182 'user_whitelist': [self._usernames[1]]}) | 182 'user_whitelist': [self._usernames[1]]}) |
| 183 self._WaitForPodVisibility(username=self._usernames[0], visible=False) | 183 self._WaitForPodVisibility(username=self._usernames[0], visible=False) |
| 184 self._WaitForPodVisibility(username=self._usernames[1], visible=True) | 184 self._WaitForPodVisibility(username=self._usernames[1], visible=True) |
| 185 | 185 |
| 186 self.SetDevicePolicy({'show_user_names': True}) | 186 self.SetDevicePolicy({'show_user_names': True}) |
| 187 self._WaitForPodVisibility(username=self._usernames[0], visible=True) | 187 self._WaitForPodVisibility(username=self._usernames[0], visible=True) |
| 188 self._WaitForPodVisibility(username=self._usernames[1], visible=True) | 188 self._WaitForPodVisibility(username=self._usernames[1], visible=True) |
| 189 | 189 |
| 190 _timezones = ['America/Barbados', 'Europe/Helsinki'] | |
| 191 | |
| 192 def testTimezoneSettingWithoutPolicy(self): | |
| 193 """Without timezone policy, timezone changes by user are persistent.""" | |
| 194 self.SetDevicePolicy(refresh=False) | |
| 195 | |
| 196 for timezone in self._timezones: | |
| 197 self.Login(user_index=1, expect_success=True) | |
| 198 self.SetTimezone(timezone) | |
| 199 self.assertEqual(timezone, self.GetTimeInfo()['timezone']) | |
| 200 | |
| 201 self.Logout() | |
| 202 self.assertEqual(timezone, self.GetTimeInfo()['timezone']) | |
| 203 | |
| 204 def testTimezoneSettingWithPolicy(self): | |
| 205 """With timezone policy, timezone changes by user are reset on logout.""" | |
| 206 self.SetDevicePolicy({'timezone':self._timezones[0]}, refresh=True) | |
| 207 | |
| 208 # Timezones are set on startup, i.e. everytime when loading the login | |
| 209 # screen. Something like a browser restart may work, too. | |
| 210 self.Login(user_index=1, expect_success=True) | |
| 211 self.Logout() | |
| 212 | |
| 213 self.assertEqual(self._timezones[0], self.GetTimeInfo()['timezone']) | |
| 214 | |
| 215 self.Login(user_index=1, expect_success=True) | |
| 216 self.SetTimezone(self._timezones[1]) | |
| 217 self.assertEqual(self._timezones[1], self.GetTimeInfo()['timezone']) | |
| 218 | |
| 219 self.Logout() | |
| 220 self.assertEqual(self._timezones[0], self.GetTimeInfo()['timezone']) | |
| 221 | 190 |
| 222 if __name__ == '__main__': | 191 if __name__ == '__main__': |
| 223 pyauto_functional.Main() | 192 pyauto_functional.Main() |
| OLD | NEW |