| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import time | 6 import time |
| 7 | 7 |
| 8 from telemetry.testing import tab_test_case | 8 from telemetry.testing import tab_test_case |
| 9 from telemetry import decorators | 9 from telemetry import decorators |
| 10 from telemetry.core import util | 10 from telemetry.core import util |
| 11 | 11 |
| 12 class BrowserMinidumpTest(tab_test_case.TabTestCase): | 12 class BrowserMinidumpTest(tab_test_case.TabTestCase): |
| 13 @decorators.Isolated | 13 @decorators.Isolated |
| 14 @decorators.Enabled('mac') | 14 @decorators.Enabled('mac') |
| 15 def testSymbolizeMinidump(self): | 15 def testSymbolizeMinidump(self): |
| 16 # Wait for the browser to restart fully before crashing | 16 # Wait for the browser to restart fully before crashing |
| 17 self._LoadPageThenWait('var sam = "car";', 'sam') | 17 self._LoadPageThenWait('var sam = "car";', 'sam') |
| 18 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) | 18 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) |
| 19 crash_minidump_path = self._browser.GetMostRecentMinidumpPath() | 19 crash_minidump_path = self._browser.GetMostRecentMinidumpPath() |
| 20 #self.assertIsNotNone(crash_minidump_path) | 20 #self.assertIsNotNone(crash_minidump_path) |
| 21 | 21 |
| 22 logging.info('testSymbolizeMinidump: most recent path = ' | 22 if crash_minidump_path is not None: |
| 23 + crash_minidump_path) | 23 logging.info('testSymbolizeMinidump: most recent path = ' |
| 24 + crash_minidump_path) |
| 24 all_paths = self._browser.GetAllMinidumpPaths() | 25 all_paths = self._browser.GetAllMinidumpPaths() |
| 25 logging.info('testSymbolizeMinidump: all paths ' + ''.join(all_paths)) | 26 logging.info('testSymbolizeMinidump: all paths ' + ''.join(all_paths)) |
| 26 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() | 27 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() |
| 27 logging.info('testSymbolizeMinidump: all unsymbolized paths ' | 28 logging.info('testSymbolizeMinidump: all unsymbolized paths ' |
| 28 + ''.join(all_unsymbolized_paths)) | 29 + ''.join(all_unsymbolized_paths)) |
| 29 #self.assertTrue(len(all_unsymbolized_paths) == 1) | 30 #self.assertTrue(len(all_unsymbolized_paths) == 1) |
| 30 | 31 |
| 31 # Now symbolize that minidump and make sure there are no longer any present | 32 # Now symbolize that minidump and make sure there are no longer any present |
| 32 self._browser.SymbolizeMinidump(crash_minidump_path) | 33 self._browser.SymbolizeMinidump(crash_minidump_path) |
| 33 | 34 |
| 34 all_unsymbolized_after_symbolize_paths = \ | 35 all_unsymbolized_after_symbolize_paths = \ |
| 35 self._browser.GetAllUnsymbolizedMinidumpPaths() | 36 self._browser.GetAllUnsymbolizedMinidumpPaths() |
| 36 logging.info('testSymbolizeMinidump: after symbolize all ' | 37 logging.info('testSymbolizeMinidump: after symbolize all ' |
| 37 + 'unsymbolized paths: ' | 38 + 'unsymbolized paths: ' |
| 38 + ''.join(all_unsymbolized_after_symbolize_paths)) | 39 + ''.join(all_unsymbolized_after_symbolize_paths)) |
| 39 #self.assertTrue(len(all_unsymbolized_after_symbolize_paths) == 0) | 40 #self.assertTrue(len(all_unsymbolized_after_symbolize_paths) == 0) |
| 40 | 41 |
| 41 | 42 |
| 42 @decorators.Isolated | 43 @decorators.Isolated |
| 43 @decorators.Enabled('mac') | 44 @decorators.Enabled('mac') |
| 44 @decorators.Disabled('mac') # crbug.com/634156 | |
| 45 def testMultipleCrashMinidumps(self): | 45 def testMultipleCrashMinidumps(self): |
| 46 # Wait for the browser to restart fully before crashing | 46 # Wait for the browser to restart fully before crashing |
| 47 self._LoadPageThenWait('var cat = "dog";', 'cat') | 47 self._LoadPageThenWait('var cat = "dog";', 'cat') |
| 48 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) | 48 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) |
| 49 first_crash_path = self._browser.GetMostRecentMinidumpPath() | 49 first_crash_path = self._browser.GetMostRecentMinidumpPath() |
| 50 | 50 |
| 51 #self.assertIsNotNone(first_crash_path) | 51 #self.assertIsNotNone(first_crash_path) |
| 52 logging.info('testMultipleCrashMinidumps: first crash most recent path' | 52 if first_crash_path is not None: |
| 53 + first_crash_path) | 53 logging.info('testMultipleCrashMinidumps: first crash most recent path' |
| 54 + first_crash_path) |
| 54 all_paths = self._browser.GetAllMinidumpPaths() | 55 all_paths = self._browser.GetAllMinidumpPaths() |
| 55 logging.info('testMultipleCrashMinidumps: first crash all paths: ' | 56 logging.info('testMultipleCrashMinidumps: first crash all paths: ' |
| 56 + ''.join(all_paths)) | 57 + ''.join(all_paths)) |
| 57 #self.assertEquals(len(all_paths), 1) | 58 #self.assertEquals(len(all_paths), 1) |
| 58 #self.assertEqual(all_paths[0], first_crash_path) | 59 #self.assertEqual(all_paths[0], first_crash_path) |
| 59 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() | 60 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() |
| 60 #self.assertTrue(len(all_unsymbolized_paths) == 1) | 61 #self.assertTrue(len(all_unsymbolized_paths) == 1) |
| 61 logging.info('testMultipleCrashMinidumps: first crash all unsymbolized ' | 62 logging.info('testMultipleCrashMinidumps: first crash all unsymbolized ' |
| 62 'paths: ' + ''.join(all_unsymbolized_paths)) | 63 'paths: ' + ''.join(all_unsymbolized_paths)) |
| 63 | 64 |
| 64 # Restart the browser and then crash a second time | 65 # Restart the browser and then crash a second time |
| 65 self._RestartBrowser() | 66 self._RestartBrowser() |
| 66 | 67 |
| 67 # Start a new tab in the restarted browser | 68 # Start a new tab in the restarted browser |
| 68 self._LoadPageThenWait('var foo = "bar";', 'foo') | 69 self._LoadPageThenWait('var foo = "bar";', 'foo') |
| 69 | 70 |
| 70 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) | 71 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) |
| 71 second_crash_path = self._browser.GetMostRecentMinidumpPath() | 72 second_crash_path = self._browser.GetMostRecentMinidumpPath() |
| 72 #self.assertIsNotNone(second_crash_path) | 73 #self.assertIsNotNone(second_crash_path) |
| 73 logging.info('testMultipleCrashMinidumps: second crash most recent path' | 74 if second_crash_path is not None: |
| 74 + second_crash_path) | 75 logging.info('testMultipleCrashMinidumps: second crash most recent path' |
| 76 + second_crash_path) |
| 75 second_crash_all_paths = self._browser.GetAllMinidumpPaths() | 77 second_crash_all_paths = self._browser.GetAllMinidumpPaths() |
| 76 logging.info('testMultipleCrashMinidumps: second crash all paths: ' | 78 logging.info('testMultipleCrashMinidumps: second crash all paths: ' |
| 77 + ''.join(second_crash_all_paths)) | 79 + ''.join(second_crash_all_paths)) |
| 78 second_crash_all_unsymbolized_paths = \ | 80 second_crash_all_unsymbolized_paths = \ |
| 79 self._browser.GetAllUnsymbolizedMinidumpPaths() | 81 self._browser.GetAllUnsymbolizedMinidumpPaths() |
| 80 #self.assertTrue(len(all_unsymbolized_paths) == 1) | 82 #self.assertTrue(len(all_unsymbolized_paths) == 1) |
| 81 logging.info('testMultipleCrashMinidumps: second crash all unsymbolized ' | 83 logging.info('testMultipleCrashMinidumps: second crash all unsymbolized ' |
| 82 'paths: ' + ''.join(second_crash_all_unsymbolized_paths)) | 84 'paths: ' + ''.join(second_crash_all_unsymbolized_paths)) |
| 83 #self.assertEquals(len(second_crash_all_paths), 2) | 85 #self.assertEquals(len(second_crash_all_paths), 2) |
| 84 # Check that both paths are now present and unsymbolized | 86 # Check that both paths are now present and unsymbolized |
| (...skipping 27 matching lines...) Expand all Loading... |
| 112 # Therefore, we are adding a 5 second wait for now to see if this can help | 114 # Therefore, we are adding a 5 second wait for now to see if this can help |
| 113 # the problem until we determine if there is another chrome process we can | 115 # the problem until we determine if there is another chrome process we can |
| 114 # wait on to ensure that all browser load processes have finished | 116 # wait on to ensure that all browser load processes have finished |
| 115 time.sleep(5) | 117 time.sleep(5) |
| 116 new_tab = self._browser.tabs.New() | 118 new_tab = self._browser.tabs.New() |
| 117 new_tab.Navigate(self.UrlOfUnittestFile('blank.html'), | 119 new_tab.Navigate(self.UrlOfUnittestFile('blank.html'), |
| 118 script_to_evaluate_on_commit=script) | 120 script_to_evaluate_on_commit=script) |
| 119 # Wait until the javascript has run ensuring that | 121 # Wait until the javascript has run ensuring that |
| 120 # the new browser has restarted before we crash it again | 122 # the new browser has restarted before we crash it again |
| 121 util.WaitFor(lambda: new_tab.EvaluateJavaScript(value), 60) | 123 util.WaitFor(lambda: new_tab.EvaluateJavaScript(value), 60) |
| OLD | NEW |