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. 4 5import logging 6import unittest 7 8from telemetry import decorators 9from telemetry.core.platform import win_platform_backend 10from telemetry.core.platform.power_monitor import ippet_power_monitor 11 12 13class IppetPowerMonitorTest(unittest.TestCase): 14 @decorators.Enabled('win') 15 def testFindOrInstallIppet(self): 16 self.assertTrue(ippet_power_monitor.IppetPath()) 17 18 @decorators.Enabled('win') 19 def testIppetRunsWithoutErrors(self): 20 # Very basic test, doesn't validate any output data. 21 platform_backend = win_platform_backend.WinPlatformBackend() 22 power_monitor = ippet_power_monitor.IppetPowerMonitor(platform_backend) 23 if not power_monitor.CanMonitorPower(): 24 logging.warning('Test not supported on this platform.') 25 return 26 27 power_monitor.StartMonitoringPower(None) 28 statistics = power_monitor.StopMonitoringPower() 29 30 self.assertEqual(statistics['identifier'], 'ippet') 31