OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import os | 7 import os |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 55 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
56 file_url = self.GetFileURLForPath(os.path.join( | 56 file_url = self.GetFileURLForPath(os.path.join( |
57 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) | 57 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
58 self.NavigateToURL(file_url, 1, 0) | 58 self.NavigateToURL(file_url, 1, 0) |
59 blocked_popups = self.GetBlockedPopupsInfo(tab_index=0, windex=1) | 59 blocked_popups = self.GetBlockedPopupsInfo(tab_index=0, windex=1) |
60 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') | 60 self.assertEqual(1, len(blocked_popups), msg='Popup not blocked') |
61 | 61 |
62 def testLaunchBlockedPopupInIncognito(self): | 62 def testLaunchBlockedPopupInIncognito(self): |
63 """Verify that a blocked popup can be unblocked in incognito.""" | 63 """Verify that a blocked popup can be unblocked in incognito.""" |
64 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 64 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
| 65 self.assertTrue(2, self.GetBrowserWindowCount()) |
65 file_url = self.GetFileURLForPath(os.path.join( | 66 file_url = self.GetFileURLForPath(os.path.join( |
66 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) | 67 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
67 self.NavigateToURL(file_url, 1, 0) | 68 self.NavigateToURL(file_url, 1, 0) |
| 69 self.assertEquals('Popup created using window.open', |
| 70 self.GetActiveTabTitle(window_index=1)) |
68 # Wait until the popup is blocked | 71 # Wait until the popup is blocked |
69 self.assertTrue(self.WaitUntil(lambda: | 72 self.assertTrue(self.WaitUntil(lambda: |
70 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) is 1), | 73 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) is 1), |
71 msg='Popup not blocked') | 74 msg='Popup not blocked') |
72 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) | 75 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) |
73 # Verify that no more popups are blocked | 76 # Verify that no more popups are blocked |
74 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) | 77 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) |
75 # Verify that popup window was created | 78 # Verify that popup window was created |
76 self.assertEqual(3, self.GetBrowserWindowCount(), | 79 self.assertEqual(3, self.GetBrowserWindowCount(), |
77 msg='Popup could not be launched'); | 80 msg='Popup could not be launched'); |
78 self.assertEqual('Popup Success!', self.GetActiveTabTitle(2)) | 81 self.assertEqual('Popup Success!', self.GetActiveTabTitle(2)) |
79 | 82 |
80 | 83 |
81 if __name__ == '__main__': | 84 if __name__ == '__main__': |
82 pyauto_functional.Main() | 85 pyauto_functional.Main() |
OLD | NEW |