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

Unified Diff: tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py

Issue 509043002: [Telemetry] Combine SysfsPlatformBackend into LinuxBasedPlatformBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
Index: tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py
diff --git a/tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py b/tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py
index dce2c872ad417228cd93fa5b6f03630f72cbf03e..1120c613ccd79c4cea18d96183709c41c468d3be 100644
--- a/tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py
+++ b/tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py
@@ -43,6 +43,7 @@ class MockDevice(object):
def SetProp(self, property_name, property_value):
self.old_interface.system_properties[property_name] = property_value
+
class AndroidPlatformBackendTest(unittest.TestCase):
def setUp(self):
self._stubs = system_stub.Override(android_platform_backend,
@@ -73,3 +74,26 @@ class AndroidPlatformBackendTest(unittest.TestCase):
adb_empty_proc_stat, False)
cpu_stats = backend.GetCpuStats('7702')
self.assertEquals(cpu_stats, {})
+
+ def testAndroidParseCpuStates(self):
+ cstate = {
+ 'cpu0': 'C0\nC1\n103203424\n5342040\n300\n500\n1403232500',
+ 'cpu1': 'C0\n124361858\n300\n1403232500'
+ }
+ expected_cstate = {
+ 'cpu0': {
+ 'WFI': 103203424,
+ 'C0': 1403232391454536,
+ 'C1': 5342040
+ },
+ 'cpu1': {
+ 'WFI': 124361858,
+ 'C0': 1403232375638142
+ }
+ }
+ # Use mock start and end times to allow for the test to calculate C0.
+ result = android_platform_backend.AndroidPlatformBackend.ParseCStateSample(
+ cstate)
+ for cpu in result:
+ for state in result[cpu]:
+ self.assertAlmostEqual(result[cpu][state], expected_cstate[cpu][state])

Powered by Google App Engine
This is Rietveld 408576698