| Index: tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor_unittest.py
|
| diff --git a/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor_unittest.py b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor_unittest.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dc524b2ade6978f85198470049dbfb59b6edb888
|
| --- /dev/null
|
| +++ b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor_unittest.py
|
| @@ -0,0 +1,24 @@
|
| +# Copyright 2014 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import os
|
| +import unittest
|
| +
|
| +from telemetry.core.platform.power_monitor import android_dumpsys_power_monitor
|
| +from telemetry.core.util import GetUnittestDataDir
|
| +
|
| +
|
| +class DS2784PowerMonitorMonitorTest(unittest.TestCase):
|
| + def testEnergyComsumption(self):
|
| + package = 'com.google.android.apps.chrome'
|
| + dumpsys_output = os.path.join(GetUnittestDataDir(), 'batterystats_v7.csv')
|
| + with open(dumpsys_output, 'r') as output:
|
| + results = (
|
| + android_dumpsys_power_monitor.DumpsysPowerMonitor.ParseSamplingOutput(
|
| + package, output))
|
| + self.assertEqual(results['identifier'], 'dumpsys')
|
| + self.assertAlmostEqual(results['energy_consumption_mwh'], 2.924)
|
| +
|
| +if __name__ == '__main__':
|
| + unittest.main()
|
|
|