Index: popups.py |
=================================================================== |
--- popups.py (revision 85857) |
+++ popups.py (working copy) |
@@ -8,8 +8,8 @@ |
import pyauto_functional # Must be imported before pyauto |
import pyauto |
+import test_utils |
- |
class PopupsTest(pyauto.PyUITest): |
"""TestCase for Popup blocking.""" |
@@ -23,7 +23,7 @@ |
while True: |
raw_input('Interact with the browser and hit <enter>') |
pp.pprint(self.GetBlockedPopupsInfo()) |
- |
+ |
Nirnimesh
2011/05/19 06:14:45
remove spaces from this line
|
def testPopupBlockerEnabled(self): |
"""Verify popup blocking is enabled.""" |
self.assertFalse(self.GetBlockedPopupsInfo(), |
@@ -140,7 +140,42 @@ |
# Check if last popup is launched when the tab is closed. |
self.assertEqual(5, self.GetBrowserWindowCount(), |
msg='Last popup did not launch when the tab is closed.') |
- |
- |
+ |
+ def testUnblockedPopupShowsInHistory(self): |
+ """Verify that when you unblock popup, the popup shows in history.""" |
+ file_url = self.GetFileURLForPath(os.path.join( |
Nirnimesh
2011/05/19 06:14:45
I've made GetFileURLForPath easier to use. Now you
aocampo
2011/05/20 00:36:05
Done.
|
+ self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
+ self.NavigateToURL(file_url) |
+ self.assertEqual(1, len(self.GetBlockedPopupsInfo())) |
+ self.UnblockAndLaunchBlockedPopup(0) |
+ history = self.GetHistoryInfo().History() |
+ self.assertEqual(2, len(history)) |
+ self.assertEqual('Popup Success!', history[0]['title']) |
+ |
+ def testBlockedPopupNotShowInHistory(self): |
+ """Verify that a blocked popup does not show up in history. |
+ Currently failing because of issue # 47935. |
Nirnimesh
2011/05/19 06:14:45
remove this line. Disable this test in PYAUTO_TEST
aocampo
2011/05/20 00:36:05
Done.
|
+ """ |
+ file_url = self.GetFileURLForPath(os.path.join( |
Nirnimesh
2011/05/19 06:14:45
same here
aocampo
2011/05/20 00:36:05
Done.
|
+ self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
+ self.NavigateToURL(file_url) |
+ self.assertEqual(1, len(self.GetBlockedPopupsInfo())) |
+ history = self.GetHistoryInfo().History() |
+ self.assertEqual(1, len(history)) |
Nirnimesh
2011/05/19 06:14:45
merge with previous line
aocampo
2011/05/20 00:36:05
Done.
|
+ |
+ def testUnblockedPopupAddedToOmnibox(self): |
+ """Verify that an unblocked popup shows up in omnibox suggestions.""" |
+ file_url = self.GetFileURLForPath(os.path.join( |
Nirnimesh
2011/05/19 06:14:45
same comment as above
aocampo
2011/05/20 00:36:05
Done.
|
+ self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
+ self.NavigateToURL(file_url) |
+ self.assertEqual(1, len(self.GetBlockedPopupsInfo())) |
+ self.UnblockAndLaunchBlockedPopup(0) |
+ search_string = 'data:text/html,<title>Popup Success!</title> \ |
Nirnimesh
2011/05/19 06:14:45
why not do an omnibox search for something saner,
aocampo
2011/05/20 00:36:05
The html test file already provided isn't written
|
+ you should not see this message if popup blocker is enabled' |
+ matches = test_utils.GetOmniboxMatchesFor(self, search_string) |
+ self.assertEqual(search_string, matches[0]['destination_url']) |
+ self.assertEqual(search_string, matches[0]['contents']) |
+ |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |