OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 """End to end tests for ChromeDriver.""" | 6 """End to end tests for ChromeDriver.""" |
7 | 7 |
8 import base64 | 8 import base64 |
9 import json | 9 import json |
10 import optparse | 10 import optparse |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 self.assertEquals([100, 200], self._driver.GetWindowPosition()) | 624 self.assertEquals([100, 200], self._driver.GetWindowPosition()) |
625 self.assertEquals([600, 400], self._driver.GetWindowSize()) | 625 self.assertEquals([600, 400], self._driver.GetWindowSize()) |
626 | 626 |
627 def testConsoleLogSources(self): | 627 def testConsoleLogSources(self): |
628 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/console_log.html')) | 628 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/console_log.html')) |
629 logs = self._driver.GetLog('browser') | 629 logs = self._driver.GetLog('browser') |
630 self.assertEquals(len(logs), 2) | 630 self.assertEquals(len(logs), 2) |
631 self.assertEquals(logs[0]['source'], 'network') | 631 self.assertEquals(logs[0]['source'], 'network') |
632 self.assertEquals(logs[1]['source'], 'javascript') | 632 self.assertEquals(logs[1]['source'], 'javascript') |
633 | 633 |
| 634 def testAutoReporting(self): |
| 635 self.assertFalse(self._driver.IsAutoReporting()) |
| 636 self._driver.SetAutoReporting(True) |
| 637 self.assertTrue(self._driver.IsAutoReporting()) |
| 638 url = self.GetHttpUrlForFile('/chromedriver/console_log.html') |
| 639 self.assertRaisesRegexp(chromedriver.UnknownError, |
| 640 '.*404.*', |
| 641 self._driver.Load, |
| 642 url) |
| 643 |
634 def testContextMenuEventFired(self): | 644 def testContextMenuEventFired(self): |
635 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/context_menu.html')) | 645 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/context_menu.html')) |
636 self._driver.MouseMoveTo(self._driver.FindElement('tagName', 'div')) | 646 self._driver.MouseMoveTo(self._driver.FindElement('tagName', 'div')) |
637 self._driver.MouseClick(2) | 647 self._driver.MouseClick(2) |
638 self.assertTrue(self._driver.ExecuteScript('return success')) | 648 self.assertTrue(self._driver.ExecuteScript('return success')) |
639 | 649 |
640 def testHasFocusOnStartup(self): | 650 def testHasFocusOnStartup(self): |
641 # Some pages (about:blank) cause Chrome to put the focus in URL bar. | 651 # Some pages (about:blank) cause Chrome to put the focus in URL bar. |
642 # This breaks tests depending on focus. | 652 # This breaks tests depending on focus. |
643 self.assertTrue(self._driver.ExecuteScript('return document.hasFocus()')) | 653 self.assertTrue(self._driver.ExecuteScript('return document.hasFocus()')) |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 negative_filter = _GetDesktopNegativeFilter(options.chrome_version) | 915 negative_filter = _GetDesktopNegativeFilter(options.chrome_version) |
906 options.filter = '*-' + ':__main__.'.join([''] + negative_filter) | 916 options.filter = '*-' + ':__main__.'.join([''] + negative_filter) |
907 | 917 |
908 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( | 918 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( |
909 sys.modules[__name__]) | 919 sys.modules[__name__]) |
910 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) | 920 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) |
911 ChromeDriverTest.GlobalSetUp() | 921 ChromeDriverTest.GlobalSetUp() |
912 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) | 922 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) |
913 ChromeDriverTest.GlobalTearDown() | 923 ChromeDriverTest.GlobalTearDown() |
914 sys.exit(len(result.failures) + len(result.errors)) | 924 sys.exit(len(result.failures) + len(result.errors)) |
OLD | NEW |