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

Unified Diff: chrome/test/functional/prefs_ui.py

Issue 9467013: Add prefs UI tests for Incognito exceptions for new Settings UI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/functional/prefs_ui.py
===================================================================
--- chrome/test/functional/prefs_ui.py (revision 124707)
+++ chrome/test/functional/prefs_ui.py (working copy)
@@ -42,22 +42,26 @@
behavior_key))
return behaviors_dict[behavior_key]
- def _VerifyContentExceptionUI(self, content_type, hostname_pattern, behavior):
+ def _VerifyContentExceptionUI(self, content_type, hostname_pattern, behavior,
+ incognito=False):
"""Find hostname pattern and behavior within UI on content exceptions page.
Args:
content_type: The string content settings type to manage.
hostname_pattern: The URL or pattern associated with the behavior.
behavior: The exception to allow or block the hostname.
+ incognito: Incognito list displayed on exceptions settings page.
+ Default to False.
"""
page = settings.ManageExceptionsPage.FromNavigation(
self._driver, content_type)
- self.assertTrue(page.GetExceptions().has_key(hostname_pattern),
+ self.assertTrue(page.GetExceptions(incognito).has_key(hostname_pattern),
msg=('No displayed host name matches pattern "%s"'
% hostname_pattern))
- self.assertEqual(behavior, page.GetExceptions()[hostname_pattern],
+ self.assertEqual(behavior, page.GetExceptions(incognito)[hostname_pattern],
msg=('Displayed behavior "%s" does not match behavior "%s"'
- % (page.GetExceptions()[hostname_pattern], behavior)))
+ % (page.GetExceptions(incognito)[hostname_pattern],
+ behavior)))
def testLocationSettingOptionsUI(self):
"""Verify the location options setting UI.
@@ -165,6 +169,50 @@
self._driver, ContentTypes.GEOLOCATION)
self.assertEqual(0, len(page.GetExceptions()))
+ def testCorrectCookiesSessionInUI(self):
+ """Verify exceptions for cookies in UI list entry."""
+ # Block cookies for for a session for google.com.
+ self.SetPrefs(pyauto.kContentSettingsPatternPairs,
+ {'http://google.com:80': {'cookies': 2}})
+ self._VerifyContentExceptionUI(
+ ContentTypes.COOKIES, 'http://google.com:80', Behaviors.BLOCK)
+ def testInitialLineEntryInIncognitoUI(self):
+ """Verify initial line entry is displayed in Incognito UI."""
+ self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) # Display incognito list.
+ page = settings.ManageExceptionsPage.FromNavigation(
+ self._driver, ContentTypes.PLUGINS)
kkania 2012/03/03 02:02:27 bad indentation and several places below
dyu1 2012/03/03 02:16:45 Done.
+ self.assertEqual(1, len(page.GetExceptions(incognito=True)))
+
+ def testIncognitoExceptionsEntryCorrectlyDisplayed(self):
+ """Verify exceptions entry is correctly displayed in the incognito UI."""
+ self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) # Display incognito list.
+ page = settings.ManageExceptionsPage.FromNavigation(
+ self._driver, ContentTypes.PLUGINS)
+ plugins_exception = {
+ 'pattern': 'http://maps.google.com:80', 'behavior': Behaviors.BLOCK,
+ 'incognito': True}
+ page.AddNewException(**plugins_exception)
kkania 2012/03/03 02:02:27 this is pretty fancy, but can you just do it the n
dyu1 2012/03/03 02:16:45 Done.
+ self._VerifyContentExceptionUI(
+ ContentTypes.PLUGINS, 'http://maps.google.com:80',
+ Behaviors.BLOCK, incognito=True)
+
+ def testCorrectBehaviorSetInIncognitoUI(self):
kkania 2012/03/03 02:02:27 remove?
dyu1 2012/03/03 02:16:45 Removing since SetPrefs() function doesn't offer t
+ """Verify behavior is correctly set for initial Incognito list entry."""
+ self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) # Display incognito list.
+ # Ask for permission when site wants to track (Click to play).
+ self.SetPrefs(pyauto.kDefaultContentSettings, {'plugins': 3}, windex=1)
+ self._VerifyContentExceptionUI(
+ ContentTypes.PLUGINS, '*', Behaviors.ASK, incognito=True)
+ # Block all sites.
+ self.SetPrefs(pyauto.kDefaultContentSettings, {'plugins': 2}, windex=1)
+ self._VerifyContentExceptionUI(
+ ContentTypes.PLUGINS, '*', Behaviors.BLOCK, incognito=True)
+ # Allow all sites.
+ self.SetPrefs(pyauto.kDefaultContentSettings, {'plugins': 1}, windex=1)
+ self._VerifyContentExceptionUI(
+ ContentTypes.PLUGINS, '*', Behaviors.ALLOW, incognito=True)
+
+
if __name__ == '__main__':
pyauto_functional.Main()
« no previous file with comments | « no previous file | chrome/test/functional/webdriver_pages/settings.py » ('j') | chrome/test/functional/webdriver_pages/settings.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698