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

Side by Side Diff: tools/perf/measurements/smoothness_unittest.py

Issue 562243004: Revert of Change PageTest.WillStartBrowser to depend on platform instead of browser object as it would not ha… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/measurements/smoothness.py ('k') | tools/perf/measurements/tab_switching.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 import sys 4 import sys
5 5
6 from measurements import smoothness 6 from measurements import smoothness
7 from metrics import power 7 from metrics import power
8 from telemetry.core import exceptions 8 from telemetry.core import exceptions
9 from telemetry.core import wpr_modes 9 from telemetry.core import wpr_modes
10 from telemetry.page import page 10 from telemetry.page import page
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 def testSyntheticDelayConfiguration(self): 61 def testSyntheticDelayConfiguration(self):
62 test_page = page.Page('http://dummy', None) 62 test_page = page.Page('http://dummy', None)
63 test_page.synthetic_delays = { 63 test_page.synthetic_delays = {
64 'cc.BeginMainFrame': { 'target_duration': 0.012 }, 64 'cc.BeginMainFrame': { 'target_duration': 0.012 },
65 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' }, 65 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' },
66 'gpu.PresentingFrame': { 'target_duration': 0.012 } 66 'gpu.PresentingFrame': { 'target_duration': 0.012 }
67 } 67 }
68 68
69 tab = FakeTab() 69 tab = FakeTab()
70 measurement = smoothness.Smoothness() 70 measurement = smoothness.Smoothness()
71 measurement.WillStartBrowser(tab.browser.platform) 71 measurement.WillStartBrowser(tab.browser)
72 measurement.WillNavigateToPage(test_page, tab) 72 measurement.WillNavigateToPage(test_page, tab)
73 measurement.WillRunActions(test_page, tab) 73 measurement.WillRunActions(test_page, tab)
74 74
75 expected_category_filter = set([ 75 expected_category_filter = set([
76 'DELAY(cc.BeginMainFrame;0.012000;static)', 76 'DELAY(cc.BeginMainFrame;0.012000;static)',
77 'DELAY(cc.DrawAndSwap;0.012000;alternating)', 77 'DELAY(cc.DrawAndSwap;0.012000;alternating)',
78 'DELAY(gpu.PresentingFrame;0.012000;static)', 78 'DELAY(gpu.PresentingFrame;0.012000;static)',
79 'benchmark' 79 'benchmark'
80 ]) 80 ])
81 tracing_controller = tab.browser.platform.tracing_controller 81 tracing_controller = tab.browser.platform.tracing_controller
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 self.start_called = True 159 self.start_called = True
160 def Stop(self, _1, _2): 160 def Stop(self, _1, _2):
161 self.stop_called = True 161 self.stop_called = True
162 162
163 ps = self.CreateEmptyPageSet() 163 ps = self.CreateEmptyPageSet()
164 ps.AddPage(FailPage(ps)) 164 ps.AddPage(FailPage(ps))
165 165
166 class BuggyMeasurement(smoothness.Smoothness): 166 class BuggyMeasurement(smoothness.Smoothness):
167 fake_power = None 167 fake_power = None
168 # Inject fake power metric. 168 # Inject fake power metric.
169 def WillStartBrowser(self, platform): 169 def WillStartBrowser(self, browser):
170 self.fake_power = self._power_metric = FakePowerMetric(platform) 170 self.fake_power = self._power_metric = FakePowerMetric(browser)
171 171
172 measurement = BuggyMeasurement() 172 measurement = BuggyMeasurement()
173 try: 173 try:
174 self.RunMeasurement(measurement, ps) 174 self.RunMeasurement(measurement, ps)
175 except page_test.TestNotSupportedOnPlatformFailure: 175 except page_test.TestNotSupportedOnPlatformFailure:
176 pass 176 pass
177 177
178 self.assertTrue(measurement.fake_power.start_called) 178 self.assertTrue(measurement.fake_power.start_called)
179 self.assertTrue(measurement.fake_power.stop_called) 179 self.assertTrue(measurement.fake_power.stop_called)
OLDNEW
« no previous file with comments | « tools/perf/measurements/smoothness.py ('k') | tools/perf/measurements/tab_switching.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698