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

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

Issue 103143007: telemetry: Use trace categories to configure synthetic delays (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added scheduler benchmark and unittest. 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/smoothness.py ('k') | tools/perf/page_sets/tough_scheduling_cases.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/metrics/smoothness_unittest.py
diff --git a/tools/perf/metrics/smoothness_unittest.py b/tools/perf/metrics/smoothness_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..afcaed71750141a5db3d8f253b526fd0166ee134
--- /dev/null
+++ b/tools/perf/metrics/smoothness_unittest.py
@@ -0,0 +1,57 @@
+# 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 smoothness
+
+from telemetry.page import page
+
+
+class FakePlatform(object):
+ def IsRawDisplayFrameRateSupported(self):
+ return False
+
+
+class FakeBrowser(object):
+ def __init__(self):
+ self.platform = FakePlatform()
+ self.category_filter = None
+
+ def StartTracing(self, category_filter, _):
+ self.category_filter = category_filter
+
+
+class FakeTab(object):
+ def __init__(self):
+ self.browser = FakeBrowser()
+
+ def ExecuteJavaScript(self, js):
+ pass
+
+
+class SmoothnessMetricUnitTest(unittest.TestCase):
+ def testSyntheticDelayConfiguration(self):
+ attributes = {
+ 'synthetic_delays': {
+ 'cc.BeginMainFrame': { 'target_duration': 0.012 },
+ 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' },
+ 'gpu.SwapBuffers': { 'target_duration': 0.012 }
+ }
+ }
+ test_page = page.Page('http://dummy', None, attributes=attributes)
+
+ tab = FakeTab()
+ smoothness_metric = smoothness.SmoothnessMetric()
+ smoothness_metric.Start(test_page, tab)
+
+ expected_category_filter = [
+ 'DELAY(cc.BeginMainFrame;0.012000;static)',
+ 'DELAY(cc.DrawAndSwap;0.012000;alternating)',
+ 'DELAY(gpu.SwapBuffers;0.012000;static)',
+ 'benchmark',
+ 'webkit.console'
+ ]
+ self.assertEquals(expected_category_filter,
+ sorted(tab.browser.category_filter.split(',')))
« no previous file with comments | « tools/perf/metrics/smoothness.py ('k') | tools/perf/page_sets/tough_scheduling_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698