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

Side by Side Diff: tools/perf/metrics/timeline_interaction_record_unittest.py

Issue 200843002: Convert smoothness to the new timeline based metric API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 from metrics import timeline_interaction_record 7 from metrics import timeline_interaction_record
8 from telemetry.core.timeline import async_slice 8 from telemetry.core.timeline import async_slice
9 9
10 10
11 class ParseTests(unittest.TestCase): 11 class ParseTests(unittest.TestCase):
12 def testParse(self): 12 def testParse(self):
13 self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord( 13 self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord(
14 'Interaction.Foo')) 14 'Interaction.Foo'))
15 self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord( 15 self.assertTrue(timeline_interaction_record.IsTimelineInteractionRecord(
16 'Interaction.Foo/Bar')) 16 'Interaction.Foo/Bar'))
17 self.assertFalse(timeline_interaction_record.IsTimelineInteractionRecord( 17 self.assertFalse(timeline_interaction_record.IsTimelineInteractionRecord(
18 'SomethingRandom')) 18 'SomethingRandom'))
19 19
20 def CreateRecord(self, event_name): 20 def CreateRecord(self, event_name):
21 s = async_slice.AsyncSlice( 21 s = async_slice.AsyncSlice(
22 'cat', event_name, 22 'cat', event_name,
23 timestamp=1, duration=2) 23 timestamp=1, duration=2)
24 return timeline_interaction_record.TimelineInteractionRecord(s) 24 return timeline_interaction_record.TimelineInteractionRecord.FromEvent(s)
25 25
26 def testCreate(self): 26 def testCreate(self):
27 r = self.CreateRecord('Interaction.LogicalName') 27 r = self.CreateRecord('Interaction.LogicalName')
28 self.assertEquals('LogicalName', r.logical_name) 28 self.assertEquals('LogicalName', r.logical_name)
29 self.assertEquals(False, r.is_smooth) 29 self.assertEquals(False, r.is_smooth)
30 self.assertEquals(False, r.is_loading_resources) 30 self.assertEquals(False, r.is_loading_resources)
31 31
32 r = self.CreateRecord('Interaction.LogicalName/is_smooth') 32 r = self.CreateRecord('Interaction.LogicalName/is_smooth')
33 self.assertEquals('LogicalName', r.logical_name) 33 self.assertEquals('LogicalName', r.logical_name)
34 self.assertEquals(True, r.is_smooth) 34 self.assertEquals(True, r.is_smooth)
35 self.assertEquals(False, r.is_loading_resources) 35 self.assertEquals(False, r.is_loading_resources)
36 36
37 r = self.CreateRecord('Interaction.LogicalNameWith/Slash/is_smooth') 37 r = self.CreateRecord('Interaction.LogicalNameWith/Slash/is_smooth')
38 self.assertEquals('LogicalNameWith/Slash', r.logical_name) 38 self.assertEquals('LogicalNameWith/Slash', r.logical_name)
39 self.assertEquals(True, r.is_smooth) 39 self.assertEquals(True, r.is_smooth)
40 self.assertEquals(False, r.is_loading_resources) 40 self.assertEquals(False, r.is_loading_resources)
41 41
42 r = self.CreateRecord( 42 r = self.CreateRecord(
43 'Interaction.LogicalNameWith/Slash/is_smooth,is_loading_resources') 43 'Interaction.LogicalNameWith/Slash/is_smooth,is_loading_resources')
44 self.assertEquals('LogicalNameWith/Slash', r.logical_name) 44 self.assertEquals('LogicalNameWith/Slash', r.logical_name)
45 self.assertEquals(True, r.is_smooth) 45 self.assertEquals(True, r.is_smooth)
46 self.assertEquals(True, r.is_loading_resources) 46 self.assertEquals(True, r.is_loading_resources)
OLDNEW
« no previous file with comments | « tools/perf/metrics/timeline_interaction_record.py ('k') | tools/telemetry/telemetry/page/page.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698