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

Unified Diff: tools/perf/metrics/timeline_unittest.py

Issue 140653003: Sanitize event names before adding to results object (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « tools/perf/metrics/timeline.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/timeline_unittest.py
diff --git a/tools/perf/metrics/timeline_unittest.py b/tools/perf/metrics/timeline_unittest.py
index 7f1b2afc53599780b0feadf0957090b39a090b1c..a0a7ef6f9fce53a47c75bcdfc2032531caec81bf 100644
--- a/tools/perf/metrics/timeline_unittest.py
+++ b/tools/perf/metrics/timeline_unittest.py
@@ -33,6 +33,36 @@ class TestPageMeasurementResults(
def __str__(self):
return '\n'.join([repr(x) for x in self.all_page_specific_values])
+class LoadTimesTimelineMetric(unittest.TestCase):
+ def GetResultsForModel(self, metric, model):
+ metric.model = model
+ results = TestPageMeasurementResults(self)
+ tab = None
+ metric.AddResults(tab, results)
+ return results
+
+ def testSanitizing(self):
+ model = model_module.TimelineModel()
+ renderer_main = model.GetOrCreateProcess(1).GetOrCreateThread(2)
+ renderer_main.name = 'CrRendererMain'
+
+ # [ X ]
+ # [ Y ]
+ renderer_main.BeginSlice('cat1', 'x.y', 10, 0)
+ renderer_main.EndSlice(20, 20)
+ model.FinalizeImport()
+
+ metric = timeline.LoadTimesTimelineMetric(timeline.TRACING_MODE)
+ metric.renderer_process = renderer_main.parent
+ results = self.GetResultsForModel(metric, model)
+ results.AssertHasPageSpecificScalarValue(
+ 'CrRendererMain|x_y', 'ms', 10)
+ results.AssertHasPageSpecificScalarValue(
+ 'CrRendererMain|x_y_max', 'ms', 10)
+ results.AssertHasPageSpecificScalarValue(
+ 'CrRendererMain|x_y_avg', 'ms', 10)
+
+
class ThreadTimesTimelineMetricUnittest(unittest.TestCase):
def GetResultsForModel(self, metric, model):
metric.model = model
« no previous file with comments | « tools/perf/metrics/timeline.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698