Chromium Code Reviews| 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 _DoneLoadingQuery(self, query): |
| + """Wait for Omnibox Instant to load and verify location |
| + URL contains the specifed query. |
| + |
| + Args: |
| + query: Value of query parameter. |
|
Nirnimesh
2011/01/20 18:53:32
So this makes it very specific to google search.
R
Huyen
2011/01/20 19:45:20
Done.
|
| + E.g., http://www.google.com?q=hi so query is 'hi'. |
|
Nirnimesh
2011/01/20 18:53:32
So this makes it specific to google search URLs.
R
Huyen
2011/01/20 19:45:20
Done.
|
| + """ |
|
Nirnimesh
2011/01/20 18:53:32
Allen, all these DoneLoading, and DoneLoadingQuery
|
| + 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._DoneLoadingQuery, args=[query])) |
| + |
| + |
| if __name__ == '__main__': |
| pyauto_functional.Main() |