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

Unified Diff: tools/telemetry/telemetry/internal/platform/power_monitor/sysfs_power_monitor_unittest.py

Issue 1255673002: [Android][Telemetry] Add support for multiple power monitors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/internal/platform/power_monitor/sysfs_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/internal/platform/power_monitor/sysfs_power_monitor_unittest.py
diff --git a/tools/telemetry/telemetry/internal/platform/power_monitor/sysfs_power_monitor_unittest.py b/tools/telemetry/telemetry/internal/platform/power_monitor/sysfs_power_monitor_unittest.py
index f79d75b5da1ef57f1154b8a872da1fdadd9d3347..4ed6ea0052eb8e25d4ab42d5d6125c4ac56e88b1 100644
--- a/tools/telemetry/telemetry/internal/platform/power_monitor/sysfs_power_monitor_unittest.py
+++ b/tools/telemetry/telemetry/internal/platform/power_monitor/sysfs_power_monitor_unittest.py
@@ -245,3 +245,34 @@ class SysfsPowerMonitorMonitorTest(unittest.TestCase):
result = android_platform_backend.AndroidPlatformBackend.ParseCStateSample(
cstate)
self.assertDictEqual(expected_result, result)
+
+ def testStandAlone(self):
+ class PlatformStub(object):
+ def __init__(self, run_command_return_value):
+ self._run_command_return_value = run_command_return_value
+ def RunCommand(self, _cmd):
+ return self._run_command_return_value
+
+ cpu_state_from_samsung_note3 = (
+ "C0\n\nC1\n\nC2\n\nC3\n\n"
+ "53658520886\n1809072\n7073\n1722554\n"
+ "1\n35\n300\n500\n"
+ "1412949256\n")
+ expected_cstate_dict = {
+ 'C0': 1412895593940415,
+ 'C1': 1809072,
+ 'C2': 7073,
+ 'C3': 1722554,
+ 'WFI': 53658520886
+ }
+ cpus = ["cpu%d" % cpu for cpu in range(2)]
+ expected_result = dict(zip(cpus, [expected_cstate_dict]*len(cpus)))
+
+ sysfsmon = sysfs_power_monitor.SysfsPowerMonitor(
+ PlatformStub(cpu_state_from_samsung_note3), standalone=True)
+ # pylint: disable=W0212
+ sysfsmon._cpus = cpus
+ cstate = sysfsmon.GetCpuState()
+ result = android_platform_backend.AndroidPlatformBackend.ParseCStateSample(
+ cstate)
+ self.assertDictEqual(expected_result, result)
« no previous file with comments | « tools/telemetry/telemetry/internal/platform/power_monitor/sysfs_power_monitor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698