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.
9 import pyauto_functional # Must be imported before pyauto
14 class CrashReporterTest(pyauto.PyUITest):
15 """TestCase for Crash Reporter."""
17 def testRendererCrash(self):
18 """Verify renderer's crash reporting.
20 Attempts to crash, and then checks that crash dumps get generated. Does
21 not actually test crash reports on the server.
23 # Bail out if not a branded build
24 properties = self.GetBrowserInfo()['properties']
25 if properties['branding'] != 'Google Chrome':
28 # Make sure Chrome minidumps are enabled on Chrome OS
30 minidumps_file = '/mnt/stateful_partition/etc/enable_chromium_minidumps'
31 assert os.path.exists(minidumps_file), 'Chrome minidumps are not enabled.'
33 breakpad_folder = properties['DIR_CRASH_DUMPS']
34 self.assertTrue(breakpad_folder, 'Cannot figure crash dir')
36 unused = pyauto_utils.ExistingPathReplacer(path=breakpad_folder)
37 # If the temp dir was created as root on chromeos, make sure chronos can
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))
46 if __name__ == '__main__':
47 pyauto_functional.Main()