| 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 unittest | 6 import unittest |
| 7 | 7 |
| 8 import pyauto_functional # Must be imported before pyauto | 8 import pyauto_functional # Must be imported before pyauto |
| 9 import pyauto | 9 import pyauto |
| 10 import pyauto_errors | 10 import pyauto_errors |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 self.assertEqual(self.FindInPage(flag)['match_count'], 1, | 35 self.assertEqual(self.FindInPage(flag)['match_count'], 1, |
| 36 msg='Missing expected Chrome flag "%s"' % flag) | 36 msg='Missing expected Chrome flag "%s"' % flag) |
| 37 | 37 |
| 38 def testCallOnInvalidWindow(self): | 38 def testCallOnInvalidWindow(self): |
| 39 """Verify that exception is raised when a browser is missing/invalid.""" | 39 """Verify that exception is raised when a browser is missing/invalid.""" |
| 40 self.assertEqual(1, self.GetBrowserWindowCount()) | 40 self.assertEqual(1, self.GetBrowserWindowCount()) |
| 41 self.assertRaises( | 41 self.assertRaises( |
| 42 pyauto_errors.JSONInterfaceError, | 42 pyauto_errors.JSONInterfaceError, |
| 43 lambda: self.FindInPage('some text', windex=1)) # invalid window | 43 lambda: self.FindInPage('some text', windex=1)) # invalid window |
| 44 | 44 |
| 45 def testJSONInterfaceTimeout(self): | |
| 46 """Verify that an exception is raised when the JSON interface times out.""" | |
| 47 self.ClearEventQueue() | |
| 48 self.AddDomEventObserver('foo') | |
| 49 self.assertRaises( | |
| 50 pyauto_errors.JSONInterfaceError, | |
| 51 lambda: self.GetNextEvent(timeout=2000)) # event queue is empty | |
| 52 | |
| 53 | |
| 54 | 45 |
| 55 if __name__ == '__main__': | 46 if __name__ == '__main__': |
| 56 pyauto_functional.Main() | 47 pyauto_functional.Main() |
| OLD | NEW |