Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Unified Diff: tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor_unittest.py

Issue 225493003: Fix power measurement with dumpsys when the format is unrecognized. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index dc524b2ade6978f85198470049dbfb59b6edb888..b07f3600ff0639806c1828a60d1a8c0d928f7d2f 100644
--- 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
@@ -20,5 +20,17 @@ class DS2784PowerMonitorMonitorTest(unittest.TestCase):
self.assertEqual(results['identifier'], 'dumpsys')
self.assertAlmostEqual(results['energy_consumption_mwh'], 2.924)
+ # Older version of the OS do not have the data.
+ def testNoData(self):
+ package = 'com.android.chrome'
+ dumpsys_output = os.path.join(GetUnittestDataDir(),
+ 'batterystats_v7_no_data.csv')
+ with open(dumpsys_output, 'r') as output:
+ results = (
+ android_dumpsys_power_monitor.DumpsysPowerMonitor.ParseSamplingOutput(
+ package, output))
+ self.assertEqual(results['identifier'], 'dumpsys')
+ self.assertEqual(results['energy_consumption_mwh'], 0)
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « tools/telemetry/telemetry/core/platform/power_monitor/android_dumpsys_power_monitor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698