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

Unified Diff: telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py

Issue 2053313002: [telemetry] Expose log file contents in telemetry.internal.browser.Browser (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Change decorator name Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
diff --git a/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py b/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
index 08d30d4bfcf1667103a7caa464a9d353f0616efa..2132dbff8435dcfa7ea329091b8ca66f97c5b3bb 100644
--- a/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
+++ b/telemetry/telemetry/internal/backends/chrome_inspector/tracing_backend_unittest.py
@@ -18,7 +18,7 @@ from telemetry.timeline import trace_data
from telemetry.timeline import tracing_config
-def PrintBrowserStandardOutputOnFailure(test):
+def PrintBrowserStandardOutputAndLogOnFailure(test):
@wraps(test)
def WrappedTest(self):
try: # pylint: disable=broad-except
@@ -33,6 +33,13 @@ def PrintBrowserStandardOutputOnFailure(test):
logging.exception('Failed to get browser standard output:')
logging.info('========== END BROWSER STANDARD OUTPUT ==========')
+ logging.info('========== BEGIN BROWSER LOG ==========')
+ try: # pylint: disable=broad-except
+ logging.info(self._browser.GetLogFileContents())
+ except Exception:
+ logging.exception('Failed to get browser log:')
+ logging.info('========== END BROWSER LOG ==========')
+
# Re-raise the original exception. Note that we can't just use 'raise'
# without any arguments because an exception might have been thrown when
# the browser standard output was retrieved.
@@ -65,7 +72,7 @@ class TracingBackendTest(tab_test_case.TabTestCase):
if not self._browser.supports_memory_dumping:
self.skipTest('Browser does not support memory dumping, skipping test.')
- @PrintBrowserStandardOutputOnFailure
+ @PrintBrowserStandardOutputAndLogOnFailure
def testDumpMemorySuccess(self):
# Check that dumping memory before tracing starts raises an exception.
self.assertRaises(Exception, self._browser.DumpMemory)
@@ -108,7 +115,7 @@ class TracingBackendTest(tab_test_case.TabTestCase):
actual_dump_ids = [d.dump_id for d in model.IterGlobalMemoryDumps()]
self.assertEqual(actual_dump_ids, expected_dump_ids)
- @PrintBrowserStandardOutputOnFailure
+ @PrintBrowserStandardOutputAndLogOnFailure
def testDumpMemoryFailure(self):
# Check that dumping memory before tracing starts raises an exception.
self.assertRaises(Exception, self._browser.DumpMemory)
« no previous file with comments | « telemetry/telemetry/internal/backends/browser_backend_unittest.py ('k') | telemetry/telemetry/internal/browser/browser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698