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

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

Issue 170183004: Move smoothness to the new API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit
Patch Set: Reset actions list. Modify repaint measurement. 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 side-by-side diff with in-line comments
Download patch
Index: tools/perf/measurements/smoothness_unittest.py
diff --git a/tools/perf/measurements/smoothness_unittest.py b/tools/perf/measurements/smoothness_unittest.py
index deacd37705c4681571d011e768a9c956a78e2b47..def81410b478fc90d72ec0a4a63f933c12f2e42a 100644
--- a/tools/perf/measurements/smoothness_unittest.py
+++ b/tools/perf/measurements/smoothness_unittest.py
@@ -3,9 +3,31 @@
# found in the LICENSE file.
from measurements import smoothness
from telemetry.core import wpr_modes
+from telemetry.page import page
from telemetry.page import page_measurement_unittest_base
from telemetry.unittest import options_for_unittests
+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 SmoothnessUnitTest(
page_measurement_unittest_base.PageMeasurementUnitTestBase):
"""Smoke test for smoothness measurement
@@ -14,8 +36,31 @@ class SmoothnessUnitTest(
that all metrics were added to the results. The test is purely functional,
i.e. it only checks if the metrics are present and non-zero.
"""
+ 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()
+ measurement = smoothness.Smoothness()
+ measurement.WillRunActions(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(',')))
def setUp(self):
+
self._options = options_for_unittests.GetCopy()
self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
« no previous file with comments | « tools/perf/measurements/smoothness_controller.py ('k') | tools/perf/measurements/timeline_based_measurement.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698