Commit 695d99e1 authored by nduca@chromium.org's avatar nduca@chromium.org

Make empty traces a non-critical error

Its okay for a trace to come back with no data in it. Right now,
this actually causes catastrophic failure.

R=tonyg

Review URL: https://codereview.chromium.org/141553009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247924 0039d316-1c4b-4281-b951-d872f2087c98
parent bcb53e58
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
class EmptyTraceImporter(object):
"""Imports empty traces."""
def __init__(self, model, event_data, import_priority=0):
pass
@staticmethod
def CanImport(event_data):
if isinstance(event_data, list):
return len(event_data) == 0
elif isinstance(event_data, basestring):
return len(event_data) == 0
return False
def ImportEvents(self):
pass
def FinalizeImport(self):
pass
......@@ -15,11 +15,13 @@ from telemetry.core import web_contents
from telemetry.core import browser
# Register importers for data
from telemetry.core.timeline import inspector_importer
from telemetry.core.timeline import bounds
from telemetry.core.timeline import empty_trace_importer
from telemetry.core.timeline import inspector_importer
from telemetry.core.timeline import trace_event_importer
_IMPORTERS = [
empty_trace_importer.EmptyTraceImporter,
inspector_importer.InspectorTimelineImporter,
trace_event_importer.TraceEventTimelineImporter
]
......
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.core.timeline import model
class TimelineModelUnittest(unittest.TestCase):
pass
def testEmptyImport(self):
model.TimelineModel([])
model.TimelineModel('')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment