Chromium Code Reviews| 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..48fbdb0fefa032fa092d27f08b4a75f396ae06b3 |
| --- /dev/null |
| +++ b/tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor_unittest.py |
| @@ -0,0 +1,23 @@ |
| +# 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.csv') |
| + with open(dumpsys_output, 'r') as output: |
| + results = ( |
| + android_dumpsys_power_monitor.DumpsysPowerMonitor.ParseSamplingOutput( |
| + package, output)) |
| + self.assertAlmostEqual(results['energy_consumption_mwh'], 2.924) |
|
jeremy
2014/04/03 11:16:30
Can you check the 'identifier' field here too?
qsr
2014/04/03 12:02:43
Done.
|
| + |
| +if __name__ == '__main__': |
| + unittest.main() |