Index: chrome/test/functional/instant.py |
=================================================================== |
--- chrome/test/functional/instant.py (revision 71648) |
+++ chrome/test/functional/instant.py (working copy) |
@@ -8,6 +8,7 @@ |
import pyauto_functional # Must be imported before pyauto |
import pyauto |
+import urlparse |
class InstantTest(pyauto.PyUITest): |
@@ -21,6 +22,22 @@ |
info = self.GetInstantInfo() |
return info.get('current') and not info.get('loading') |
+ def _DoneLoadingGoogleQuery(self, query): |
+ """Wait for Omnibox Instant to load Google search result |
+ and verify location URL contains the specifed query. |
+ |
+ Args: |
+ query: Value of query parameter. |
+ E.g., http://www.google.com?q=hi so query is 'hi'. |
+ """ |
+ self.assertTrue(self.WaitUntil(self._DoneLoading)) |
+ location = self.GetInstantInfo().get('location') |
+ if location is not None: |
+ q = urlparse.parse_qs(location).get('q') |
+ if q is not None and query in q: |
+ return True |
+ return False |
+ |
def testInstantNavigation(self): |
"""Test that instant navigates based on omnibox input.""" |
self.SetOmniboxText('google.com') |
@@ -63,6 +80,25 @@ |
self.assertFalse(self.GetInstantInfo()['active'], |
'Instant enabled for javascript URL.') |
+ def testInstantDisablesPopupsOnPrefetch(self): |
+ """Test that instant disables popups when prefetching.""" |
+ file_url = self.GetFileURLForPath(os.path.join( |
+ self.DataDir(), 'popup_blocker', 'popup-blocked-to-post-blank.html')) |
+ self.SetOmniboxText(file_url) |
+ self.assertTrue(self.WaitUntil(self._DoneLoading)) |
+ location = self.GetInstantInfo()['location'] |
+ self.assertTrue(file_url in location, |
+ msg='Prefetched page is not %s' % file_url) |
+ blocked_popups = self.GetBlockedPopupsInfo() |
+ self.assertEqual(0, len(blocked_popups), |
+ msg='Unexpected popup in instant preview.') |
+ def testInstantLoadsFor100CharsLongQuery(self): |
+ """Test that instant loads for search query of 100 characters.""" |
+ query = '#' * 100 |
+ self.SetOmniboxText(query) |
+ self.assertTrue(self.WaitUntil(self._DoneLoadingGoogleQuery, args=[query])) |
+ |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |