| 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 |
| 11 from telemetry.page import page | 11 from telemetry.page import page |
| 12 from telemetry.unittest_util import options_for_unittests | 12 from telemetry.unittest_util import options_for_unittests |
| 13 from telemetry.unittest_util import page_test_test_case | 13 from telemetry.unittest_util import page_test_test_case |
| 14 | 14 |
| 15 class FakeTracingController(object): | 15 class FakeTracingController(object): |
| 16 def __init__(self): | 16 def __init__(self): |
| 17 self.category_filter = None | 17 self.category_filter = None |
| 18 def Start(self, _options, category_filter, _timeout): | 18 def Start(self, _options, category_filter, _timeout): |
| 19 self.category_filter = category_filter | 19 self.category_filter = category_filter |
| 20 def IsDisplayTracingSupported(self): | |
| 21 return False | |
| 22 | 20 |
| 23 class FakePlatform(object): | 21 class FakePlatform(object): |
| 24 def __init__(self): | 22 def __init__(self): |
| 25 self.tracing_controller = FakeTracingController() | 23 self.tracing_controller = FakeTracingController() |
| 26 def CanMonitorPower(self): | 24 def CanMonitorPower(self): |
| 27 return False | 25 return False |
| 28 | 26 |
| 29 | 27 |
| 30 class FakeBrowser(object): | 28 class FakeBrowser(object): |
| 31 def __init__(self): | 29 def __init__(self): |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 self.fake_power = self._power_metric = FakePowerMetric(platform) | 193 self.fake_power = self._power_metric = FakePowerMetric(platform) |
| 196 | 194 |
| 197 measurement = BuggyMeasurement() | 195 measurement = BuggyMeasurement() |
| 198 try: | 196 try: |
| 199 self.RunMeasurement(measurement, ps) | 197 self.RunMeasurement(measurement, ps) |
| 200 except exceptions.IntentionalException: | 198 except exceptions.IntentionalException: |
| 201 pass | 199 pass |
| 202 | 200 |
| 203 self.assertTrue(measurement.fake_power.start_called) | 201 self.assertTrue(measurement.fake_power.start_called) |
| 204 self.assertTrue(measurement.fake_power.stop_called) | 202 self.assertTrue(measurement.fake_power.stop_called) |
| OLD | NEW |