Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/test/chromedriver/test/run_py_tests.py

Issue 868153002: [chromedriver] Make testConsoleLogSources handle missing favicon error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/chromedriver/console_log.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 math 10 import math
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 # Set size first so that the window isn't moved offscreen. 719 # Set size first so that the window isn't moved offscreen.
720 # See https://code.google.com/p/chromedriver/issues/detail?id=297. 720 # See https://code.google.com/p/chromedriver/issues/detail?id=297.
721 self._driver.SetWindowSize(600, 400) 721 self._driver.SetWindowSize(600, 400)
722 self._driver.SetWindowPosition(100, 200) 722 self._driver.SetWindowPosition(100, 200)
723 self.assertEquals([100, 200], self._driver.GetWindowPosition()) 723 self.assertEquals([100, 200], self._driver.GetWindowPosition())
724 self.assertEquals([600, 400], self._driver.GetWindowSize()) 724 self.assertEquals([600, 400], self._driver.GetWindowSize())
725 725
726 def testConsoleLogSources(self): 726 def testConsoleLogSources(self):
727 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/console_log.html')) 727 self._driver.Load(self.GetHttpUrlForFile('/chromedriver/console_log.html'))
728 logs = self._driver.GetLog('browser') 728 logs = self._driver.GetLog('browser')
729 self.assertEquals(len(logs), 2) 729
730 self.assertEquals(logs[0]['source'], 'network') 730 self.assertEqual('network', logs[0]['source'])
731 self.assertEquals(logs[1]['source'], 'javascript') 731 self.assertTrue('nonexistent.png' in logs[0]['message'])
732 self.assertTrue('404' in logs[0]['message'])
733
734 self.assertEqual('javascript', logs[1]['source'])
735 self.assertTrue('TypeError' in logs[1]['message'])
736
737 # Sometimes, we also get an error for a missing favicon.
stgao 2015/01/23 19:45:55 Just FYI: another idea is to add a dummy favicon t
738 if len(logs) > 2:
739 self.assertEqual('network', logs[2]['source'])
740 self.assertTrue('favicon.ico' in logs[2]['message'])
741 self.assertTrue('404' in logs[2]['message'])
742 self.assertEqual(3, len(logs))
743 else:
744 self.assertEqual(2, len(logs))
732 745
733 def testAutoReporting(self): 746 def testAutoReporting(self):
734 self.assertFalse(self._driver.IsAutoReporting()) 747 self.assertFalse(self._driver.IsAutoReporting())
735 self._driver.SetAutoReporting(True) 748 self._driver.SetAutoReporting(True)
736 self.assertTrue(self._driver.IsAutoReporting()) 749 self.assertTrue(self._driver.IsAutoReporting())
737 url = self.GetHttpUrlForFile('/chromedriver/console_log.html') 750 url = self.GetHttpUrlForFile('/chromedriver/console_log.html')
738 self.assertRaisesRegexp(chromedriver.UnknownError, 751 self.assertRaisesRegexp(chromedriver.UnknownError,
739 '.*(404|Failed to load resource).*', 752 '.*(404|Failed to load resource).*',
740 self._driver.Load, 753 self._driver.Load,
741 url) 754 url)
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 1445
1433 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule( 1446 all_tests_suite = unittest.defaultTestLoader.loadTestsFromModule(
1434 sys.modules[__name__]) 1447 sys.modules[__name__])
1435 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter) 1448 tests = unittest_util.FilterTestSuite(all_tests_suite, options.filter)
1436 ChromeDriverTest.GlobalSetUp() 1449 ChromeDriverTest.GlobalSetUp()
1437 MobileEmulationCapabilityTest.GlobalSetUp() 1450 MobileEmulationCapabilityTest.GlobalSetUp()
1438 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests) 1451 result = unittest.TextTestRunner(stream=sys.stdout, verbosity=2).run(tests)
1439 ChromeDriverTest.GlobalTearDown() 1452 ChromeDriverTest.GlobalTearDown()
1440 MobileEmulationCapabilityTest.GlobalTearDown() 1453 MobileEmulationCapabilityTest.GlobalTearDown()
1441 sys.exit(len(result.failures) + len(result.errors)) 1454 sys.exit(len(result.failures) + len(result.errors))
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/chromedriver/console_log.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698