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

Side by Side Diff: tools/perf/core/minidump_unittest.py

Issue 2184263004: Integration test for minidump paths, adding in wait time to make sure the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6
7 from telemetry.testing import tab_test_case 7 from telemetry.testing import tab_test_case
8 from telemetry import decorators 8 from telemetry import decorators
9 from telemetry.core import util 9 from telemetry.core import util
10 10
11 class BrowserMinidumpTest(tab_test_case.TabTestCase): 11 class BrowserMinidumpTest(tab_test_case.TabTestCase):
12 @decorators.Isolated 12 @decorators.Isolated
13 @decorators.Enabled('mac') 13 @decorators.Enabled('mac')
14 def testSymbolizeMinidump(self): 14 def testSymbolizeMinidump(self):
15 # Wait for the browser to restart fully before crashing
16 self._loadPageAndWait('var sam = "car";', 'sam')
15 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) 17 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5)
16 crash_minidump_path = self._browser.GetMostRecentMinidumpPath() 18 crash_minidump_path = self._browser.GetMostRecentMinidumpPath()
17 self.assertIsNotNone(crash_minidump_path) 19 self.assertIsNotNone(crash_minidump_path)
18 20
19 logging.info('testSymbolizeMinidump: most recent path = ' 21 logging.info('testSymbolizeMinidump: most recent path = '
20 + crash_minidump_path) 22 + crash_minidump_path)
21 all_paths = self._browser.GetAllMinidumpPaths() 23 all_paths = self._browser.GetAllMinidumpPaths()
22 logging.info('testSymbolizeMinidump: all paths ' + ''.join(all_paths)) 24 logging.info('testSymbolizeMinidump: all paths ' + ''.join(all_paths))
23 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() 25 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths()
24 logging.info('testSymbolizeMinidump: all unsymbolized paths ' 26 logging.info('testSymbolizeMinidump: all unsymbolized paths '
25 + ''.join(all_unsymbolized_paths)) 27 + ''.join(all_unsymbolized_paths))
26 #self.assertTrue(len(all_unsymbolized_paths) == 1) 28 #self.assertTrue(len(all_unsymbolized_paths) == 1)
27 29
28 # Now symbolize that minidump and make sure there are no longer any present 30 # Now symbolize that minidump and make sure there are no longer any present
29 self._browser.SymbolizeMinidump(crash_minidump_path) 31 self._browser.SymbolizeMinidump(crash_minidump_path)
30 32
31 all_unsymbolized_after_symbolize_paths = \ 33 all_unsymbolized_after_symbolize_paths = \
32 self._browser.GetAllUnsymbolizedMinidumpPaths() 34 self._browser.GetAllUnsymbolizedMinidumpPaths()
33 logging.info('testSymbolizeMinidump: after symbolize all ' 35 logging.info('testSymbolizeMinidump: after symbolize all '
34 + 'unsymbolized paths: ' 36 + 'unsymbolized paths: '
35 + ''.join(all_unsymbolized_after_symbolize_paths)) 37 + ''.join(all_unsymbolized_after_symbolize_paths))
36 #self.assertTrue(len(all_unsymbolized_after_symbolize_paths) == 0) 38 #self.assertTrue(len(all_unsymbolized_after_symbolize_paths) == 0)
37 39
38 40
39 @decorators.Isolated 41 @decorators.Isolated
40 @decorators.Enabled('mac') 42 @decorators.Enabled('mac')
41 def testMultipleCrashMinidumps(self): 43 def testMultipleCrashMinidumps(self):
44 # Wait for the browser to restart fully before crashing
45 self._loadPageAndWait('var cat = "dog";', 'cat')
42 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) 46 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5)
43 first_crash_path = self._browser.GetMostRecentMinidumpPath() 47 first_crash_path = self._browser.GetMostRecentMinidumpPath()
44 48
45 self.assertIsNotNone(first_crash_path) 49 self.assertIsNotNone(first_crash_path)
46 logging.info('testMultipleCrashMinidumps: first crash most recent path' 50 logging.info('testMultipleCrashMinidumps: first crash most recent path'
47 + first_crash_path) 51 + first_crash_path)
48 all_paths = self._browser.GetAllMinidumpPaths() 52 all_paths = self._browser.GetAllMinidumpPaths()
49 logging.info('testMultipleCrashMinidumps: first crash all paths: ' 53 logging.info('testMultipleCrashMinidumps: first crash all paths: '
50 + ''.join(all_paths)) 54 + ''.join(all_paths))
51 #self.assertEquals(len(all_paths), 1) 55 #self.assertEquals(len(all_paths), 1)
52 #self.assertEqual(all_paths[0], first_crash_path) 56 #self.assertEqual(all_paths[0], first_crash_path)
53 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths() 57 all_unsymbolized_paths = self._browser.GetAllUnsymbolizedMinidumpPaths()
54 #self.assertTrue(len(all_unsymbolized_paths) == 1) 58 #self.assertTrue(len(all_unsymbolized_paths) == 1)
55 logging.info('testMultipleCrashMinidumps: first crash all unsymbolized ' 59 logging.info('testMultipleCrashMinidumps: first crash all unsymbolized '
56 'paths: ' + ''.join(all_unsymbolized_paths)) 60 'paths: ' + ''.join(all_unsymbolized_paths))
57 61
58 # Restart the browser and then crash a second time 62 # Restart the browser and then crash a second time
59 self._RestartBrowser() 63 self._RestartBrowser()
60 64
61 # Start a new tab in the restarted browser 65 # Start a new tab in the restarted browser
62 new_tab = self._browser.tabs.New() 66 self._loadPageAndWait('var foo = "bar";', 'foo')
63 new_tab.Navigate('http://www.google.com/',
64 script_to_evaluate_on_commit='var foo = "bar";')
65 # Wait until the javascript has run ensuring that
66 # the new browser has restarted before we crash it again
67 util.WaitFor(lambda: new_tab.EvaluateJavaScript('foo'), 60)
68 67
69 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) 68 self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5)
70 second_crash_path = self._browser.GetMostRecentMinidumpPath() 69 second_crash_path = self._browser.GetMostRecentMinidumpPath()
71 self.assertIsNotNone(second_crash_path) 70 self.assertIsNotNone(second_crash_path)
72 logging.info('testMultipleCrashMinidumps: second crash most recent path' 71 logging.info('testMultipleCrashMinidumps: second crash most recent path'
73 + second_crash_path) 72 + second_crash_path)
74 second_crash_all_paths = self._browser.GetAllMinidumpPaths() 73 second_crash_all_paths = self._browser.GetAllMinidumpPaths()
75 logging.info('testMultipleCrashMinidumps: second crash all paths: ' 74 logging.info('testMultipleCrashMinidumps: second crash all paths: '
76 + ''.join(second_crash_all_paths)) 75 + ''.join(second_crash_all_paths))
77 second_crash_all_unsymbolized_paths = \ 76 second_crash_all_unsymbolized_paths = \
(...skipping 15 matching lines...) Expand all
93 logging.info('testMultipleCrashMinidumps: after symbolize all paths: ' 92 logging.info('testMultipleCrashMinidumps: after symbolize all paths: '
94 + ''.join(after_symbolize_all_paths)) 93 + ''.join(after_symbolize_all_paths))
95 #self.assertEquals(len(after_symbolize_all_paths), 2) 94 #self.assertEquals(len(after_symbolize_all_paths), 2)
96 after_symbolize_all_unsymbolized_paths = \ 95 after_symbolize_all_unsymbolized_paths = \
97 self._browser.GetAllUnsymbolizedMinidumpPaths() 96 self._browser.GetAllUnsymbolizedMinidumpPaths()
98 logging.info('testMultipleCrashMinidumps: after symbolize all ' 97 logging.info('testMultipleCrashMinidumps: after symbolize all '
99 + 'unsymbolized paths: ' 98 + 'unsymbolized paths: '
100 + ''.join(after_symbolize_all_unsymbolized_paths)) 99 + ''.join(after_symbolize_all_unsymbolized_paths))
101 #self.assertEquals(after_symbolize_all_unsymbolized_paths, 100 #self.assertEquals(after_symbolize_all_unsymbolized_paths,
102 # [first_crash_path]) 101 # [first_crash_path])
102
103 def _loadPageAndWait(self, script, value):
nednguyen 2016/07/28 15:44:47 nits: _LoadPageThenWait(self, script, value): Our
eyaich 2016/07/28 15:55:52 Done.
104 new_tab = self._browser.tabs.New()
105 new_tab.Navigate('http://www.google.com/',
nednguyen 2016/07/28 15:44:48 http://www.google.com would probably hit real netw
eyaich 2016/07/28 15:55:52 I think we actually want to hit a real web page an
eyaich 2016/07/28 16:59:02 Talked offline, I have changed this now. Done.
106 script_to_evaluate_on_commit=script)
107 # Wait until the javascript has run ensuring that
108 # the new browser has restarted before we crash it again
109 util.WaitFor(lambda: new_tab.EvaluateJavaScript(value), 60)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698