| 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.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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 'percentage_smooth') | 142 'percentage_smooth') |
| 143 self.assertEquals(len(percentage_smooth), 1) | 143 self.assertEquals(len(percentage_smooth), 1) |
| 144 self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) | 144 self.assertGreaterEqual(percentage_smooth[0].GetRepresentativeNumber(), 0) |
| 145 | 145 |
| 146 def testCleanUpTrace(self): | 146 def testCleanUpTrace(self): |
| 147 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) | 147 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) |
| 148 | 148 |
| 149 def testCleanUpPowerMetric(self): | 149 def testCleanUpPowerMetric(self): |
| 150 class FailPage(page.Page): | 150 class FailPage(page.Page): |
| 151 def __init__(self, page_set): | 151 def __init__(self, page_set): |
| 152 # pylint: disable=bad-super-call | |
| 153 super(FailPage, self).__init__( | 152 super(FailPage, self).__init__( |
| 154 url='file://blank.html', | 153 url='file://blank.html', |
| 155 page_set=page_set, base_dir=page_set.base_dir) | 154 page_set=page_set, base_dir=page_set.base_dir) |
| 156 def RunSmoothness(self, _): | 155 def RunSmoothness(self, _): |
| 157 raise exceptions.IntentionalException | 156 raise exceptions.IntentionalException |
| 158 | 157 |
| 159 class FakePowerMetric(power.PowerMetric): | 158 class FakePowerMetric(power.PowerMetric): |
| 160 start_called = False | 159 start_called = False |
| 161 stop_called = True | 160 stop_called = True |
| 162 def Start(self, _1, _2): | 161 def Start(self, _1, _2): |
| (...skipping 11 matching lines...) Expand all Loading... |
| 174 self.fake_power = self._power_metric = FakePowerMetric(platform) | 173 self.fake_power = self._power_metric = FakePowerMetric(platform) |
| 175 | 174 |
| 176 measurement = BuggyMeasurement() | 175 measurement = BuggyMeasurement() |
| 177 try: | 176 try: |
| 178 self.RunMeasurement(measurement, ps) | 177 self.RunMeasurement(measurement, ps) |
| 179 except page_test.TestNotSupportedOnPlatformFailure: | 178 except page_test.TestNotSupportedOnPlatformFailure: |
| 180 pass | 179 pass |
| 181 | 180 |
| 182 self.assertTrue(measurement.fake_power.start_called) | 181 self.assertTrue(measurement.fake_power.start_called) |
| 183 self.assertTrue(measurement.fake_power.stop_called) | 182 self.assertTrue(measurement.fake_power.stop_called) |
| OLD | NEW |