Index: tools/perf/core/minidump_unittest.py |
diff --git a/tools/perf/core/minidump_unittest.py b/tools/perf/core/minidump_unittest.py |
index bc3dfe09ec7a3603a1d6ad986edb50694e5aefa0..249f9567f588ca68eb5d1d435ec56aedd78a7f8f 100644 |
--- a/tools/perf/core/minidump_unittest.py |
+++ b/tools/perf/core/minidump_unittest.py |
@@ -3,6 +3,7 @@ |
# found in the LICENSE file. |
import logging |
+import time |
from telemetry.testing import tab_test_case |
from telemetry import decorators |
@@ -12,6 +13,8 @@ class BrowserMinidumpTest(tab_test_case.TabTestCase): |
@decorators.Isolated |
@decorators.Enabled('mac') |
def testSymbolizeMinidump(self): |
+ # Wait for the browser to restart fully before crashing |
+ self._LoadPageThenWait('var sam = "car";', 'sam') |
self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) |
crash_minidump_path = self._browser.GetMostRecentMinidumpPath() |
self.assertIsNotNone(crash_minidump_path) |
@@ -39,6 +42,8 @@ class BrowserMinidumpTest(tab_test_case.TabTestCase): |
@decorators.Isolated |
@decorators.Enabled('mac') |
def testMultipleCrashMinidumps(self): |
+ # Wait for the browser to restart fully before crashing |
+ self._LoadPageThenWait('var cat = "dog";', 'cat') |
self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) |
first_crash_path = self._browser.GetMostRecentMinidumpPath() |
@@ -59,12 +64,7 @@ class BrowserMinidumpTest(tab_test_case.TabTestCase): |
self._RestartBrowser() |
# Start a new tab in the restarted browser |
- new_tab = self._browser.tabs.New() |
- new_tab.Navigate('http://www.google.com/', |
- script_to_evaluate_on_commit='var foo = "bar";') |
- # Wait until the javascript has run ensuring that |
- # the new browser has restarted before we crash it again |
- util.WaitFor(lambda: new_tab.EvaluateJavaScript('foo'), 60) |
+ self._LoadPageThenWait('var foo = "bar";', 'foo') |
self._browser.tabs.New().Navigate('chrome://gpucrash', timeout=5) |
second_crash_path = self._browser.GetMostRecentMinidumpPath() |
@@ -100,3 +100,21 @@ class BrowserMinidumpTest(tab_test_case.TabTestCase): |
+ ''.join(after_symbolize_all_unsymbolized_paths)) |
#self.assertEquals(after_symbolize_all_unsymbolized_paths, |
# [first_crash_path]) |
+ |
+ def _LoadPageThenWait(self, script, value): |
+ # We are occasionally seeing these tests fail on the first load and |
+ # call to GetMostRecentMinidumpPath, where the directory is coming up empty. |
+ # We are hypothesizing, that although the browser is technically loaded, |
+ # some of chromes optimizations could still be running in the background |
+ # that potentially initializing the crash directory that we set with the |
+ # environment vairable BREAKPAD_DUMP_LOCATION in desktop_browser_backend. |
+ # Therefore, we are adding a 5 second wait for now to see if this can help |
+ # the problem until we determine if there is another chrome process we can |
+ # wait on to ensure that all browser load processes have finished |
+ time.sleep(5) |
+ new_tab = self._browser.tabs.New() |
+ new_tab.Navigate(self.UrlOfUnittestFile('blank.html'), |
+ script_to_evaluate_on_commit=script) |
+ # Wait until the javascript has run ensuring that |
+ # the new browser has restarted before we crash it again |
+ util.WaitFor(lambda: new_tab.EvaluateJavaScript(value), 60) |