Index: popups.py |
=================================================================== |
--- popups.py (revision 86159) |
+++ 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.""" |
@@ -141,6 +141,38 @@ |
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.GetFileURLForDataPath('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.""" |
+ file_url = self.GetFileURLForDataPath('popup_blocker', |
+ 'popup-window-open.html') |
+ self.NavigateToURL(file_url) |
+ self.assertEqual(1, len(self.GetBlockedPopupsInfo())) |
+ self.assertEqual(1, len(self.GetHistoryInfo().History())) |
+ |
+ def testUnblockedPopupAddedToOmnibox(self): |
+ """Verify that an unblocked popup shows up in omnibox suggestions.""" |
+ file_url = self.GetFileURLForDataPath('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> \ |
+ 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() |