| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 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 | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import glob | |
| 7 import os | |
| 8 | |
| 9 import pyauto_functional # Must be imported before pyauto | |
| 10 import pyauto | |
| 11 import pyauto_utils | |
| 12 | |
| 13 | |
| 14 class CrashReporterTest(pyauto.PyUITest): | |
| 15 """TestCase for Crash Reporter.""" | |
| 16 | |
| 17 def testRendererCrash(self): | |
| 18 """Verify renderer's crash reporting. | |
| 19 | |
| 20 Attempts to crash, and then checks that crash dumps get generated. Does | |
| 21 not actually test crash reports on the server. | |
| 22 """ | |
| 23 # Bail out if not a branded build | |
| 24 properties = self.GetBrowserInfo()['properties'] | |
| 25 if properties['branding'] != 'Google Chrome': | |
| 26 return | |
| 27 | |
| 28 # Make sure Chrome minidumps are enabled on Chrome OS | |
| 29 if self.IsChromeOS(): | |
| 30 minidumps_file = '/mnt/stateful_partition/etc/enable_chromium_minidumps' | |
| 31 assert os.path.exists(minidumps_file), 'Chrome minidumps are not enabled.' | |
| 32 | |
| 33 breakpad_folder = properties['DIR_CRASH_DUMPS'] | |
| 34 self.assertTrue(breakpad_folder, 'Cannot figure crash dir') | |
| 35 | |
| 36 unused = pyauto_utils.ExistingPathReplacer(path=breakpad_folder) | |
| 37 # If the temp dir was created as root on chromeos, make sure chronos can | |
| 38 # write to it | |
| 39 if self.IsChromeOS() and os.geteuid() == 0: | |
| 40 os.chown(breakpad_folder, 1000, 1000) | |
| 41 self.NavigateToURL('about:crash') # Trigger renderer crash | |
| 42 dmp_files = glob.glob(os.path.join(breakpad_folder, '*.dmp')) | |
| 43 self.assertEqual(1, len(dmp_files)) | |
| 44 | |
| 45 | |
| 46 if __name__ == '__main__': | |
| 47 pyauto_functional.Main() | |
| OLD | NEW |