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

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

Issue 826113003: [Telemetry] Rename RunSmoothness to RunPageInteractions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « tools/perf/measurements/smoothness.py ('k') | tools/perf/measurements/task_execution_time.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 import decorators 8 from telemetry import decorators
9 from telemetry.core import exceptions 9 from telemetry.core import exceptions
10 from telemetry.core import wpr_modes 10 from telemetry.core import wpr_modes
(...skipping 21 matching lines...) Expand all
32 def __init__(self): 32 def __init__(self):
33 self.platform = FakePlatform() 33 self.platform = FakePlatform()
34 34
35 35
36 class AnimatedPage(page.Page): 36 class AnimatedPage(page.Page):
37 def __init__(self, page_set): 37 def __init__(self, page_set):
38 super(AnimatedPage, self).__init__( 38 super(AnimatedPage, self).__init__(
39 url='file://animated_page.html', 39 url='file://animated_page.html',
40 page_set=page_set, base_dir=page_set.base_dir) 40 page_set=page_set, base_dir=page_set.base_dir)
41 41
42 def RunSmoothness(self, action_runner): 42 def RunPageInteractions(self, action_runner):
43 action_runner.Wait(.2) 43 action_runner.Wait(.2)
44 44
45 45
46 class FakeTab(object): 46 class FakeTab(object):
47 def __init__(self): 47 def __init__(self):
48 self.browser = FakeBrowser() 48 self.browser = FakeBrowser()
49 49
50 def ExecuteJavaScript(self, js): 50 def ExecuteJavaScript(self, js):
51 pass 51 pass
52 52
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 def testCleanUpTrace(self): 168 def testCleanUpTrace(self):
169 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) 169 self.TestTracingCleanedUp(smoothness.Smoothness, self._options)
170 170
171 def testCleanUpPowerMetric(self): 171 def testCleanUpPowerMetric(self):
172 class FailPage(page.Page): 172 class FailPage(page.Page):
173 def __init__(self, page_set): 173 def __init__(self, page_set):
174 # pylint: disable=bad-super-call 174 # pylint: disable=bad-super-call
175 super(FailPage, self).__init__( 175 super(FailPage, self).__init__(
176 url='file://blank.html', 176 url='file://blank.html',
177 page_set=page_set, base_dir=page_set.base_dir) 177 page_set=page_set, base_dir=page_set.base_dir)
178 def RunSmoothness(self, _): 178 def RunPageInteractions(self, _):
179 raise exceptions.IntentionalException 179 raise exceptions.IntentionalException
180 180
181 class FakePowerMetric(power.PowerMetric): 181 class FakePowerMetric(power.PowerMetric):
182 start_called = False 182 start_called = False
183 stop_called = True 183 stop_called = True
184 def Start(self, _1, _2): 184 def Start(self, _1, _2):
185 self.start_called = True 185 self.start_called = True
186 def Stop(self, _1, _2): 186 def Stop(self, _1, _2):
187 self.stop_called = True 187 self.stop_called = True
188 188
189 ps = self.CreateEmptyPageSet() 189 ps = self.CreateEmptyPageSet()
190 ps.AddUserStory(FailPage(ps)) 190 ps.AddUserStory(FailPage(ps))
191 191
192 class BuggyMeasurement(smoothness.Smoothness): 192 class BuggyMeasurement(smoothness.Smoothness):
193 fake_power = None 193 fake_power = None
194 # Inject fake power metric. 194 # Inject fake power metric.
195 def WillStartBrowser(self, platform): 195 def WillStartBrowser(self, platform):
196 self.fake_power = self._power_metric = FakePowerMetric(platform) 196 self.fake_power = self._power_metric = FakePowerMetric(platform)
197 197
198 measurement = BuggyMeasurement() 198 measurement = BuggyMeasurement()
199 try: 199 try:
200 self.RunMeasurement(measurement, ps) 200 self.RunMeasurement(measurement, ps)
201 except exceptions.IntentionalException: 201 except exceptions.IntentionalException:
202 pass 202 pass
203 203
204 self.assertTrue(measurement.fake_power.start_called) 204 self.assertTrue(measurement.fake_power.start_called)
205 self.assertTrue(measurement.fake_power.stop_called) 205 self.assertTrue(measurement.fake_power.stop_called)
OLDNEW
« no previous file with comments | « tools/perf/measurements/smoothness.py ('k') | tools/perf/measurements/task_execution_time.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698