Index: chrome/test/functional/prefs_ui.py |
=================================================================== |
--- chrome/test/functional/prefs_ui.py (revision 123593) |
+++ chrome/test/functional/prefs_ui.py (working copy) |
@@ -59,6 +59,26 @@ |
msg=('Displayed behavior "%s" does not match behavior "%s"' |
% (page.GetExceptions()[hostname_pattern], behavior))) |
+ def _VerifyIncognitoContentExceptionUI( |
+ self, content_type, hostname_pattern, behavior): |
+ """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. |
+ """ |
+ page = settings.ManageExceptionsPage.FromNavigation( |
+ self._driver, content_type) |
+ self.assertTrue( |
+ page.GetExceptions(incognito=True).has_key(hostname_pattern), |
+ msg='No displayed host name matches pattern "%s"' % hostname_pattern) |
+ self.assertEqual( |
+ behavior, page.GetExceptions(incognito=True)[hostname_pattern], |
+ msg=('Displayed behavior "%s" does not match behavior "%s"' |
+ % (page.GetExceptions(incognito=True)[hostname_pattern], |
+ behavior))) |
+ |
def testLocationSettingOptionsUI(self): |
"""Verify the location options setting UI. |
@@ -114,6 +134,26 @@ |
self._VerifyContentExceptionUI( |
ContentTypes.GEOLOCATION, 'http://maps.google.com:80', Behaviors.ASK) |
+ def testIncognitoExceptionsEntryCorrectlyDisplayed(self): |
+ """Verify exceptions entry is correctly displayed in the incognito UI.""" |
+ geo_exception = ( |
+ {'http://maps.google.com:80/': {'http://maps.google.com': 2}}) |
+ self.SetPrefs(pyauto.kGeolocationContentSettings, geo_exception) |
+ self._VerifyIncognitoContentExceptionUI( |
kkania
2012/02/27 00:56:35
how about do all this without loading the page thr
dyu1
2012/02/27 20:54:45
I'm not sure what you mean since this test is simi
kkania
2012/02/28 00:51:30
I didn't think about it. How about something like
|
+ ContentTypes.GEOLOCATION, 'http://maps.google.com:80', |
+ Behaviors.BLOCK) |
+ geo_exception = ( |
+ {'http://maps.google.com:80/': {'http://maps.google.com:80': 1}}) |
+ self.SetPrefs(pyauto.kGeolocationContentSettings, geo_exception) |
+ self._VerifyIncognitoContentExceptionUI( |
+ ContentTypes.GEOLOCATION, 'http://maps.google.com:80', |
+ Behaviors.ALLOW) |
+ geo_exception = ( |
+ {'http://maps.google.com:80/': {'http://maps.google.com:80': 3}}) |
+ self.SetPrefs(pyauto.kGeolocationContentSettings, geo_exception) |
+ self._VerifyIncognitoContentExceptionUI( |
+ ContentTypes.GEOLOCATION, 'http://maps.google.com:80', Behaviors.ASK) |
+ |
def testAddNewExceptionUI(self): |
"""Verify new exception added for hostname pattern and behavior in UI.""" |
content_type = ContentTypes.PLUGINS |
@@ -165,6 +205,16 @@ |
self._driver, ContentTypes.GEOLOCATION) |
self.assertEqual(0, len(page.GetExceptions())) |
+ def testInitialLineEntryInIncognitoUI(self): |
+ """Verify initial line entry is displayed in Incognito UI.""" |
+ # Ask for permission when site wants to track. |
+ self.SetPrefs(pyauto.kGeolocationDefaultContentSetting, 3) |
+ self.assertEqual( |
+ 3, self.GetPrefsInfo().Prefs(pyauto.kGeolocationDefaultContentSetting)) |
+ page = settings.ManageExceptionsPage.FromNavigation( |
+ self._driver, ContentTypes.GEOLOCATION) |
+ self.assertEqual(1, len(page.GetExceptions(incognito=True))) |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |