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 """Basic sanity tests for the GTalk extension. | 6 """Basic sanity tests for the GTalk extension. |
7 | 7 |
8 This module contains the basic set of sanity tests run on the | 8 This module contains the basic set of sanity tests run on the |
9 GTalk extension. | 9 GTalk extension. |
10 """ | 10 """ |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 self.WaitUntilResult(True, | 225 self.WaitUntilResult(True, |
226 lambda: self.RunInViewer( | 226 lambda: self.RunInViewer( |
227 'window.document.getElementsByTagName("iframe") != null'), | 227 'window.document.getElementsByTagName("iframe") != null'), |
228 msg='Timed out waiting for iframes to load.') | 228 msg='Timed out waiting for iframes to load.') |
229 | 229 |
230 # Wait for a second chat mole to open. | 230 # Wait for a second chat mole to open. |
231 time.sleep(1) | 231 time.sleep(1) |
232 self.assertTrue(self.WaitUntil(lambda: bool(self.GetMoleInfo(1))), | 232 self.assertTrue(self.WaitUntil(lambda: bool(self.GetMoleInfo(1))), |
233 msg='Timed out waiting for second mole window to open.') | 233 msg='Timed out waiting for second mole window to open.') |
234 | 234 |
| 235 # Wait for mole content to load |
| 236 self.WaitUntilCondition( |
| 237 lambda: self.RunInMole('window.document.body.innerHTML', 1), |
| 238 lambda html: html and 'Ping!' in html, |
| 239 msg='Timed out waiting for Ping! to appear in mole DOM.') |
| 240 |
235 # Disable the extension. | 241 # Disable the extension. |
236 extension = self.GetGTalkExtensionInfo() | 242 extension = self.GetGTalkExtensionInfo() |
237 self.SetExtensionStateById(extension['id'], enable=False, | 243 self.SetExtensionStateById(extension['id'], enable=False, |
238 allow_in_incognito=False) | 244 allow_in_incognito=False) |
239 extension = self.GetGTalkExtensionInfo() | 245 extension = self.GetGTalkExtensionInfo() |
240 self.assertFalse(extension['is_enabled']) | 246 self.assertFalse(extension['is_enabled']) |
241 | 247 |
242 # Verify all moles + windows are closed. | 248 # Verify all moles + windows are closed. |
243 self.assertTrue(self.WaitUntil(lambda: not(bool(self.GetViewerInfo()))), | 249 self.assertTrue(self.WaitUntil(lambda: not(bool(self.GetViewerInfo()))), |
244 msg='Timed out waiting for viewer.html to close after disabling.') | 250 msg='Timed out waiting for viewer.html to close after disabling.') |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 logging.info("\n") | 286 logging.info("\n") |
281 if tries < RETRIES - 1: | 287 if tries < RETRIES - 1: |
282 self.NavigateToURL('http://accounts.google.com/Logout') | 288 self.NavigateToURL('http://accounts.google.com/Logout') |
283 logging.info('Retrying...') | 289 logging.info('Retrying...') |
284 else: | 290 else: |
285 raise | 291 raise |
286 | 292 |
287 | 293 |
288 if __name__ == '__main__': | 294 if __name__ == '__main__': |
289 pyauto_gtalk.Main() | 295 pyauto_gtalk.Main() |
OLD | NEW |