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 logging | 6 import logging |
7 import os | 7 import os |
8 | 8 |
9 import pyauto_functional # must come before pyauto. | 9 import pyauto_functional # must come before pyauto. |
10 import policy_base | 10 import policy_base |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 self.assertTrue(self._IsWebGLEnabled()) | 259 self.assertTrue(self._IsWebGLEnabled()) |
260 | 260 |
261 self.SetUserPolicy({ | 261 self.SetUserPolicy({ |
262 'Disable3DAPIs': True | 262 'Disable3DAPIs': True |
263 }) | 263 }) |
264 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kDisable3DAPIs)) | 264 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kDisable3DAPIs)) |
265 # The Disable3DAPIs policy only applies updated values to new renderers. | 265 # The Disable3DAPIs policy only applies updated values to new renderers. |
266 self._RestartRenderer() | 266 self._RestartRenderer() |
267 self.assertFalse(self._IsWebGLEnabled()) | 267 self.assertFalse(self._IsWebGLEnabled()) |
268 | 268 |
269 def testStartupOptions(self): | 269 def testStartupOptionsURLs(self): |
270 """Verify that user cannot modify the startup page options.""" | 270 """Verify that user cannot modify the startup page options if "Open the |
| 271 following URLs" is set by a policy. |
| 272 """ |
271 policy = { | 273 policy = { |
272 'RestoreOnStartup': 4, | 274 'RestoreOnStartup': 4, |
273 'RestoreOnStartupURLs': ['http://chromium.org'] | 275 'RestoreOnStartupURLs': ['http://chromium.org'] |
274 } | 276 } |
275 self.SetUserPolicy(policy) | 277 self.SetUserPolicy(policy) |
276 # Verify startup option | 278 # Verify startup option |
277 self.assertEquals(4, self.GetPrefsInfo().Prefs(pyauto.kRestoreOnStartup)) | 279 self.assertEquals(4, self.GetPrefsInfo().Prefs(pyauto.kRestoreOnStartup)) |
278 self.assertRaises( | 280 self.assertRaises( |
279 pyauto.JSONInterfaceError, | 281 pyauto.JSONInterfaceError, |
280 lambda: self.SetPrefs(pyauto.kRestoreOnStartup, 1)) | 282 lambda: self.SetPrefs(pyauto.kRestoreOnStartup, 1)) |
281 policy['RestoreOnStartup'] = 0 | 283 |
| 284 def testStartupOptionsHomepage(self): |
| 285 """Verify that user cannot modify the startup page options if the |
| 286 deprecated "Open the homepage" option is set by a policy. |
| 287 """ |
| 288 policy = { |
| 289 'RestoreOnStartup': 0, |
| 290 'HomepageLocation': 'http://chromium.org', |
| 291 'HomepageIsNewTabPage': False, |
| 292 } |
282 self.SetUserPolicy(policy) | 293 self.SetUserPolicy(policy) |
283 self.assertEquals(0, self.GetPrefsInfo().Prefs(pyauto.kRestoreOnStartup)) | 294 self.assertEquals(4, self.GetPrefsInfo().Prefs(pyauto.kRestoreOnStartup)) |
284 self.assertRaises( | 295 self.assertRaises( |
285 pyauto.JSONInterfaceError, | 296 pyauto.JSONInterfaceError, |
286 lambda: self.SetPrefs(pyauto.kRestoreOnStartup, 1)) | 297 lambda: self.SetPrefs(pyauto.kRestoreOnStartup, 1)) |
287 # Verify URLs to open on startup | 298 # Verify URLs to open on startup |
288 self.assertEquals( | 299 self.assertEquals( |
289 ['http://chromium.org'], | 300 ['http://chromium.org'], |
290 self.GetPrefsInfo().Prefs(pyauto.kURLsToRestoreOnStartup)) | 301 self.GetPrefsInfo().Prefs(pyauto.kURLsToRestoreOnStartup)) |
291 self.assertRaises( | 302 self.assertRaises( |
292 pyauto.JSONInterfaceError, | 303 pyauto.JSONInterfaceError, |
293 lambda: self.SetPrefs(pyauto.kURLsToRestoreOnStartup, | 304 lambda: self.SetPrefs(pyauto.kURLsToRestoreOnStartup, |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 # Give the system 30 seconds to go get this extension. We are not sure how | 658 # Give the system 30 seconds to go get this extension. We are not sure how |
648 # long it will take the policy to take affect and download the extension. | 659 # long it will take the policy to take affect and download the extension. |
649 self.assertTrue(self.WaitUntil(lambda: | 660 self.assertTrue(self.WaitUntil(lambda: |
650 self._CheckForExtensionByID(self._SCREEN_CAPTURE_CRX_ID), | 661 self._CheckForExtensionByID(self._SCREEN_CAPTURE_CRX_ID), |
651 expect_retval=True), | 662 expect_retval=True), |
652 msg='The force install extension was never installed.') | 663 msg='The force install extension was never installed.') |
653 | 664 |
654 | 665 |
655 if __name__ == '__main__': | 666 if __name__ == '__main__': |
656 pyauto_functional.Main() | 667 pyauto_functional.Main() |
OLD | NEW |