1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
7 from telemetry.core.platform.power_monitor import power_monitor_controller
8 import telemetry.core.platform.power_monitor as power_monitor
11 class PowerMonitorControllerTest(unittest.TestCase):
12 def testComposition(self):
14 class P1(power_monitor.PowerMonitor):
15 def StartMonitoringPowerAsync(self):
16 raise NotImplementedError()
17 def StopMonitoringPowerAsync(self):
18 raise NotImplementedError()
20 class P2(power_monitor.PowerMonitor):
21 def __init__(self, value):
22 super(P2, self).__init__()
24 def CanMonitorPowerAsync(self):
26 def StartMonitoringPowerAsync(self):
28 def StopMonitoringPowerAsync(self):
31 controller = power_monitor_controller.PowerMonitorController(
33 self.assertEqual(controller.CanMonitorPowerAsync(), True)
34 controller.StartMonitoringPowerAsync()
35 self.assertEqual(controller.StopMonitoringPowerAsync(), 1)