| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 if self.IsWin(): | 150 if self.IsWin(): |
| 151 policy = {'ApplicationLocaleValue': 'hi'} | 151 policy = {'ApplicationLocaleValue': 'hi'} |
| 152 self.SetUserPolicy(policy) | 152 self.SetUserPolicy(policy) |
| 153 self.assertTrue( | 153 self.assertTrue( |
| 154 'hi' in self.GetPrefsInfo().Prefs()['intl']['accept_languages'], | 154 'hi' in self.GetPrefsInfo().Prefs()['intl']['accept_languages'], |
| 155 msg='Chrome locale is not Hindi.') | 155 msg='Chrome locale is not Hindi.') |
| 156 # TODO(sunandt): Try changing the application locale to another language. | 156 # TODO(sunandt): Try changing the application locale to another language. |
| 157 else: | 157 else: |
| 158 raise NotImplementedError() | 158 raise NotImplementedError() |
| 159 | 159 |
| 160 def testDisableSPDY(self): | |
| 161 """Verify that SPDY is disabled.""" | |
| 162 policy = {'DisableSpdy': True} | |
| 163 self.SetUserPolicy(policy) | |
| 164 self.NavigateToURL('chrome://net-internals/#spdy') | |
| 165 self.assertEquals(0, self.FindInPage('SPDY Enabled: true')['match_count']) | |
| 166 self.assertEquals( | |
| 167 1, | |
| 168 self.FindInPage('SPDY Enabled: false', tab_index=0)['match_count'], | |
| 169 msg='SPDY is not disabled.') | |
| 170 policy = {'DisableSpdy': False} | |
| 171 self.SetUserPolicy(policy) | |
| 172 self.ReloadTab() | |
| 173 self.assertEquals( | |
| 174 1, | |
| 175 self.FindInPage('SPDY Enabled: true', tab_index=0)['match_count'], | |
| 176 msg='SPDY is not disabled.') | |
| 177 | |
| 178 def testDisabledPlugins(self): | 160 def testDisabledPlugins(self): |
| 179 """Verify that disabled plugins cannot be enabled.""" | 161 """Verify that disabled plugins cannot be enabled.""" |
| 180 policy = {'DisabledPlugins': ['Shockwave Flash']} | 162 policy = {'DisabledPlugins': ['Shockwave Flash']} |
| 181 self.SetUserPolicy(policy) | 163 self.SetUserPolicy(policy) |
| 182 for plugin in self.GetPluginsInfo().Plugins(): | 164 for plugin in self.GetPluginsInfo().Plugins(): |
| 183 if 'Flash' in plugin['name']: | 165 if 'Flash' in plugin['name']: |
| 184 self.assertRaises(pyauto.JSONInterfaceError, | 166 self.assertRaises(pyauto.JSONInterfaceError, |
| 185 lambda: self.EnablePlugin(plugin['path'])) | 167 lambda: self.EnablePlugin(plugin['path'])) |
| 186 return | 168 return |
| 187 | 169 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 # Give the system 30 seconds to go get this extension. We are not sure how | 335 # Give the system 30 seconds to go get this extension. We are not sure how |
| 354 # long it will take the policy to take affect and download the extension. | 336 # long it will take the policy to take affect and download the extension. |
| 355 self.assertTrue(self.WaitUntil(lambda: | 337 self.assertTrue(self.WaitUntil(lambda: |
| 356 self._CheckForExtensionByID(self._SCREEN_CAPTURE_CRX_ID), | 338 self._CheckForExtensionByID(self._SCREEN_CAPTURE_CRX_ID), |
| 357 expect_retval=True), | 339 expect_retval=True), |
| 358 msg='The force install extension was never installed.') | 340 msg='The force install extension was never installed.') |
| 359 | 341 |
| 360 | 342 |
| 361 if __name__ == '__main__': | 343 if __name__ == '__main__': |
| 362 pyauto_functional.Main() | 344 pyauto_functional.Main() |
| OLD | NEW |