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 import logging | 8 import logging |
9 | 9 |
10 import pyauto_functional # Must be imported before pyauto | 10 import pyauto_functional # Must be imported before pyauto |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 # TODO(sunandt): Work around for debugging the flakiness | 70 # TODO(sunandt): Work around for debugging the flakiness |
71 # Related to crbug.com/64274 | 71 # Related to crbug.com/64274 |
72 attempts = 0 | 72 attempts = 0 |
73 while attempts < 3: | 73 while attempts < 3: |
74 if self.GetActiveTabTitle(window_index=1) != \ | 74 if self.GetActiveTabTitle(window_index=1) != \ |
75 'Popup created using window.open': | 75 'Popup created using window.open': |
76 logging.debug('Attempt %s' % attempts+1) | 76 logging.debug('Attempt %d' % attempts+1) |
Nirnimesh
2011/04/05 17:43:02
put space around +
sunandt
2011/04/05 17:45:24
Done.
| |
77 self.NavigateToURL(file_url, 1, 0) | 77 self.NavigateToURL(file_url, 1, 0) |
78 attempts = attempts + 1 | 78 attempts = attempts + 1 |
79 else: | 79 else: |
80 break | 80 break |
81 self.assertEquals('Popup created using window.open', | 81 self.assertEquals('Popup created using window.open', |
82 self.GetActiveTabTitle(window_index=1)) | 82 self.GetActiveTabTitle(window_index=1)) |
83 # Wait until the popup is blocked | 83 # Wait until the popup is blocked |
84 self.assertTrue(self.WaitUntil(lambda: | 84 self.assertTrue(self.WaitUntil(lambda: |
85 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) is 1), | 85 len(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) is 1), |
86 msg='Popup not blocked') | 86 msg='Popup not blocked') |
87 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) | 87 self.UnblockAndLaunchBlockedPopup(0, tab_index=0, windex=1) |
88 # Verify that no more popups are blocked | 88 # Verify that no more popups are blocked |
89 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) | 89 self.assertFalse(self.GetBlockedPopupsInfo(tab_index=0, windex=1)) |
90 # Verify that popup window was created | 90 # Verify that popup window was created |
91 self.assertEqual(3, self.GetBrowserWindowCount(), | 91 self.assertEqual(3, self.GetBrowserWindowCount(), |
92 msg='Popup could not be launched'); | 92 msg='Popup could not be launched'); |
93 self.assertEqual('Popup Success!', self.GetActiveTabTitle(2)) | 93 self.assertEqual('Popup Success!', self.GetActiveTabTitle(2)) |
94 | 94 |
95 | 95 |
96 if __name__ == '__main__': | 96 if __name__ == '__main__': |
97 pyauto_functional.Main() | 97 pyauto_functional.Main() |
OLD | NEW |