OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 self.assertEquals(len(percentage_smooth), 1) | 121 self.assertEquals(len(percentage_smooth), 1) |
122 self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) | 122 self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) |
123 | 123 |
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 @decorators.Enabled('android') # SurfaceFlinger is android-only |
| 132 def testSmoothnessSurfaceFlingerMetricsCalculated(self): |
| 133 ps = self.CreatePageSetFromFileInUnittestDataDir('scrollable_page.html') |
| 134 measurement = smoothness.Smoothness() |
| 135 results = self.RunMeasurement(measurement, ps, options=self._options) |
| 136 self.assertEquals(0, len(results.failures)) |
| 137 |
| 138 avg_surface_fps = results.FindAllPageSpecificValuesNamed('avg_surface_fps') |
| 139 self.assertEquals(1, len(avg_surface_fps)) |
| 140 self.assertGreater(avg_surface_fps[0].GetRepresentativeNumber, 0) |
| 141 |
| 142 jank_count = results.FindAllPageSpecificValuesNamed('jank_count') |
| 143 self.assertEquals(1, len(jank_count)) |
| 144 self.assertGreater(jank_count[0].GetRepresentativeNumber(), -1) |
| 145 |
131 @decorators.Disabled('mac', 'chromeos') # http://crbug.com/403903 | 146 @decorators.Disabled('mac', 'chromeos') # http://crbug.com/403903 |
132 def testSmoothnessForPageWithNoGesture(self): | 147 def testSmoothnessForPageWithNoGesture(self): |
133 ps = self.CreateEmptyPageSet() | 148 ps = self.CreateEmptyPageSet() |
134 ps.AddUserStory(AnimatedPage(ps)) | 149 ps.AddUserStory(AnimatedPage(ps)) |
135 | 150 |
136 measurement = smoothness.Smoothness() | 151 measurement = smoothness.Smoothness() |
137 results = self.RunMeasurement(measurement, ps, options=self._options) | 152 results = self.RunMeasurement(measurement, ps, options=self._options) |
138 self.assertEquals(0, len(results.failures)) | 153 self.assertEquals(0, len(results.failures)) |
139 | 154 |
140 percentage_smooth = results.FindAllPageSpecificValuesNamed( | 155 percentage_smooth = results.FindAllPageSpecificValuesNamed( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 self.fake_power = self._power_metric = FakePowerMetric(platform) | 188 self.fake_power = self._power_metric = FakePowerMetric(platform) |
174 | 189 |
175 measurement = BuggyMeasurement() | 190 measurement = BuggyMeasurement() |
176 try: | 191 try: |
177 self.RunMeasurement(measurement, ps) | 192 self.RunMeasurement(measurement, ps) |
178 except exceptions.IntentionalException: | 193 except exceptions.IntentionalException: |
179 pass | 194 pass |
180 | 195 |
181 self.assertTrue(measurement.fake_power.start_called) | 196 self.assertTrue(measurement.fake_power.start_called) |
182 self.assertTrue(measurement.fake_power.stop_called) | 197 self.assertTrue(measurement.fake_power.stop_called) |
OLD | NEW |