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,18 @@ |
info = self.GetInstantInfo() |
return info.get('current') and not info.get('loading') |
+ def _DoneLoadingQuery(self, query): |
Nirnimesh
2011/01/20 00:39:23
Add a docstring to explain what it's doing.
Huyen
2011/01/20 02:44:37
Done.
|
+ self.assertTrue(self.WaitUntil(self._DoneLoading)) |
+ location = self.GetInstantInfo().get('location') |
+ if location is None: |
+ return False |
+ else: |
Nirnimesh
2011/01/20 00:39:23
else: is redundant
Huyen
2011/01/20 02:44:37
Polished the logic here a bit. Should be better no
|
+ q = urlparse.parse_qs(location).get('q') |
+ if q is None: |
+ return False |
+ elif q == query: |
+ return True |
+ |
def testInstantNavigation(self): |
"""Test that instant navigates based on omnibox input.""" |
self.SetOmniboxText('google.com') |
@@ -63,6 +76,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._DoneLoadingQuery, args=[query])) |
+ |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |