Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(841)

Side by Side Diff: enterprise.py

Issue 7633008: Added code for testing popup blocker when policy is configured. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/chrome/test/functional/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 import subprocess 8 import subprocess
9 import re 9 import re
10 10
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 def testAlwaysAuthorizePlugins(self): 318 def testAlwaysAuthorizePlugins(self):
319 """Verify plugins are always allowed to run when policy is set.""" 319 """Verify plugins are always allowed to run when policy is set."""
320 if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome': 320 if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome':
321 return 321 return
322 url = self.GetFileURLForDataPath('plugin', 'java_new.html') 322 url = self.GetFileURLForDataPath('plugin', 'java_new.html')
323 self.NavigateToURL(url) 323 self.NavigateToURL(url)
324 self.assertFalse(self.WaitForInfobarCount(1)) 324 self.assertFalse(self.WaitForInfobarCount(1))
325 pid = self._GetPluginPID('Java') 325 pid = self._GetPluginPID('Java')
326 self.assertTrue(pid, 'No plugin process for java') 326 self.assertTrue(pid, 'No plugin process for java')
327 327
328 def testDisablePopups(self):
329 """Verify popups are not allowed if policy disables popups."""
330 if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome':
331 return
332 url = self.GetFileURLForDataPath('popup_blocker', 'popup-window-open.html')
333 self.NavigateToURL(url)
334 self.assertEqual(1, len(self.GetBlockedPopupsInfo()),
335 msg='Popup not blocked')
336 self.assertRaises(pyauto.JSONInterfaceError,
337 lambda: self.SetPrefs(pyauto.kManagedDefaultPopupsSetting, 1))
338
328 class EnterpriseTestReverse(pyauto.PyUITest): 339 class EnterpriseTestReverse(pyauto.PyUITest):
329 """Test for the Enterprise features that uses the opposite values of the 340 """Test for the Enterprise features that uses the opposite values of the
330 policies used by above test class 'EnterpriseTest'. 341 policies used by above test class 'EnterpriseTest'.
331 342
332 Browser preferences will be managed using policies. These managed preferences 343 Browser preferences will be managed using policies. These managed preferences
333 cannot be modified by user. This works only for Google Chrome, not Chromium. 344 cannot be modified by user. This works only for Google Chrome, not Chromium.
334 345
335 On Linux, assume that 'suid-python' (a python binary setuid root) is 346 On Linux, assume that 'suid-python' (a python binary setuid root) is
336 available on the machine under /usr/local/bin directory. 347 available on the machine under /usr/local/bin directory.
337 """ 348 """
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 def testAlwaysAuthorizePluginsDisabled(self): 590 def testAlwaysAuthorizePluginsDisabled(self):
580 """Verify plugins are always not allowed to run when policy is set.""" 591 """Verify plugins are always not allowed to run when policy is set."""
581 if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome': 592 if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome':
582 return 593 return
583 url = self.GetFileURLForDataPath('plugin', 'java_new.html') 594 url = self.GetFileURLForDataPath('plugin', 'java_new.html')
584 self.NavigateToURL(url) 595 self.NavigateToURL(url)
585 self.assertTrue(self.WaitForInfobarCount(1)) 596 self.assertTrue(self.WaitForInfobarCount(1))
586 pid = self._GetPluginPID('Java') 597 pid = self._GetPluginPID('Java')
587 self.assertFalse(pid, 'There is a plugin process for java') 598 self.assertFalse(pid, 'There is a plugin process for java')
588 599
600 def testEnablePopups(self):
601 """Verify popups are allowed if policy enables popups."""
602 if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome':
603 return
604 url = self.GetFileURLForDataPath('popup_blocker', 'popup-window-open.html')
605 self.NavigateToURL(url)
606 self.assertEqual(2, self.GetBrowserWindowCount(),
607 msg='Popup could not be launched');
608 self.assertRaises(pyauto.JSONInterfaceError,
609 lambda: self.SetPrefs(pyauto.kManagedDefaultPopupsSetting, 2))
610
589 611
590 if __name__ == '__main__': 612 if __name__ == '__main__':
591 pyauto_functional.Main() 613 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698