OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import logging | 7 import logging |
8 | 8 |
9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
10 import pyauto | 10 import pyauto |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') | 61 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') |
62 | 62 |
63 def testLaunchBlockedPopupInIncognito(self): | 63 def testLaunchBlockedPopupInIncognito(self): |
64 """Verify that a blocked popup can be unblocked in incognito.""" | 64 """Verify that a blocked popup can be unblocked in incognito.""" |
65 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 65 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
66 self.assertTrue(2, self.GetBrowserWindowCount()) | 66 self.assertTrue(2, self.GetBrowserWindowCount()) |
67 file_url = self.GetFileURLForPath(os.path.join( | 67 file_url = self.GetFileURLForPath(os.path.join( |
68 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) | 68 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
69 self.NavigateToURL(file_url, 1, 0) | 69 self.NavigateToURL(file_url, 1, 0) |
70 self.assertEquals('Popup created using window.open', | 70 self.assertEquals('Popup created using window.open', |
71 self.GetActiveTabTitle(window_index=1)) | 71 self.GetActiveTabTitle(1)) |
72 # Wait until the popup is blocked | 72 # Wait until the popup is blocked |
73 self.assertTrue(self.WaitUntil(lambda: | 73 self.assertTrue(self.WaitUntil(lambda: |
74 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) is 1), | 74 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) is 1), |
75 msg='Popup not blocked') | 75 msg='Popup not blocked') |
76 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) | 76 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) |
77 # Verify that no more popups are blocked | 77 # Verify that no more popups are blocked |
78 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) | 78 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) |
79 # Verify that popup window was created | 79 # Verify that popup window was created |
80 self.assertEqual(3, self.GetBrowserWindowCount(), | 80 self.assertEqual(3, self.GetBrowserWindowCount(), |
81 msg='Popup could not be launched'); | 81 msg='Popup could not be launched'); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 self.UnblockAndLaunchBlockedPopup(0) | 168 self.UnblockAndLaunchBlockedPopup(0) |
169 search_string = 'data:text/html,<title>Popup Success!</title> \ | 169 search_string = 'data:text/html,<title>Popup Success!</title> \ |
170 you should not see this message if popup blocker is enabled' | 170 you should not see this message if popup blocker is enabled' |
171 matches = test_utils.GetOmniboxMatchesFor(self, search_string) | 171 matches = test_utils.GetOmniboxMatchesFor(self, search_string) |
172 self.assertEqual(search_string, matches[0]['destination_url']) | 172 self.assertEqual(search_string, matches[0]['destination_url']) |
173 self.assertEqual(search_string, matches[0]['contents']) | 173 self.assertEqual(search_string, matches[0]['contents']) |
174 | 174 |
175 | 175 |
176 if __name__ == '__main__': | 176 if __name__ == '__main__': |
177 pyauto_functional.Main() | 177 pyauto_functional.Main() |
OLD | NEW |