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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 file_url = self.GetFileURLForPath(os.path.join( | 65 file_url = self.GetFileURLForPath(os.path.join( |
66 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) | 66 self.DataDir(), 'popup_blocker', 'popup-window-open.html')) |
67 self.NavigateToURL(file_url, 1, 0) | 67 self.NavigateToURL(file_url, 1, 0) |
68 self.assertEqual(1, len(self.GetBlockedPopupsInfo(tab_index=0, windex=1))) | 68 # Wait until the popup is blocked |
69 self.WaitUntil(lambda: | |
70 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)), expect_retval=1) | |
anantha
2011/03/28 18:41:30
Please do self.assertEqual check again after self.
sunandt
2011/03/28 18:56:47
Since WaitUntil returns either True or False, I'm
| |
69 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) | 71 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) |
70 # Verify that no more popups are blocked | 72 # Verify that no more popups are blocked |
71 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) | 73 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) |
72 # Verify that popup window was created | 74 # Verify that popup window was created |
73 self.assertEqual(3, self.GetBrowserWindowCount(), | 75 self.assertEqual(3, self.GetBrowserWindowCount(), |
74 msg='Popup could not be launched'); | 76 msg='Popup could not be launched'); |
75 self.assertEqual('Popup Success!', self.GetActiveTabTitle(2)) | 77 self.assertEqual('Popup Success!', self.GetActiveTabTitle(2)) |
76 | 78 |
77 | 79 |
78 if __name__ == '__main__': | 80 if __name__ == '__main__': |
79 pyauto_functional.Main() | 81 pyauto_functional.Main() |
OLD | NEW |