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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from metrics import timeline_interaction_record
8 from telemetry.core.timeline import async_slice
9
10
11 class ParseTests(unittest.TestCase):
12 def testParse(self):
13 self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord(
14 'Interaction.Foo'))
15 self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord(
16 'Interaction.Foo/Bar'))
17 self.assertFalse(timeline_interaction_record.IsTimelineInteractionRecord(
18 'SomethingRandom'))
19
20 def CreateRecord(self, event_name):
21 s = async_slice.AsyncSlice(
22 'cat', event_name,
23 timestamp=1, duration=2)
24 return timeline_interaction_record.TimelineInteractionRecord(s)
25
26 def testCreate(self):
27 r = self.CreateRecord('Interaction.LogicalName')
28 self.assertEquals('LogicalName', r.logical_name)
29 self.assertEquals(False, r.is_smooth)
30 self.assertEquals(False, r.is_loading_resources)
31
32 r = self.CreateRecord('Interaction.LogicalName/is_smooth')
33 self.assertEquals('LogicalName', r.logical_name)
34 self.assertEquals(True, r.is_smooth)
35 self.assertEquals(False, r.is_loading_resources)
36
37 r = self.CreateRecord('Interaction.LogicalNameWith/Slash/is_smooth')
38 self.assertEquals('LogicalNameWith/Slash', r.logical_name)
39 self.assertEquals(True, r.is_smooth)
40 self.assertEquals(False, r.is_loading_resources)
41
42 r = self.CreateRecord(
43 'Interaction.LogicalNameWith/Slash/is_smooth,is_loading_resources')
44 self.assertEquals('LogicalNameWith/Slash', r.logical_name)
45 self.assertEquals(True, r.is_smooth)
46 self.assertEquals(True, r.is_loading_resources)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698