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

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

Issue 165673008: [telemetry] Implement first version of timeline based measurement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for landing Created 6 years, 10 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: tools/perf/metrics/timeline_interaction_record_unittest.py
diff --git a/tools/perf/metrics/timeline_interaction_record_unittest.py b/tools/perf/metrics/timeline_interaction_record_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..99cf01707b1ee7f5e360bbe0bdebc2f2942b5061
--- /dev/null
+++ b/tools/perf/metrics/timeline_interaction_record_unittest.py
@@ -0,0 +1,46 @@
+# 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.
+
+import unittest
+
+from metrics import timeline_interaction_record
+from telemetry.core.timeline import async_slice
+
+
+class ParseTests(unittest.TestCase):
+ def testParse(self):
+ self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord(
+ 'Interaction.Foo'))
+ self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord(
+ 'Interaction.Foo/Bar'))
+ self.assertFalse(timeline_interaction_record.IsTimelineInteractionRecord(
+ 'SomethingRandom'))
+
+ def CreateRecord(self, event_name):
+ s = async_slice.AsyncSlice(
+ 'cat', event_name,
+ timestamp=1, duration=2)
+ return timeline_interaction_record.TimelineInteractionRecord(s)
+
+ def testCreate(self):
+ r = self.CreateRecord('Interaction.LogicalName')
+ self.assertEquals('LogicalName', r.logical_name)
+ self.assertEquals(False, r.is_smooth)
+ self.assertEquals(False, r.is_loading_resources)
+
+ r = self.CreateRecord('Interaction.LogicalName/is_smooth')
+ self.assertEquals('LogicalName', r.logical_name)
+ self.assertEquals(True, r.is_smooth)
+ self.assertEquals(False, r.is_loading_resources)
+
+ r = self.CreateRecord('Interaction.LogicalNameWith/Slash/is_smooth')
+ self.assertEquals('LogicalNameWith/Slash', r.logical_name)
+ self.assertEquals(True, r.is_smooth)
+ self.assertEquals(False, r.is_loading_resources)
+
+ r = self.CreateRecord(
+ 'Interaction.LogicalNameWith/Slash/is_smooth,is_loading_resources')
+ self.assertEquals('LogicalNameWith/Slash', r.logical_name)
+ self.assertEquals(True, r.is_smooth)
+ self.assertEquals(True, r.is_loading_resources)

Powered by Google App Engine
This is Rietveld 408576698