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

Side by Side Diff: tools/perf/metrics/smoothness_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
« no previous file with comments | « tools/perf/metrics/smoothness.py ('k') | tools/perf/metrics/timeline.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 smoothness
8
9 from telemetry.page import page
10
11
12 class FakePlatform(object):
13 def IsRawDisplayFrameRateSupported(self):
14 return False
15
16
17 class FakeBrowser(object):
18 def __init__(self):
19 self.platform = FakePlatform()
20 self.category_filter = None
21
22 def StartTracing(self, category_filter, _):
23 self.category_filter = category_filter
24
25
26 class FakeTab(object):
27 def __init__(self):
28 self.browser = FakeBrowser()
29
30 def ExecuteJavaScript(self, js):
31 pass
32
33
34 class SmoothnessMetricUnitTest(unittest.TestCase):
35 def testSyntheticDelayConfiguration(self):
36 attributes = {
37 'synthetic_delays': {
38 'cc.BeginMainFrame': { 'target_duration': 0.012 },
39 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' },
40 'gpu.SwapBuffers': { 'target_duration': 0.012 }
41 }
42 }
43 test_page = page.Page('http://dummy', None, attributes=attributes)
44
45 tab = FakeTab()
46 smoothness_metric = smoothness.SmoothnessMetric()
47 smoothness_metric.Start(test_page, tab)
48
49 expected_category_filter = [
50 'DELAY(cc.BeginMainFrame;0.012000;static)',
51 'DELAY(cc.DrawAndSwap;0.012000;alternating)',
52 'DELAY(gpu.SwapBuffers;0.012000;static)',
53 'benchmark',
54 'webkit.console'
55 ]
56 self.assertEquals(expected_category_filter,
57 sorted(tab.browser.category_filter.split(',')))
OLDNEW
« no previous file with comments | « tools/perf/metrics/smoothness.py ('k') | tools/perf/metrics/timeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698