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

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

Issue 800863003: Kill PageSet.AddPage and its remaining usage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 mean_input_event_latency = results.FindAllPageSpecificValuesNamed( 124 mean_input_event_latency = results.FindAllPageSpecificValuesNamed(
125 'mean_input_event_latency') 125 'mean_input_event_latency')
126 if mean_input_event_latency: 126 if mean_input_event_latency:
127 self.assertEquals(len(mean_input_event_latency), 1) 127 self.assertEquals(len(mean_input_event_latency), 1)
128 self.assertGreater( 128 self.assertGreater(
129 mean_input_event_latency[0].GetRepresentativeNumber(), 0) 129 mean_input_event_latency[0].GetRepresentativeNumber(), 0)
130 130
131 @test.Disabled('mac', 'chromeos') # http://crbug.com/403903 131 @test.Disabled('mac', 'chromeos') # http://crbug.com/403903
132 def testSmoothnessForPageWithNoGesture(self): 132 def testSmoothnessForPageWithNoGesture(self):
133 ps = self.CreateEmptyPageSet() 133 ps = self.CreateEmptyPageSet()
134 ps.AddPage(AnimatedPage(ps)) 134 ps.AddUserStory(AnimatedPage(ps))
135 135
136 measurement = smoothness.Smoothness() 136 measurement = smoothness.Smoothness()
137 results = self.RunMeasurement(measurement, ps, options=self._options) 137 results = self.RunMeasurement(measurement, ps, options=self._options)
138 self.assertEquals(0, len(results.failures)) 138 self.assertEquals(0, len(results.failures))
139 139
140 percentage_smooth = results.FindAllPageSpecificValuesNamed( 140 percentage_smooth = results.FindAllPageSpecificValuesNamed(
141 'percentage_smooth') 141 'percentage_smooth')
142 self.assertEquals(len(percentage_smooth), 1) 142 self.assertEquals(len(percentage_smooth), 1)
143 self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) 143 self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0)
144 144
(...skipping 12 matching lines...) Expand all
157 157
158 class FakePowerMetric(power.PowerMetric): 158 class FakePowerMetric(power.PowerMetric):
159 start_called = False 159 start_called = False
160 stop_called = True 160 stop_called = True
161 def Start(self, _1, _2): 161 def Start(self, _1, _2):
162 self.start_called = True 162 self.start_called = True
163 def Stop(self, _1, _2): 163 def Stop(self, _1, _2):
164 self.stop_called = True 164 self.stop_called = True
165 165
166 ps = self.CreateEmptyPageSet() 166 ps = self.CreateEmptyPageSet()
167 ps.AddPage(FailPage(ps)) 167 ps.AddUserStory(FailPage(ps))
168 168
169 class BuggyMeasurement(smoothness.Smoothness): 169 class BuggyMeasurement(smoothness.Smoothness):
170 fake_power = None 170 fake_power = None
171 # Inject fake power metric. 171 # Inject fake power metric.
172 def WillStartBrowser(self, platform): 172 def WillStartBrowser(self, platform):
173 self.fake_power = self._power_metric = FakePowerMetric(platform) 173 self.fake_power = self._power_metric = FakePowerMetric(platform)
174 174
175 measurement = BuggyMeasurement() 175 measurement = BuggyMeasurement()
176 try: 176 try:
177 self.RunMeasurement(measurement, ps) 177 self.RunMeasurement(measurement, ps)
178 except exceptions.IntentionalException: 178 except exceptions.IntentionalException:
179 pass 179 pass
180 180
181 self.assertTrue(measurement.fake_power.start_called) 181 self.assertTrue(measurement.fake_power.start_called)
182 self.assertTrue(measurement.fake_power.stop_called) 182 self.assertTrue(measurement.fake_power.stop_called)
OLDNEW
« no previous file with comments | « tools/perf/measurements/smooth_gesture_util_unittest.py ('k') | tools/perf/measurements/task_execution_time_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698