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 time |
class InstantTest(pyauto.PyUITest): |
@@ -21,6 +22,11 @@ |
info = self.GetInstantInfo() |
return info.get('current') and not info.get('loading') |
+ def _NotLoading(self): |
dyu1
2011/01/19 23:14:45
Is this needed? If instant is not active you can h
|
+ """Sometime instant will decide not to prefetch a query.""" |
Nirnimesh
2011/01/19 02:04:36
this docstring is not clear
|
+ info = self.GetInstantInfo() |
+ return not info.get('current') and not info.get('loading') |
+ |
def testInstantNavigation(self): |
"""Test that instant navigates based on omnibox input.""" |
self.SetOmniboxText('google.com') |
@@ -63,6 +69,33 @@ |
self.assertFalse(self.GetInstantInfo()['active'], |
'Instant enabled for javascript URL.') |
+ def testInstantDisablesPopupsOnPrefetch(self): |
+ """Test that instant disables popups when prefetching.""" |
+ popups_site = ('http://www.javascript-coder.com/files/' |
Allen
2011/01/19 00:31:32
does instant work with file:// urls? if so, shoul
Nirnimesh
2011/01/19 02:04:36
Use one of the files used in popups.py
dyu1
2011/01/19 23:14:45
Can use something like popup_url = self.GetFileURL
Huyen
2011/01/19 23:27:07
Looks like it does. I've changed the test to use a
|
+ 'window-popup/javascript-popup-example3.html') |
+ self.SetOmniboxText(popups_site) |
+ self.assertTrue(self.WaitUntil(self._DoneLoading)) |
+ location = self.GetInstantInfo()['location'] |
+ self.assertTrue(popups_site in location, |
+ msg='Prefetched page is not %s' % popups_site) |
+ blocked_popups = self.GetBlockedPopupsInfo() |
+ self.assertEqual(0, len(blocked_popups), msg='Popup not disabled.') |
Nirnimesh
2011/01/19 02:04:36
correct the msg string to apply better here. somet
Huyen
2011/01/19 23:27:07
Done.
|
+ def testInstantSearchQueryLimit_100Chars(self): |
Nirnimesh
2011/01/19 02:04:36
no _ in fn name please
Huyen
2011/01/19 23:27:07
Done.
|
+ """Test that instant loads for search querty of 100 characters.""" |
Allen
2011/01/19 00:31:32
this test case has no failure condition
Allen
2011/01/19 22:49:18
Just to be clear, this test is basically fine, it'
Huyen
2011/01/19 23:27:07
Fixed by waiting until the query string shows up i
|
+ ahundred = ('##################################################' |
Nirnimesh
2011/01/19 02:04:36
a_hundred = '#' * 100
Huyen
2011/01/19 23:27:07
Done.
|
+ '##################################################') |
+ self.SetOmniboxText(ahundred) |
+ self.assertTrue(self.WaitUntil(self._DoneLoading)) |
+ |
+ def testInstantSearchQueryLimit_101Chars(self): |
Nirnimesh
2011/01/19 02:04:36
can be merged with the previous test.
and renamed
Huyen
2011/01/19 23:27:07
Done.
|
+ """Test that instant does not load for search querty of 101 characters.""" |
Nirnimesh
2011/01/19 02:04:36
s/querty/query/
Huyen
2011/01/19 23:27:07
Done.
|
+ ahundredone = ('##################################################' |
Allen
2011/01/19 00:31:32
probably not the best variable name. maybe someth
Huyen
2011/01/19 23:27:07
Done.
|
+ '###################################################') |
+ self.SetOmniboxText(ahundredone) |
+ # Sleep to verify instant does not load results |
+ time.sleep(2) |
Allen
2011/01/19 00:31:32
need an alternative to sleep. not reliable/effici
Nirnimesh
2011/01/19 02:04:36
+1 do not use sleep(). You're asking for trouble.
dyu1
2011/01/19 23:14:45
You can use WaitUntil and check for a specific DOM
Allen
2011/01/19 23:19:59
in this case seeing a dom is not expected, but huy
Huyen
2011/01/19 23:27:07
I'm taking this test case out of this CL for now.
|
+ self.assertTrue(self._NotLoading()) |
+ |
Nirnimesh
2011/01/19 02:04:36
leave 2 blank lines at global scope
Huyen
2011/01/19 23:27:07
Done.
|
if __name__ == '__main__': |
pyauto_functional.Main() |